chjj / bthreads

worker threads for javascript
Other
48 stars 0 forks source link

[help] ERR_WORKER_INVALID_PACKET error #7

Open ggb88 opened 4 years ago

ggb88 commented 4 years ago

I'm running node.js app with bthreads 0.5.1 and spawning (in this case) 3 processes with the same source file using require('bthreads/process');

....

    start() {
        this._worker = new threads.Worker(this._workerFilename, {
            workerData: this._workerData
        });

        this._worker.once('exit', (code) => {
            this.emit('done');
        });
    } 

These can be long running processes - after approx 10 mins of processing, the following error occurs:

Error [ERR_WORKER_INVALID_PACKET]: Received invalid packet (10).
    at Parser.parseHeader (/Users/.../node_modules/bthreads/lib/process/parser.js:138:13)
    at Parser.parse (/Users/.../node_modules/bthreads/lib/process/parser.js:103:23)
    at Parser.feed (/Users/.../node_modules/bthreads/lib/process/parser.js:50:12)
    at Socket.<anonymous> (/Users/.../node_modules/bthreads/lib/process/worker.js:355:22)
    at Socket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:182:23)

The only lead I have is that when I reduce the amount of console logging (to simulate prod ops) the problem has not recurred. That said, I'd rather try and find the issue rather than hope it doesn't occur in prod.