Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Too many WebGL active contexts

Hi All,

I am using Python 3.7.7 with the following dash & Plotly versions:

dash - 1.14.0
plotly - 4.9.0
dash_html_components - 1.0.3
dash_core_components - 1.10.2

I’m creating a Data Visualization Dashboard for my team with Dash. Everything was working great, until I noticed this issue regarding WebGL in my browser. I have an initial analysis graph that gets created once the input data is supplied. I use ScatterGL since the no. of data points are greater than 100K. After that, certain analysis graphs are dynamically created depending on some Dropdown Inputs. These also require ScatterGL due to the massive no. of data points (for now, at max. I get 8 dynamically generated graphs).

The Graph that gets created at first is fine, until the dynamic no. of graphs get created. After that, I find out that my first graph becomes empty and I see this warning coming in browsers’ console : ‘Too many WebGL contexts. Old contexts will be lost.’

After going through multiple blogs and similar Github issues, I see it has to do with the no. of WebGL contexts created per plot. Is there any existing solution for this in latest versions of Plotly or Dash? If not, can someone help me in resolving this issue?

Thanks in advance.

I guess as a quick fix, you could increase the number of allowed WebGL contexts in the browser.

However, ideally you should avoid too many contexts. As I understand, it is currently not possible to share a context across figures in Plotly (please correct me if I am wrong). Hence the only thing you can do is to reduce the number of WebGL charts shown simultaneously. What type of data are you plotting?

Thanks Emil. I’m plotting a time-series data generate by a cluster-based application. Is the WebGL context created for each trace? Say if I want to categorically plot my data in a single figure? Then the no. of WebGL contexts will be equal to no. of traces?