socketio/socket.io-parser

RangeError: Maximum call stack size exceeded

t00 opened this issue · 9 comments

t00 commented

I have been trying to get to the bottom of a problem when socket.io-parser used by cypress is crashing when a large POST request is being made and operation times out. With a default responsetimeout of 30 seconds and upload size of 1MB, our dotnet core api endpoint is not responding in 30 seconds. After 30 seconds socket.io-parser crashes with the following callstack:


RangeError: Maximum call stack size exceeded
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:21:28)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)

... (about 15200 lines omitted) ...

    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:32:26)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:32:26)
    at Object.deconstructPacket (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:16:17)
    at Encoder.encodeAsBinary (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\index.js:81:41)
    at Encoder.encode (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\index.js:43:29)
    at Client._packet (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\client.js:167:44)
    at Socket.packet (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:161:21)
    at C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:270:18
    at C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\lib\socket-base.js:312:28
    at tryCatcher (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:725:18)
    at _drainQueueStep (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\6.8.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:15:14)
    at processImmediate (internal/timers.js:456:21)

Is there anything myself or cypress team can do do investigate the reason behind the issue?

I may note that the request is just contents of CSV file and response is a simple JSON.

t00 commented

The current cypress release seems to be using socket.io-parser 4.0.2: https://github.com/cypress-io/cypress/blob/develop/package.json

"RangeError: Maximum call stack size exceeded" errors typically means you are encoding a circular object. Is this your case?

Closed due to inactivity, please reopen if needed.

I am also getting this now.

Nothing in my code has changed causing this (if there is a circular object it is outside my control):

 Sep 01 20:00:32 swp-phase2-stage app/web.1 error: Unhandled Rejection at: [object Promise] reason: RangeError: Maximum call stack size exceeded
Sep 01 20:00:32 swp-phase2-stage app/web.1 error: Stack:  Maximum call stack size exceeded {"stack":"RangeError: Maximum call stack size exceeded\n    at get (internal/bootstrap/pre_execution.js:309:8)\n    at isBuf (/app/node_modules/socket.io/node_modules/socket.io-parser/is-buffer.js:18:31)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:128:44)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)\n    at _removeBlobs (/app/node_modules/socket.io/node_modules/socket.io-parser/binary.js:130:9)"}

I did notice this error showing up in your CI stack and probably why it is failing tho.

Another version:

 Sep 01 21:56:05 swp-phase2-stage app/web.1 error: Unhandled Rejection at: [object Promise] reason: TypeError: data.hasOwnProperty is not a function
Sep 01 21:56:05 swp-phase2-stage app/web.1 error: Stack: TypeError: data.hasOwnProperty is not a function
Sep 01 21:56:05 swp-phase2-stage app/web.1     at _deconstructPacket (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/binary.js:39:22)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at _deconstructPacket (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/binary.js:40:32)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at _deconstructPacket (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/binary.js:40:32)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at _deconstructPacket (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/binary.js:32:26)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Object.deconstructPacket (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/binary.js:16:17)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Encoder.encodeAsBinary (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/index.js:80:41)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Encoder.encode (/app/node_modules/socket.io/node_modules/socket.io-parser/dist/index.js:42:29)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Client._packet (/app/node_modules/socket.io/dist/client.js:160:28)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Socket.packet (/app/node_modules/socket.io/dist/socket.js:160:21)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at /app/node_modules/socket.io/dist/socket.js:274:18
Sep 01 21:56:05 swp-phase2-stage app/web.1     at handleError (/app/node_modules/@feathersjs/transport-commons/lib/socket/utils.js:72:13)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Object.<anonymous> (/app/node_modules/@feathersjs/transport-commons/lib/socket/utils.js:102:13)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at Generator.throw (<anonymous>)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at rejected (/app/node_modules/@feathersjs/transport-commons/lib/socket/utils.js:6:65)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at runMicrotasks (<anonymous>)
Sep 01 21:56:05 swp-phase2-stage app/web.1     at processTicksAndRejections (internal/process/task_queues.js:97:5)

I encountered the same mistake.
Has this issue been resolved since the last time?

RangeError: Maximum call stack size exceeded
    at _deconstructPacket (/home/jenkins/workspace/Cypress SPNS/spns/.cache/Cypress/6.9.1/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:21:28)
    at _deconstructPacket (/home/jenkins/workspace/Cypress SPNS/spns/.cache/Cypress/6.9.1/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
    at _deconstructPacket (/home/jenkins/workspace/Cypress SPNS/spns/.cache/Cypress/6.9.1/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
![max_call_size](https://user-images.githubusercontent.com/95093567/143603632-8b134efc-81e3-4a66-8484-d0807cece4f1.png)

I figured out my issue, was something else causing a circular object.

Also getting this.

[2022-10-31T15:52:05.279Z]     at _deconstructPacket (/home/ubuntu/.cache/Cypress/7.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)

I'm calling broken endpoints (which will be fixed) but I had to run the tests locally to find that out. Never seen anything like this before