orca
orca copied to clipboard
scattermapbox to_image error
Exporting a png of a scattermapbox chart using plotly.io.to_image()
results in this error:
ValueError:
The image request was rejected by the orca conversion utility
with the following error:
522: client socket timeout
It is somewhat inconsistent, sometimes I can export 20 images at a time and then stops altogether. I should add that I'm using GeoJson layers in my map. When it succeeds the output looks like this
I'm doing this from a controller in my application: all the other charts get exported with no problems and quite fast.
I tried launchung the orca server manually to see what is going on, and the error message is quite similar to the traceback I get from my webserver
{"severity":"ERROR","textPayload":"525 - plotly.js error","labels":{"fid":null}}
Lastly, I’ve used the basic example of scattermapbox to ensure nothing else was influencing the output and tried exporting a json with plotly, and then exporting it manually with orca.
Data = [
go.Scattermapbox(
lat=['45.5017'],
lon=['-73.5673'],
mode='markers',
marker=dict(
size=14
),
text=['Montreal'],
)
]
layout = go.Layout(
autosize=True,
hovermode='closest',
mapbox=dict(
accesstoken=MY_TOKEN,
bearing=0,
center=dict(
lat=45,
lon=-73
),
pitch=0,
zoom=5
),
)
fig = dict(data=data, layout=layout)
#write json with plotly.io
pio.write_json(fig, 'figure.json', pretty=True)
Then in my terminal:
$ orca graph figure.json --mapbox-access-token MY_TOKEN -o figure.png --verbose
The output was this
gpu process crashed - false
Chrome version 59.0.3071.115
Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Chrome version 59.0.3071.115
Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Chrome version 59.0.3071.115
Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Chrome version 59.0.3071.115
Electron version 1.8.4
Edit: I'm on windows
@fdrcslv Thank you for your interest in Orca and for reporting this issue. Can you add the following command line argument --verbose
and report the error message you're getting?
done that! The output was this
gpu process crashed - false
Chrome version 59.0.3071.115
Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Chrome version 59.0.3071.115
Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Chrome version 59.0.3071.115
Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
Chrome version 59.0.3071.115
Electron version 1.8.4
Thanks you for your time!
done that!
Oops my bad I didn't see that. It seems there is a problem rendering WebGL. Is WebGL working reliably on your machine (https://get.webgl.org/). Also, are you running this in a VM?
Yes it is working reliably, however I noticed that chrome version on my machine is 71.0.3578.98, while on the traceback it's this Chrome version 59.0.3071.115
.
Could it be that?
If I'm not wrong those versions of Electron and Chrome should be the stable dependencies for orca right?
No, I'm not running on a VM
Potentially also fixed by https://github.com/plotly/orca/pull/195
@etpinard @antoinerg Thank you very much for your work! I'll try v 1.2.1 both on windows and linux and see if it works so you can close this issue
Hey @etpinard and @antoinerg!
I'm running into the same issue as OP where using plotly.io.write_image()
to save a Scattermapbox as a .png
results in
ValueError:
The image request was rejected by the orca conversion utility
with the following error:
522: client socket timeout
I'm using
-
Mac OSX 10.14.2
-
plotly 3.4.2
-
orca 1.2.1
(was usingv1.1.1
but upgraded because of the above comment; same error on both versions)
The above are on my local machine (not VM) and I checked that WebGL is working properly via the link above.
I also ran through the steps that OP took to save the image as json using plotly.io.write_json()
and ran the same orca
command from the terminal. I got a different set of output than they did though
<--- Last few GCs --->
[87021:0x7ffa41857600] 72642 ms: Mark-sweep 2050.4 (2124.7) -> 2050.4 (2098.2) MB, 1468.1 / 0.1 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1468 ms) last resort
[87021:0x7ffa41857600] 74143 ms: Mark-sweep 2050.4 (2098.2) -> 2050.7 (2098.7) MB, 1500.6 / 0.1 ms last resort
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x3148bf3b14c9 <DedicatedWorkerGlobalScope map = 0x11d45be8d411>
the command never finished running after ~5 mins and I killed it from there.
Do you have any suggestions for what I should do get past this error? Thanks for your time!
I have been facing this timeout issue too. You can see here in create-server.js that Orca will produce a 522 error when a socket timeout occurs: https://github.com/plotly/orca/blob/master/src/app/server/create-server.js#L69
In my case, I think this is happening because I have a lot of data. I have been trying to increase the socket timeout using the requestTimeout option but with no success so far. requestTimeout doesn't even show up as a possible argument under "orca serve --help".
@tombailey I'm sorry to hear you are facing an issue with exporting scattermapbox
. Can you give me a rough estimate of how large your dataset is?
requestTimeout doesn't even show up as a possible argument under "orca serve --help".
It should be there as --request-timeout
: https://github.com/plotly/orca/blob/a2ce478735857ca6bcc03ebc798de017e87628bb/bin/serve.js#L48-L54
What version of Orca are you running?
@antoinerg
In my case, I am not using scattermapbox, instead a sankey diagram but I think the situation is similar. As a temporary hack, I have upped the timeout by manually editing my global node_modules.
The 522 error has now been replace by an Electron error as the process seems to be hitting OOM issues:
#
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
#
0 Electron Framework 0x00000001025ddc5c crashpad::CloseMultipleNowOrOnExec(int, int) + 961820
1 Electron Framework 0x0000000103002eab crashpad::CloseMultipleNowOrOnExec(int, int) + 11599723
2 libnode.dylib 0x0000000100922e1c V8_Fatal + 220
3 libnode.dylib 0x0000000100b562e7 v8::internal::FatalProcessOutOfMemory(char const*) + 599
On the --request-timeout arg, I see nothing in --help, see below:
$ orca --version
1.2.1
$ orca serve --help
orca serve
Usage:
$ orca serve -p 9999
Options:
--help [or -h]
Displays this message.
--port [or -p]
Sets the server's port number.
--plotly [or --plotlyjs, --plotly-js, --plotly_js, --plotlyJS, --plotlyJs]
Sets the path to the plotly.js bundle to use.
This option can be also set to 'latest' or any valid plotly.js server release (e.g. 'v1.2.3'),
where the corresponding plot.ly CDN bundle is used.
By default, the 'latest' CDN bundle is used.
--mapbox-access-token [or --mapboxAccessToken]
Sets mapbox access token. Required to export mapbox graphs.
Alternatively, one can set a `MAPBOX_ACCESS_TOKEN` environment variable.
--topojson
Sets path to topojson files.
By default, topojson files on the plot.ly CDN are used.
--mathjax [or --MathJax]
Sets path to MathJax files. Required to export LaTeX characters.
--inkscape [or --Inkscape]
Sets path to Inkscape executable. Required to export WMF and EMF formats.
--safe-mode [or --safeMode, --safe]
Turns on safe mode: where figures likely to make browser window hang during image generating are skipped.
--request-limit [or --requestLimit]
Sets a request limit that makes orca exit when reached.
--keep-alive [or --keepAlive]
Turn on keep alive mode where orca will (try to) relaunch server if process unexpectedly exits.
--window-max-number [or --windowMaxNumber, --maxNumberOfWindows]
Sets maximum number of browser windows the server can keep open at a given time.
--graph-only [or --graphOnly]
Launches only the graph component (not thumbnails, dash, etc.) to save memory and reduce the number of processes.
--quiet
Suppress all logging info.
--debug
Starts app in debug mode.
--cors
Enables Cross-Origin Resource Sharing (CORS)
@tombailey can you render your figure in a browser using plotly.js? If not, I suspect you're hitting this plotly.js issue: https://github.com/plotly/plotly.js/issues/3813
A fix for it will be released this week as part of plotly.js v1.49.0
.
@antoinerg I think you are right, in my case it appears it was a circular sankey issue although I couldn't get plotly.js v1.49.0 to render the sankey diagram either.
Back to the original issue, a 522 client timeout error would suggest large data or a bug causing Orca to spend too much time rendering the image so the timeout happens. Whether that is because of an infinite loop in my case or large data which might be the case for this original issue.
As @antoinerg mentions, --request-timeout can be used to give Orca more time to render an image assuming the issue isn't caused by an infinite loop.
@tombailey v1.49.0 hasn't been released yet although you can try a bundle built off master temporarily hosted here: https://45455-45646037-gh.circle-artifacts.com/0/dist/plotly.min.js
You can provide that URL to Orca directly via --plotly
flag.
It this still doesn't render, could you please open a new issue or append the problematic dataset to the issue: https://github.com/plotly/plotly.js/issues/3813.
Thanks @tombailey