-
-
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
MathJax hangs Chrome #548
Comments
Since we haven't heard any similar reports, I'm guessing this isn't a bug directly. Have you tried clearing your browser cache? Perhaps one of the MathJax files is corrupted. |
Checked other versions, 27 and 29 do not exhibit the issue. Source corruption would be unlikely to cause a lock-up instead of an error, if it could happen at all. Since it pegs the CPU at 100%, I was thinking an infinite loop/recursion somewhere in the layout code. Will investigate further. |
Thanks for the update. It could be that one of MathJax (many) components has been corrupted but I'm guessing you've actually tried clearing the cache. Thanks for investigating further. I can't reproduce this on Chrome 28 under Ubuntu btw. |
I am not able to reproduce this with Chrome 28.0.1500.95 on Max OS X 10.7.4. Note, however, that the page you cite has a lot of other stuff to download in the sidebar, and that will compete with MathJax's loading of the components that it needs. Since the site does not use MathJax's combined configuration files, each component has to be downloaded separately (this is the least efficient type of configuration), and I see a fairly long delay before MathJax actually can begin its typesetting as it loads the components that it needs in order to do that. When the sidebar finishes loading, MathJax is able to get its code more quickly. So perhaps you are just not being patient enough? |
@dpvc as mentioned above, CPU usage for the process hikes up to 100%, and MathJax is already loaded since it hangs with the 'Typesetting Math' status display in the bottom left. I'm seeing this even in MathJax's own website. |
MathJax is not all one file. It always has to load at least one other file, and many times it may load a dozen or so. The site that you indicate has a configuration that requires it to load more than that. So the fact that the you have a typesetting message does not mean that MathJax has finished loading what it needs. You might also try disabling the STIX fonts so that MathJax will use its web-based fonts and see if that makes a difference. The fact that we have not had any other reports of this issue suggests that this has something specific to do with your installation. The fact that you don't see the problem in Chrome 27 or 29, and that I don't see it for Chrome 28, suggest that it is not a loop in the layout code (as the same code runs for all those versions), though certainly it doesn't rule that out. Just because the MathJax message area is showing doesn't mean that it is MathJax code that is taking up the CPU (MathJax gives up the processor in order to display the message, so it could be something else running at that time). Have you tried disabling any plugins that you have in Chrome? Perhaps one of those is interacting badly with MathJax. |
@dpvc I don't own that blog. As I just said, even MathJax's own website hangs, so it's definitely not something pertaining to this specific blog's configuration. In fact, as far as I could find, any website using MathJax hangs when using this version. I'll probably only have time to look further into this early next week. |
Yes, I heard you when you said the MathJax site also gave the same problem. I was explaining why having the typesetting messages does not mean MathJax was (completely) loaded, as your message seemed to suggest. The fact that this happens for you an any site with MathJax further suggests that is is a problem somewhere with your installation (meaning your computer/browser/OS, not the site you are looking at). That is, I suspect problem is specific to something in the setup on your computer. That is why I suggested turning of plugins in your browser, for example. And why I suggested turning off the STIX fonts (use FontBook for that). Perhaps you can try those things early next week. |
I just saw the same thing. Both in the IPython notebook, and on blogs which use MathJax. The "Typesetting Math: 100%" appears in the bottom left corner, and then the page freezes. There's nothing strange in the JS console (I need to open it beforehand, because once the page freezes it's not possible. I've been using mathjax/ipython notebook on this computer for over a year with no problem. I didn't install anything new, or change my browser, or anything, but mathjax started freezing today. Very strange... |
Looks like some sort of infinite loop: looking at the chrome task manager, the memory footprint of any window with mathjax counts up at ~0.5MB/sec, with the CPU consistently at 100%. I'm on Chrome 33.0.1750.152 (Edit: BTW, the easiest way to see this is to just go to mathjax.org) |
Cleared the cache, and the problem went away. Very strange... |
Thanks for reporting this in detail. When cleaning the cache resolves things, it's usually a sign that one of MathJax's files was corrupted or that the cache contained a mix of different MathJax versions. It's rare, but it happens. Glad to see you could resolve it. |
same thing has been happening to me on Chrome 36.0.1985.143 (latest as of now), and clearing the cache didn't help in any way (neither did running in an incognito window with all extensions disabled). |
@soumith could you provide more information such as specific pages (unless it's global) and your OS. FWIW, I don't have any issues with that Chrome version on ubuntu 14.04. |
I have no problem with Chrome 36.0.1985.143 on Mac OS X 10.7.5 on the MathJax home page. |
I have this issue on Chrome 38.0.2125.66 beta running on Yosemite 10.10 DP8. |
@adriweb sorry to hear that. That's two betas combined so I'm wondering if it was just a fluke (I find Chrome 38 on linux to be a particularly unstable beta). Can you let us know if it happens again? First thing to check would be the developer console to see if there are any errors or warnings. Thanks! |
Will do, but when I checked, there was nothing in the console... |
@adriweb hm. well, if you encounter it again, try |
Well, I'd like to, but considering the whole tab gets frozen, the console can't get access to the page, so it's impossible to get anything... |
Ah, ok -- that bad... If it's not site specific, then load http://cdn.mathjax.org/mathjax/latest/test/sample-signals.html and see how far you get. If it is site specific, then you could grab the scripts from that example (it's in this repo under |
Well, here's bad news : it's totally random :( |
exactly same problem at Chrome 38.02125.104m on Windows 7 64bit. I experienced a tab loading MathJax occupied over 200MB. |
Note : the problem disappeared (on its own ?) for me some time ago, and since then I have not had any issue... |
@h2kfl do you have a link to a page that exhibits this? We've seen pretty random memory issues with Chrome in the past which came down to specific content+configurations and never enough data to file a bug report. |
@pkra you can check this site: |
@h2kfl is that the new 64bit Chrome? (FWIW I'm not seeing any problems on Linux either.) I'll try to reproduce this tomorrow. |
@dpvc ok. I've updated title and labels; reopening. |
Here are a couple of other things to try:
|
No difference for me in any of the two cases. |
I have notice this: sometimes, when the browser freezes, the MathJax output message is: |
I'm currently experiencing the same symptoms with 39.0.2171.95 (64-bit) on OSX 10.9.5. Manuel's SVG example works fine, but the HTML-CSS version hangs. http://mathjax.org/ loads correctly, but http://cdn.mathjax.org/mathjax/latest/test/sample-signals.html hangs. I haven't tried restarting or clearing cache yet. If there is any information or logs that I can help provide, I'd be glad to try help. I'm Linux low-level literate, but not familiar with the tools available on OSX. I can install software as necessary. I'll hold off on trying to fix the problem for a day or two in case there's something useful I can do. |
I suppose someone has already done this, but just to confirm I have tested this with MathJax 2.5 beta and it also freezes. |
@nkurz could you update Chrome to 40.0.2214.91 m (latest). It works for me. I've exprienced hang up with Chrome for Windows 7 64bit. But it seems fine now. |
I'm currently running 39.0.2171.99 (64-bit) on OSX, and all appears |
In Chrome reseting the cache is not enough to clear MathJax (I'm not sure why). You do have to restart the browser as well. |
In Android 5.0.2; Nexus 7 Build/LRX22G, Chrome 40.0.2214.89 still hungs. |
I'm running android 5.0.2 and chrome 40.0.2214.89 as well on a nexus 10. The nexus 10 has been hanging on mathjax for what is probably over a year; I just haven't seen much discussion about it online before now, so I didn't pursue it. The maddening thing for me is that sometimes I have opened pages (usually on mathoverflow.net) that freeze 4 times in a row in different places, and then on the fifth time make it through and render, but then the tab freezes completely and you can't click links or even move the page up and down. It'd be great if this ever gets fixed. |
=> marked as abandoned. Not looking forward to this Frankenbug resurfacing. |
I was able to create a test case that reproduces the issue 100% of the time with the current master branch (commit 2965eab). The test case can be found here: www.wikipediacorpus.com/Chapter1.html - Opening that URL will cause MathJax to hang in an infinite loop. The issue seems to occur when the browser fails to load a supporting resource file for some reason. In the example URL, i forced MathJax/jax/output/HTML-CSS/autoload/mtable.js to 404 by renaming it to mtable2.js on the server. I'm purposefully causing the break here, but there's tons of reasons why a browser might fail to load a resource, which explains why it's been so hard to reproduce. When that file fails to load, the processOutput function circles in an infinite loop, continually trying to restart. I've added a console.log() to that method, which prints out the state.i value, and you can see in the JavaScript console that the value never increments above 7. The line that is throwing the restart error is line 2334:
As a workaround, the following seems to fix the issue:
Otherwise, that line throws a restart Error, having never incremented state.i, and the whole process repeats itself. I ran into this issue while working on MacDown, a native markdown client for Mac, which uses MathJax in its preview window (issue 807). On every edit, the preview window is reloaded, which occasionally causes scripts to fail to load, which sometimes causes this infinite recursion, hanging the app. |
@adamwulf I suspect that may be a different issue than what's discussed above (not that I'm even 100% sure that the issues discussed above are really just one issue). Still, it does look like this may be a genuine MathJax bug, in any case. My Chromium 64.0.3282.167 doesn't hang on your test page, but it does peg one CPU core at 100% for a few seconds before giving up with the following error on the console:
(That's the partial stack trace shown in Chromium's console by default. Clicking the triangle to expand the full stack trace just shows the same five function loop repeated over and over and over.) |
I went ahead and opened a separate issue #1936 in case the cause is different than this older issue. |
You are right, it is a different issue. Thanks for opening the other one. |
this issue have a temporal fix: Using this command: |
Isn't it crazy that the bug still hasn't been found 6 years later? 🤕 On the bright side I haven't seen this issue in the past half decade. Looking at the code mentioned in #548 (comment): Lines 2293 to 2315 in 419b0a6
state.j is not incremented at all in the catch block when err.restart == true , leading to infinite retries of the failed op. According to @dpvc's explanation:
And then the use of timers somewhere in the callback system would prevent Chrome from triggering either a stack overflow, or the "script taking too long" message. This could be mitigated by keeping a counter and giving up after X retries. |
While that was a suggestion at one point for what the problem was, it turns out not to be the case, as further investigation showed that MathJax completed its operations before the hang occurred. (See this comment.) This shows that it is not an infinite look inside MathJax (the routine you quote above is not looping), and the issue was taken to be in Chrome itself somewhere. Since it has not been reported again since 2015 (the 2018 case was a different issue, with was dealt with in a separate issue tracker), I suspect that updates in Chrome have resolved the problem, whatever it was. As I mention above, MathJax doesn't produce a reset twice for the same condition (that would be an error), so while the code you quote could loop, in practice that doesn't occur, and didn't occur for the problem being investigated in this issue tracker. |
I would like to raise the same issue I encounter right now:
Can anyone provide an update to this? Thank you very much. I'm still using MathJax@2.7.9. |
@redooo666, can you provide a link to a page where this is occurring for you? Does it always occur, or is it intermittent? What browser and os are you using, and what versions? After the error occurs, if you enter |
if anyone needs an example of mathjax locking up the browser: https://docs.opencv.org/4.x/d2/de8/group__core__array.html |
That page renders fine for me (Chrome 105.0.5195.102), even throttling down CPU 6x, switching MathJax renderers etc. (FWIW, that page uses 2.7.0 which is 6 years old now.) |
It also works fine for me in every situation I tested. |
Hi,
It's about the third time this week I've got my browser completely frozen from opening a blog post. I noticed they all hang with the little "Typesetting Math: x%" at the bottom left, and found this library.
I'm running Chrome 28.0.1500.71 on OSX Mountain Lion. Here is one such post: http://www.leancrew.com/all-this/2013/08/hyperloop/
The text was updated successfully, but these errors were encountered: