Skip to content

WARNING: Too many active WebGL contexts. Oldest context will be lost. #1102

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

Closed
davhin opened this issue Aug 9, 2018 · 6 comments
Closed

Comments

@davhin
Copy link

davhin commented Aug 9, 2018

Since a few days and since switching to plotly 3.1.0 / jupyterlab 0.32.1 I have been getting the warning "WARNING: Too many active WebGL contexts. Oldest context will be lost." by Chrome's console if I use the same plotting function more than 16 times in a row. I am plotting a years worth of weekly networks which means 52 plots. This used to work without a problem.
I tried Firefox and Safari as well, but it came out the same.

Does anyone have similar issues?

Thank you.

@jonmmease
Copy link
Contributor

Hi @davhin, Thanks for the report.

Just to clarify, each call to the plotting function generates 52 plots and after 16 calls (52*16=832 total plots) you start getting the warning?

Are your 52 plots all individual figures (not subplots within a single Figure)?

Which trace type(s) are you using (scattergl, scatter3d, etc.)?

How are you displaying the plots in the notebook ('plotly.iplot', 'offline.iplot', 'FigureWidget')?

After the warning is raised in the Chrome console, what happens when you run the function again. Do the plots show up?

What was the version of plotly.py were you using previously when you didn't have the problem?

Thanks!

@davhin
Copy link
Author

davhin commented Aug 10, 2018

I used to be able to use the same Scatter3d plotting function at least 52 times in a for loop, now the max is 16 without fail. Each call generates a single Figure object. This seems to be exclusive to Scatter3d as well, since I found that the other plots still work the same. When I do this:

keys = Data.networks.keys()
keys = list(keys)

for key in keys:
    print(key)
    nw = Data.networks[key]
    plot.force_directed3d(nw, recalc=True) #this uses Scatter3d
    plot.force_directed(nw, recalc=True) #this uses regular Scatter

The plot.force_directed() alsways displays, but of the plot.force_directed3d() I only see the 16 most recent plots.

I am displaying via plotly.offline.iplot(figure) with plotly.offline.init_notebook_mode(connected=True). I also tried FigureWidget and then display() just now with the same effects.

I can however contribute a new/different warning in Chrome "Lost WebGL context. a @ plotly.js:98819", which seems to be connected to plotly/plotly.js#2423

It all used to work fine on plotly 2.7.0, but that install was very messy so it might be that I had some other package installed that helped to circumvent this issue.

I can try to retrace my steps some more over the weekend. PS: Thanks for all the great work, loving plotly 3.0 so far!

@jonmmease
Copy link
Contributor

Thanks for the info. Are you trying to view all 52 as separate figures simultaneously? If so, I'm not sure how this could have ever worked given that Chrome has a max of 16 total webGL contexts available.

The issue in plotly/plotly.js#2423 is that the only one Figure was being displayed at a time, but the contexts aren't always being freed right away.

Could you gin up a simple notebook that reproduces the issue? I expect you could reproduce it with a any simple scatter3d trace without your particular plotting logic.

PS: Thanks for all the great work, loving plotly 3.0 so far!

Glad to hear it, Thanks for letting us know!

@davhin
Copy link
Author

davhin commented Aug 10, 2018

Yes, I am attempting to view them all simultaneously. I originally also thought this might be an issue with the new Chrome build 68 released a few days ago but found that the limitation had always been there, at least for longer than I have been using plotly in that manner.

I will set up a notebook that reproduces this over the weekend, Sunday at the latest. Currently I am at work and this happens in my pet project.

@davhin
Copy link
Author

davhin commented Aug 14, 2018

I am a bit swamped at the moment but I will get this done before the week ends. Sorry for the delay.

@davhin
Copy link
Author

davhin commented Aug 25, 2018

Unfortunately I find myself unable to reproduce the situation that allowed me to plot as many 3DScatter plots as I wanted. I installed a lot of stuff into that environment and only partially tracked them through pipenv.

@davhin davhin closed this as completed Aug 25, 2018
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