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

<urlopen error timed out> #121

Closed
treygriffith opened this issue May 7, 2013 · 13 comments
Closed

<urlopen error timed out> #121

treygriffith opened this issue May 7, 2013 · 13 comments

Comments

@treygriffith
Copy link

Every so often my Sublime Text 2 gets unbearably slow and every time I try to type it gives me the title python error: "< urlopen error timed out >".

I'm guessing that this means the node.js server that tern was running on is dead or otherwise unavailable.

@marijnh
Copy link
Member

marijnh commented May 8, 2013

If the server dies, it should close its port, and requests should simply fail right away. If it somehow hangs, that might give the behavior you're seeing.

Are there any huge files or huge dependencies involved when this happens? Or does it not happen consistently?

@treygriffith
Copy link
Author

I can't seem to reproduce it at this moment, but I think that it happened after I had been working for a while. Multiple attempts to restart ST2 failed (it was so bad that ST was locking up) so I had to temporarily remove tern_for_sublime from the Packages directory. I added it back this morning and it seems to be fine so far.

I did notice yesterday while I was having issues that in Activity Monitor there were multiple Node processes eating huge amounts of memory and CPU. 2-3 Node processes each consuming over 500mb of memory and keeping the CPU at near 100%.

@marijnh
Copy link
Member

marijnh commented May 8, 2013

2-3 Node processes each consuming over 500mb of memory and keeping the CPU at near 100%.

That's bad! Unfortunately, I don't know of a way to get a stack trace from a running node process. If you can provide any way for me to reproduce the hang, I'll look into it.

@treygriffith
Copy link
Author

I'll try to reproduce today and narrow down the cause.

@jpatiaga
Copy link

jpatiaga commented May 8, 2013

The same thing happened to me today! Although it was the Sublime Text 2 process that was holding about 66% of the CPU. Each time I closed the "urlopen error timed out" message, the program became even slower and harder to close. Restarting the application didn't fix the problem.
I never saw that problem until today. I am working in a full javascript project, no js file is over 300 lines. It started to happen when I tried to type "alert(" in one line of code, and then boom!
I don't know if any of that information will help you. I hope this issue gets solved!

@treygriffith
Copy link
Author

Alright I found a file that will reliably cause this problem. jQuery v 1.7.1 (minified) consistently causes the entire editor to lock up, and springs up 2-4 Node processes taking 400MB - 1.2GB of memory, and 100% CPU.

@marijnh
Copy link
Member

marijnh commented May 12, 2013

Huge lines would cause the plugin to send overlong documents to the server, which could cause the slowness you describe. Though only when working somewhere in the middle or end of those lines, which I doubt you were doing with a minified jQuery. For me, the editor doesn't lock up when opening jquery.min.js or even when editing near the start of its lines.

The fact that multiple node processes would end up active is quite bad. I've pushed a patch that makes the plugin terminate server processes when it gives up on them.

@marijnh
Copy link
Member

marijnh commented May 12, 2013

Err, the commits aren't showing up because this was opened in the wrong repository. See ternjs/tern_for_sublime@3500e84 and ternjs/tern_for_sublime@2df9a6f

@treygriffith
Copy link
Author

Well it looks like we're making progress. Now when I open up jQuery and start typing on a new line at the bottom of the file, I only get a single Node process stuck. It consumes 100% of CPU, and from 250MB - 1GB of memory, so still not great, but I can actually close the file now, which clears up the issue instantly.

I opened up the uncompressed version of the same file (http://code.jquery.com/jquery-1.7.1.js) to see if it was the minified version alone, and lo and behold, the same issue. It wasn't nearly as bad (much lower memory consumption, much less "hangy" behavior) but it still would occasionally lock up and eat 100% CPU. It seemed to happen more at the end of the file than at the beginning, but that's by no means scientific.

@mrcarlberg
Copy link

Hi!

I have the same behavior with this file: https://github.com/mrcarlberg/acorn/blob/master/acorn.js. It is an extension of the acorn parser to include the Objective-J language and a preprocessor. It has twice the number of lines as the original acorn.js file.

The node process goes up to 100% CPU and eats up to 1,5 GB of memory for a couple of minutes. I get the error in Sublime before the node process stops.

@marijnh
Copy link
Member

marijnh commented Jul 1, 2013

@mrcarlberg Commits be94599 and 50498ca should help a lot with the problem in your version of acorn.js -- the problem there was that your passing around of finishToken was causing a lot of functions to be classified as higher-order functions, which made the run-time of the type inference rather exponential. I've tightened up the classification a bit, and the file now analyzes quite smoothly.

@treygriffith I can't reproduce problems with jquery. The performance difference between minified code and regular code should be gone now. But if you have a precise set of steps to reproduce a hang, let me know.

@mrcarlberg
Copy link

Awesome! Much better, thanks a lot!

@treygriffith
Copy link
Author

@marijnh I downloaded and installed the latest version and I can't reproduce. It is a bit slow in large files (I tested with jQuery uncompressed v1.10.0) but nothing like what it was before.

I'll reopen if I encounter the CPU-hogging process again.

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

4 participants