Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running saveSVG.js example on Ubuntu on version 6.0.1 #212

Closed
lobis opened this issue Apr 4, 2021 · 4 comments
Closed

Error running saveSVG.js example on Ubuntu on version 6.0.1 #212

lobis opened this issue Apr 4, 2021 · 4 comments

Comments

@lobis
Copy link
Contributor

lobis commented Apr 4, 2021

Hello,

I am running into an error when I run the saveSVG.js example on a Ubuntu 20.04 host. The example runs OK for me in my windows machine. (both are using node 15).

me@host:~/share/github/radiation-transport-visualization/geometry-browser/node$ node saveSVG.js
JSROOT version 6.0.1 1/03/2021
length of data = 47513
length of dezipped =883215
making SVG
Reuse existing d3.js version 6.6.2, expected 6.1.1
Creating clones 420 takes 4 uniquevis 334
THREE.WebGLRenderer: Cannot read property 'getShaderPrecisionFormat' of undefined
/mnt/c/WSL-Ubuntu-20.04/github/radiation-transport-visualization/geometry-browser/node/node_modules/three/build/three.js:17284
                        if (_gl.getShaderPrecisionFormat === undefined) {
                                ^

TypeError: Cannot read property 'getShaderPrecisionFormat' of undefined
    at new WebGLRenderer (/mnt/c/WSL-Ubuntu-20.04/github/radiation-transport-visualization/geometry-browser/node/node_modules/three/build/three.js:17284:12)
    at Object.jsrp.createRender3D (/mnt/c/WSL-Ubuntu-20.04/github/radiation-transport-visualization/geometry-browser/node/node_modules/jsroot/scripts/JSRoot.base3d.js:318:21)
    at TGeoPainter.createScene (/mnt/c/WSL-Ubuntu-20.04/github/radiation-transport-visualization/geometry-browser/node/node_modules/jsroot/scripts/JSRoot.geom.js:1978:29)
    at TGeoPainter.prepareObjectDraw (/mnt/c/WSL-Ubuntu-20.04/github/radiation-transport-visualization/geometry-browser/node/node_modules/jsroot/scripts/JSRoot.geom.js:3087:25)
    at /mnt/c/WSL-Ubuntu-20.04/github/radiation-transport-visualization/geometry-browser/node/node_modules/jsroot/scripts/JSRoot.geom.js:4139:78

You can reproduce this on a docker container as follows (I demonstrate it for node 12, but would also fail for 15, but I don't use 15 since additional dependencies are requiered):

docker run -it ubuntu:latest

apt update
apt install -y curl git
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt install -y nodejs
node --version
npm install jsroot
git clone https://github.com/root-project/jsroot.git
cd jsroot/demo/node
node makesvg.js

After installing, the error is the following:

root@4eabd05dfaf8:/jsroot/demo/node# node makesvg.js                                                                                                                                                               JSROOT version 6.0.1 1/03/2021                                                                                                                                                                                     Reuse existing d3.js version 6.6.2, expected 6.1.1                                                                                                                                                                 THREE.WebGLRenderer: Cannot read property 'getShaderPrecisionFormat' of undefined                                                                                                                                  (node:4146) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getShaderPrecisionFormat' of undefined                                                                                                  at new WebGLRenderer (/node_modules/three/build/three.js:17284:12)                                                                                                                                                 at Object.jsrp.createRender3D (/node_modules/jsroot/scripts/JSRoot.base3d.js:318:21)                                                                                                                               at TFramePainter.JSROOT.TFramePainter.create3DScene (/node_modules/jsroot/scripts/JSRoot.hist3d.js:190:28)                                                                                                         at TH2Painter.JSROOT.TH2Painter.draw3D (/node_modules/jsroot/scripts/JSRoot.hist3d.js:1510:18)                                                                                                                     at /node_modules/jsroot/scripts/JSRoot.hist.js:6483:55                                                                                                                                                             at processTicksAndRejections (internal/process/task_queues.js:97:5)                                                                                                                                            (node:4146) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)                                                                                                                                                                                                              (node:4146) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.        
root@4eabd05dfaf8:/jsroot/demo/node#  

image

@linev
Copy link
Member

linev commented Apr 6, 2021

Yes, I can reproduce a problem.
It is missing DISPLAY variable.
JSROOT uses canvas module for 3D visualization and it requires display.
You can do following:

apt-get install xvfb
xvfb-run node makesvg.js

@lobis lobis closed this as completed Apr 6, 2021
@linev
Copy link
Member

linev commented Apr 6, 2021

I keep it open for a while.
I do not like that for running batch jobs one have to use X11 (or its emulator).
After 6.1 release I will upgrade three.js and also will try to find another solution here

@linev linev reopened this Apr 6, 2021
@lobis
Copy link
Contributor Author

lobis commented Apr 6, 2021

Much better, thanks!

@linev
Copy link
Member

linev commented Apr 16, 2021

After some investigation - seems to be headless-gl does not support real offscreen rendering and requires X11 running.
There is PR stackgl/headless-gl#116, which potentially should enable alternatives - but it is open for 4 years.
For the moment I see no other alternatives of using xvfb-run

@linev linev closed this as completed Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants