bjrmatos / electron-workers

Run electron scripts in managed workers :rocket:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: electron manager could not start all workers..

lambda-zhang opened this issue · comments

how could i use electron-workers?
following README.md, use ipc mode, i got this:

{ Error: electron manager could not start all workers..
at startHandler (/home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/ElectronManager.js:137:37)
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/ElectronWorker.js:316:20
at ElectronWorker.statusHandler (/home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/ElectronWorker.js:349:16)
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/checkIpcStatus.js:39:9
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
workerErrors:
[ Error: message could not be sent to electron process
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/checkIpcStatus.js:39:12
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9),
Error: message could not be sent to electron process
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/checkIpcStatus.js:39:12
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9),
Error: message could not be sent to electron process
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/checkIpcStatus.js:39:12
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9),
Error: message could not be sent to electron process
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/checkIpcStatus.js:39:12
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9),
Error: message could not be sent to electron process
at /home/lambda/lambda/hotShare/urlAnalyser/node_modules/electron-workers/lib/checkIpcStatus.js:39:12
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9) ] }

hi! seems like you don't have electron installed, you can install electron in your project with npm install electron-prebuilt --save-dev. if that doesn't work please give more details, what OS are you using? what is your node version?

I saw same issue on Linux but not on Mac OS X.
My linux version is Ubuntu 14.04.4 LTS. Node v4 and v6.

My packages.json is
..
"main": "main.js",
"scripts": {
"start": "electron ."
},
"dependencies":{
"coffee-script": "~1.10.0",
"electron-workers": "~1.7.0",
"express": "~4.14.0",
"body-parser": "~1.0.1",
"underscore": "1.8.3"
},
"devDependencies": {
"electron-prebuilt": "^1.2.0"
}
...

@solderzzc thnks! i have not had the chance to test electron-workers in linux, another user has reported that it can't start at all. i will find the time to test in linux and fix the startup

@bjrmatos That's would be great, thanks for your outstanding job on electron-workers.

You may want to look into the startup of 'nightmare', I found they had same issue on google, but can run on my Linux for now.

https://raw.githubusercontent.com/segmentio/nightmare/master/example.js

FYI, the details of why this package doesn't work on linux are here TL;DR; electron issue in linux.

i'll wait to someone on the electron team to look at the issue, if it takes too long i will publish a workaround.

Any news on this?
I tried setting up a virtual display on my Linux server as pointed on a lot of discussions:

$ sudo apt-get install xvfb
$ export DISPLAY=':99.0'
$ Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

After this electron seems to work:

$ node_modules/electron-prebuilt/dist/electron -v
Xlib:  extension "RANDR" missing on display ":99.0".v1.4.0.

But I'm still stuck with the error:

{ [Error: electron manager could not start all workers..]
  workerErrors:
   [ [Error: message could not be sent to electron process],
     [Error: message could not be sent to electron process] ] }

I've tried both the ipc and server modes without any luck.

Do you think is it possibile to run the server with xvfb-maybe?

@destegabry the error is because an issue in electron, see electron/electron#6868, we are waiting until that issue is resolved.

@bjrmatos I just tried today on a node docker image but I can't make it work. I use the latest version of this lib so the DISPLAY env fix is there but I still have the same error as @destegabry.
Also tried both ipc and server.
I configured my docker image with Xvfb.

Do you have any clues? Or at least how can I know why the electron workers are not launching? There is no logs and if I run node_modules/electron/dist/electron nothing is displayed, the process exits immediately.

Thanks!

@Kerumen Here is the dockerfile we use in jsreportonline for this
https://github.com/jsreportonline/electron-pdf

@pofider Thanks! Got it working by running CMD Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & export DISPLAY=:99.0 && node index.js as you did and not in separated RUNs and ENVs instructions.

As a side question, why do you have FROM ubuntu and install Node.js from apt? Mine is FROM node and is working well.

@Kerumen No particular reason, just wanted to use the same base image as in other heavy images I have.

this shouldn't be a problem anymore! it has been fixed propagating the DISPLAY env var to the electron process in this line