-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Random browser hang/crash using Area chart (on Chrome) #191
Comments
Also - i was previously using v 0.3.3 but I just upgraded to 0.4.1 to see if the issue would go away. |
Hmmmmm.. very interesting. Can you reproduce the problem in a jsbin (or similar)? |
I thought you'd ask that! I just tried to and WAS able to get chrome to hang. I haven't used jsbin before- but it seems that if you edit anything it re-renders the iframe. |
Try this link - you need to be in edit mode; Watch the console while it renders the iframe. It should print "finished" after drawing the chart. |
Whoah! That's the first time I've seen Chrome get stuck like that. I'd guess that's something upsetting the Chrome renderer itself -- usually if a bit of javascript gets stuck in an infinite loop then the tab can usually detect that and kill itself. I'll see if I can ask the Chrome dev team at work tomorrow if they have any ideas.. |
Hm - like I said in earlier comment - sometimes during the "freeze" the console was actually spewing errors from within the Raphael js code - stuck in an infinite loop of some kind... I think the line in the morris code was this:
I think thats where the H1810 came from in the "Error parsing" exception / stacktrace. If this were a Chrome rendering issue, I don't think I would have gotten the "looping" symptom. |
Doing some debugging: Got it to hang after "debug 11" - seems to be triggered by reducing the width of the chart div (eg: 33px).
|
Found the stuck loop! |
Looks like labelSeries is returning 1.5 million labels instead of 17. Must be triggered by a width too small. |
So in labelSeries:
Looks like it is getting a negative value for pxwidth - probably due to the narrow width (33px) and my declared padding of 10px. This results in the endless loop in labelSeries. |
Also here is the latest jsbin showing the 1.5 million labels returned: This one actually wont hang the browser because I added a safety break out in the next loop. |
The hang in my app is occurring in labelSeries but NOT due to negative pxwidth! |
Nice one! Top debugging effort there! On 7 March 2013 10:27, kidplug notifications@github.com wrote:
|
Thanks - so here is output from my app in the labelSeries loop, building the ret array.
|
OK guess what...
|
Should probably change to getTime() / setTime() using actual milliseconds for interval. |
So to summarize -
(Both issues occur in labelSeries fn) |
Excellent work. Best bug report ever :) On 7 March 2013 10:50, kidplug notifications@github.com wrote:
|
Thanks! and thanks for all your excellent work on this project! |
So here is my temporary fix / diff
|
I've committed fixes for both of these to master now. Thanks again for the bug report! |
kidplug's
It happens because when interval == 60:
An alternative fix is: |
The fix is already in master (note how var d1 = new Date(2013, 2, 30, 12);
var d2 = new Date(2013, 2, 31, 12);
var labels = Morris.labelSeries(d1, d2, 1000, "hours");
console.log($.map(labels, function (x) { return x[0] }));
=> ["12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "00:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00"] |
Apologies, I don't know what went wrong there but I obviously didn't use the latest code. (minor point, just in case any one's confused later by this, |
I am experiencing random (intermittent) freezes and crashing when rendering an area chart in my app.
Sometimes it is on the initial creation - other times I "empty" the div then create a new area chart.
One time I did get evidence of an infinite loop in raphael -
Error parsing d H1810 << my best memory of the repeating error.
Unfortunately I'm not getting the error msg anymore in console - chrome is just hanging.
Here is my code to create the area chart:
My div is styled like this:
and is also position: absolute and height: 100% inside another div:
That parent div has padding.
Any ideas?
Most of the time (8/10 times) the chart renders properly.
The text was updated successfully, but these errors were encountered: