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

Memory issue with autoplay + loop #22

Closed
dportalesr opened this issue Feb 17, 2016 · 6 comments
Closed

Memory issue with autoplay + loop #22

dportalesr opened this issue Feb 17, 2016 · 6 comments

Comments

@dportalesr
Copy link

Some of our users were reporting that our site was crashing in their Chrome browsers after some minutes on the homepage. I noticed memory consumption in that page went above 1GB before the tab crashed.

We found the cause to be the asciinema-player. It was configured with autoplay and loop options enabled. Disabling the loop option seems to be a workaround, but maybe you'll want to look for any memory leak issue in your code.

Chrome 48.0.2564.109 (64-bit)
OSX 10.11.3

@ku1ik
Copy link
Contributor

ku1ik commented Feb 20, 2016

Thanks for reporting. I'll investigate.

@ku1ik ku1ik closed this as completed in ab5aad1 Feb 28, 2016
@ku1ik
Copy link
Contributor

ku1ik commented Feb 28, 2016

@daetherius You can re-enable loop and it should be fine now.

@jrheard
Copy link

jrheard commented Feb 29, 2016

@sickill - sorry to bug you, just curious - how'd you go about diagnosing+debugging this issue? i'm a rookie cljs dev and wouldn't know where to start if one of my apps had an issue like this. is there a particular portion of the chrome developer tools that was useful for you here, or some sort of blog post where you learned about how to debug js memory issues, etc? thanks a ton!

@dportalesr
Copy link
Author

@sickill Thank you very much!

@ku1ik
Copy link
Contributor

ku1ik commented Mar 1, 2016

@jrheard sure! So, I opened Chrome's "task manager", loaded asciicast page with loop on and observed the growing memory for this tab. Then I stopped playback and noticed that memory is no longer growing but the CPU usage is ~60% for this tab. So I went to dev tools, and created CPU usage profile (just went to Profiles and hit "Start" there). It showed me a list of functions that were observed to be running by profiler. I chose the one with the highest % next to it. It was from core.async so I kept expanding the call tree and at about 4th or 5th level, after getting through all core.async/clojure.core calls I got to a function from my namespace. The line number pointed me to a line where I start (go ...) block. Then I just analyzed this function and few others that call it and realized that I used core.async' sliding-buffer (I had a reason for that), which is non-blocking buffer, meaning that it's not enough to stop reading from this channel to stop (block) the producer (which in my case was still running even after the playback was stopped).

@jrheard
Copy link

jrheard commented Mar 3, 2016

Thanks a ton, that's super helpful information to have for when an issue like this inevitably bites me in my own projects :)

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

3 participants