threads.js icon indicating copy to clipboard operation
threads.js copied to clipboard

Better error message for Did not receive an init message from worker after 60000ms

Open linonetwo opened this issue 3 years ago • 1 comments

Error: Timeout: Did not receive an init message from worker after 60000ms. Make sure the worker calls expose().
    at Timeout._onTimeout (/Applications/TidGi.app/Contents/Resources/app.asar/.webpack/main/file:/Users/runner/work/TidGi-Desktop/TidGi-Desktop/node_modules/threads/dist/master/spawn.js:35:53)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

But its hard to tell which one causes the error (I have multiple workers)

And this only happen on electron startup sometimes, not always, maybe listener registered too late? Can I delay the expose so the listener gets the message always?

linonetwo avatar Apr 09 '22 08:04 linonetwo

Good point. Might be a duplicate of #420, though.

andywer avatar Apr 09 '22 22:04 andywer

This usually happened when a import xxx failed.

And import maybe good in dev env, but bad after electron packaged. So this will happened in electron production mode.

I found it by moving some of import to dynamic import, and it never say Did not receive an init message from worker after https://github.com/andywer/threads.js/issues/478

linonetwo avatar Jul 17 '23 08:07 linonetwo