question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Threads.expose is called to late - "Did not receive an init message from worker after 10000ms" on clean 1.8.16 install

See original GitHub issue

Clean install of etherpad-lite 1.8.16 fails to run on alpine edge in an lxc container on armhf architecture. The same command chain on a x86_64 succeeds (sic!).

I’m quite lost where to look for a solution to this problem, especially that the SBC (banana pro) that etherpad fails to start on is slow.

What I see on the first request from any web browser is:

[2022-01-26 12:38:09.239] [INFO] server - Etherpad is running
[2022-01-26 12:38:35.968] [ERROR] console - Error: Timeout: Did not receive an init message from worker after 10000ms. Make sure the worker calls expose().
    at Timeout._onTimeout (/var/etherpad-lite-1.8.16/src/node_modules/threads/dist/master/spawn.js:35:53)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

The error repeats multiple times at once. The error appears almost immediately after entering container IP in a web browser, not after the 10 seconds that the message mentions.

Node.js versions tested: 16.13.2 and 17.4.0

To Reproduce

  1. lxc-create -t download -n ep
    1. Distribution: alpine
    2. Release: edge
    3. Architecture: armhf
  2. lxc-start ep && lxc-attach ep
  3. apk update
  4. apk add nodejs npm build-base python3 sqlite # extra packages are needed due to ep dependencies
  5. wget https://github.com/ether/etherpad-lite/archive/1.8.16.zip
  6. unzip 1.8.16.zip
  7. cd etherpad-lite-1.8.16
  8. cp settings.json.template settings.json
  9. vi settings.json # added an admin user and changed the port to 80
  10. ./bin/run.sh --root

Server

  • Etherpad version: 1.8.16 (I hit the problem first with current development branch, then tried a clean install once all else failed)
  • OS: alpine in lxc (run in debian testing, but I doubt this matters)
  • Hardware: armhf, sun7i-a20-bananapro
  • Node.js version: v16.13.2 (upgrading to 17.4.0 did not help either)
  • npm version: 8.3.0
  • Is the server free of plugins: yes

Additional For some reason installing dependencies compiles sqlite3 (for node-pre-gyp fails to find precompiled binaries), and so installing dependencies takes way too long.

I ended up hitting this issue on an upgrade from etherpad-lite1.8.0-beta.1 running on node v12.13.1 in another alpine container on the same machine that now fails to run current etherpad-lite & node. Simple upgrade failed with the same results, so I tried a clean install and it fails the same way…

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
deurbroucqcommented, Jan 26, 2022

@rhansen No, I am not running on armhf. I am running on x86_64. However, the minify workaround in settings.json worked for me too! Thank you!

1reaction
anonymous-14523commented, Jan 26, 2022

(you can skip to past the last <hr>)


To confirm I understand correctly:

Etherpad 1.8.0-beta.1 on Node.js v12.13.1 works on armhf. Etherpad 1.8.16 on Node.js v16.13.2 (or v17.4.0) does not work on armhf.

Yes.

Is that correct? If so, can you try bisecting to identify the commit causing it to fail?

Hm… this is theoretically possible, for I tested right now that 1.8.0-beta.1 still works with updated node (v16.13.2).

The practical problem that refrains me from this is that new node (1.8.16) needs something that needs sqlite3. Now the problem is that node-pre-gyp finds no pre-build binaries for sqlite3 and compiles it itself, and so installing dependencies takes half an hour (that arm is old and sqlite3 alone compiles about 3 minutes on my desktop…).


> require('./node/utils/MinifyWorker')

This seems fine, I get similar error (line numbers slightly differ, though):

Welcome to Node.js v16.13.2.
Type ".help" for more information.
> require('./node/utils/MinifyWorker')
Uncaught Error: expose() called in the master thread.
    at Object.expose (/var/etherpad-lite/src/node_modules/threads/dist/worker/index.js:146:15)
    at Object.<anonymous> (/var/etherpad-lite/src/node/utils/MinifyWorker.js:30:9)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
>

A possible workaround is to set the following in your settings.json:

  "minify": false,

Wow! This worked! 👍

Also: this significantly speeds up loading time: tell me, does etherpad cache minifed js, or minifies it frequently?

(I’m fine with this workround, so the issue might be closed.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

threadsjs/community - Gitter
Worker script does not exist in the final build, resulting in Timeout: Did not receive an init message from worker after 10000ms. Make...
Read more >
Basic usage - Web worker meets worker threads
A function worker exposes a single function that can be called from the master thread. // master.js import { spawn, Thread, Worker } ......
Read more >
A Brief Guide on Worker Threads in Node.js
Worker threads aka workers are part of the same process. Each of these threads will have its own JS engine instance, its own...
Read more >
Using worker threads in FeathersJS | by Jiri Richter - Medium
Javascript is a single-threaded language and it provides lots of ways to performantly deal with tasks that in other languages would ...
Read more >
Threads.expose is called to late - ether/etherpad-lite
ether/etherpad-lite: Threads.expose is called to late - "Did not receive an init message from worker after 10000ms" on clean 1.8.16 install.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found