intermittent failure in export_png when using background image

I have a pipeline that generates hundreds of single instance bokeh graphs and send them via export_png to selenium / headless chrome for export as a png.

Without a background image, I have no problems and the pipeline always completes successfully via export_png

With a background image added to the figure encoded as base64

p_figure.image_url( [rgb_encoded_image],

x=x, y=y,w=w,h=h, angle=0, level=‘image’,global_alpha=0.5)

There is a chance which seems strongly related to speed of execution ( it is a much smaller though still a chance if verbose logging is active ) that on any frame I can get an error.

Its hard to work out where the error is coming from due to the verbosity of the logging, but it is roughly as per the following comment ( I must switch to inside my VM for cut and paste :-()

2018-07-22 14:58:33,866 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - POST http://127.0.0.1:33797/session/76bb886037aef816f0433ae093950c3f/execute {“sessionId”: “76bb886037aef816f0433ae093950c3f”, “args”: , “script”: “\n// add private window prop to check that render is complete\nwindow._bokeh_render_complete = false;\nfunction done() {\n window._bokeh_render_complete = true;\n}\n\nvar doc = window.Bokeh.documents[0];\n\nif (doc.is_idle)\n done();\nelse\n doc.idle.connect(done);\n”}

2018-07-22 14:58:34,046 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - {“sessionId”:“76bb886037aef816f0433ae093950c3f”,“status”:13,“value”:{“message”:“unknown error: Cannot read property ‘is_idle’ of undefined\n (Session info: headless chrome=67.0.3396.99)\n (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.13.0-45-generic x86_64)”}}

2018-07-22 14:58:34,046 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - Finished Request

2018-07-22 14:58:34,071 - bag_tools_ng - MainThread - ERROR - Plugin ‘anime’ threw an exception on call to stop. Exception - Message: unknown error: Cannot read property ‘is_idle’ of undefined

(Session info: headless chrome=67.0.3396.99)

(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.13.0-45-generic x86_64)

I have tried to cut and paste the relevant info from the spam.

I am at a loss on how to continue to debug into this issue, any thoughts on what to look at would be greatly appreciated.

···

On Sunday, July 22, 2018 at 3:17:28 PM UTC-4, Anthony Tod wrote:

I have a pipeline that generates hundreds of single instance bokeh graphs and send them via export_png to selenium / headless chrome for export as a png.

Without a background image, I have no problems and the pipeline always completes successfully via export_png

With a background image added to the figure encoded as base64

p_figure.image_url( [rgb_encoded_image],

x=x, y=y,w=w,h=h, angle=0, level=‘image’,global_alpha=0.5)

There is a chance which seems strongly related to speed of execution ( it is a much smaller though still a chance if verbose logging is active ) that on any frame I can get an error.

Its hard to work out where the error is coming from due to the verbosity of the logging, but it is roughly as per the following comment ( I must switch to inside my VM for cut and paste :-()

With further testing I have found instances of the same failure where the background image is not required to trigger the failure, just increases the chance

So seems in the basic behaviour

···

On Sunday, July 22, 2018 at 3:20:36 PM UTC-4, Anthony Tod wrote:

2018-07-22 14:58:33,866 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - POST http://127.0.0.1:33797/session/76bb886037aef816f0433ae093950c3f/execute {“sessionId”: “76bb886037aef816f0433ae093950c3f”, “args”: , “script”: “\n// add private window prop to check that render is complete\nwindow._bokeh_render_complete = false;\nfunction done() {\n window._bokeh_render_complete = true;\n}\n\nvar doc = window.Bokeh.documents[0];\n\nif (doc.is_idle)\n done();\nelse\n doc.idle.connect(done);\n”}

2018-07-22 14:58:34,046 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - {“sessionId”:“76bb886037aef816f0433ae093950c3f”,“status”:13,“value”:{“message”:“unknown error: Cannot read property ‘is_idle’ of undefined\n (Session info: headless chrome=67.0.3396.99)\n (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.13.0-45-generic x86_64)”}}

2018-07-22 14:58:34,046 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - Finished Request

2018-07-22 14:58:34,071 - bag_tools_ng - MainThread - ERROR - Plugin ‘anime’ threw an exception on call to stop. Exception - Message: unknown error: Cannot read property ‘is_idle’ of undefined

(Session info: headless chrome=67.0.3396.99)

(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.13.0-45-generic x86_64)

I have tried to cut and paste the relevant info from the spam.

I am at a loss on how to continue to debug into this issue, any thoughts on what to look at would be greatly appreciated.

On Sunday, July 22, 2018 at 3:17:28 PM UTC-4, Anthony Tod wrote:

I have a pipeline that generates hundreds of single instance bokeh graphs and send them via export_png to selenium / headless chrome for export as a png.

Without a background image, I have no problems and the pipeline always completes successfully via export_png

With a background image added to the figure encoded as base64

p_figure.image_url( [rgb_encoded_image],

x=x, y=y,w=w,h=h, angle=0, level=‘image’,global_alpha=0.5)

There is a chance which seems strongly related to speed of execution ( it is a much smaller though still a chance if verbose logging is active ) that on any frame I can get an error.

Its hard to work out where the error is coming from due to the verbosity of the logging, but it is roughly as per the following comment ( I must switch to inside my VM for cut and paste :-()

A bit of try: except: magic can protect me from the intermittent failures, so its not critical path, but this does appear to be a likely race condition in the export_png / selenium / chromedriver pipeline

···

On Sunday, July 22, 2018 at 3:28:22 PM UTC-4, Anthony Tod wrote:

With further testing I have found instances of the same failure where the background image is not required to trigger the failure, just increases the chance

So seems in the basic behaviour

On Sunday, July 22, 2018 at 3:20:36 PM UTC-4, Anthony Tod wrote:

2018-07-22 14:58:33,866 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - POST http://127.0.0.1:33797/session/76bb886037aef816f0433ae093950c3f/execute {“sessionId”: “76bb886037aef816f0433ae093950c3f”, “args”: , “script”: “\n// add private window prop to check that render is complete\nwindow._bokeh_render_complete = false;\nfunction done() {\n window._bokeh_render_complete = true;\n}\n\nvar doc = window.Bokeh.documents[0];\n\nif (doc.is_idle)\n done();\nelse\n doc.idle.connect(done);\n”}

2018-07-22 14:58:34,046 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - {“sessionId”:“76bb886037aef816f0433ae093950c3f”,“status”:13,“value”:{“message”:“unknown error: Cannot read property ‘is_idle’ of undefined\n (Session info: headless chrome=67.0.3396.99)\n (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.13.0-45-generic x86_64)”}}

2018-07-22 14:58:34,046 - selenium.webdriver.remote.remote_connection - MainThread - DEBUG - Finished Request

2018-07-22 14:58:34,071 - bag_tools_ng - MainThread - ERROR - Plugin ‘anime’ threw an exception on call to stop. Exception - Message: unknown error: Cannot read property ‘is_idle’ of undefined

(Session info: headless chrome=67.0.3396.99)

(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.13.0-45-generic x86_64)

I have tried to cut and paste the relevant info from the spam.

I am at a loss on how to continue to debug into this issue, any thoughts on what to look at would be greatly appreciated.

On Sunday, July 22, 2018 at 3:17:28 PM UTC-4, Anthony Tod wrote:

I have a pipeline that generates hundreds of single instance bokeh graphs and send them via export_png to selenium / headless chrome for export as a png.

Without a background image, I have no problems and the pipeline always completes successfully via export_png

With a background image added to the figure encoded as base64

p_figure.image_url( [rgb_encoded_image],

x=x, y=y,w=w,h=h, angle=0, level=‘image’,global_alpha=0.5)

There is a chance which seems strongly related to speed of execution ( it is a much smaller though still a chance if verbose logging is active ) that on any frame I can get an error.

Its hard to work out where the error is coming from due to the verbosity of the logging, but it is roughly as per the following comment ( I must switch to inside my VM for cut and paste :-()