Bug 323283 - [performance] Opening env.rhino.1.2.js hangs Eclipse
Summary: [performance] Opening env.rhino.1.2.js hangs Eclipse
Status: NEW
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal with 11 votes (vote)
Target Milestone: Future   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords: performance
: 325281 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-20 14:32 EDT by Simon Kaegi CLA
Modified: 2015-04-12 12:19 EDT (History)
19 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Kaegi CLA 2010-08-20 14:32:51 EDT
I was writing tests to emulate a browser on rhino and opened the following file....
http://www.envjs.com/dist/env.rhino.1.2.js

The result was Eclipse hung and I sadly had to kill the process.
Comment 1 Chris Jaun CLA 2010-09-16 10:28:24 EDT
*** Bug 324299 has been marked as a duplicate of this bug. ***
Comment 2 Nitin Dahyabhai CLA 2010-09-16 11:16:46 EDT
*** Bug 325281 has been marked as a duplicate of this bug. ***
Comment 3 Marc CLA 2010-09-27 09:31:28 EDT
The report date of this issue suggests that this issue is recent. In fact, it has been around for years across several major versions. 

I don't know what a "fairly large JS file" constitutes but I guess all of my js files then must be fairly large. I would suggest changing the name of this issue to "Javascript editor doesn't work" and change it's priority to Criticial/High, whatever Priority gets this major issue the attention it should have had a long time ago.

The basic issue here is that opening a javascript file explodes the memory consumption of Eclipse with hundreds of MBs, potentially crashing Eclipse if it runs out of resources. If it doesn't, it becomes unresponsive for a while.

My guess at the cause is a parser that attempts to validate the javascript file or generate some code insight or something like that.
Comment 4 Rich Deeson CLA 2011-02-03 06:24:25 EST
What is a 'fairly large JS file' would presumably depend on the spec of your machine. On my 1.8 GHz P4 with 1GB RAM, I have trouble opening Tiny MCE javascript files. For instance, there are three JS files in the tiny_mce folder on a default install, Eclipse can open tiny_mce_popup.js fine (it's 5kb), but tiny_mce.js (180kb) causes Eclipse to hang for at least a few minutes, at which point I've had to kill the process.
Comment 5 Neil Greatorex CLA 2011-04-14 11:02:55 EDT
This is a huge issue with JSDT. I have a large JavaScript project that includes several large libraries like ExtJS and GeoExt. 

I tried disabling the JavaScript Builder (that instantly sends CPU usage to 100% and eventually exhausts my increased heap space) but even then I find that selecting text and/or copy/paste can also cause the same problem.

Often the error I get is an internal error with "Requesting JavaScript AST from selection". Clicking details shows an out of memory error with heap space.
Comment 6 Frank Schulten CLA 2014-02-26 04:17:57 EST
I have the same issue still in Helios. That makes Eclipse just UNUSABLE for any serious Javascript project. This bug was reported over 3 years ago and nobody cares? Is anybody at Eclipse still wondering why so many use other IDE now?
Comment 7 Frank Schulten CLA 2014-02-26 04:39:48 EST
(In reply to Frank Schulten from comment #6)
> I have the same issue still in Helios. That makes Eclipse just UNUSABLE for
> any serious Javascript project. This bug was reported over 3 years ago and
> nobody cares? Is anybody at Eclipse still wondering why so many use other
> IDE now?

Sorry not Helios, its in Kepler as well. Downloaded new Kepler SR-1 JAVA EE, no plugins, imported my Project as existing maven project and after 5 minutes latest, eclipse becomes unusable at all.
Comment 8 Victor Rubezhny CLA 2014-04-03 18:19:23 EDT
I've added the patch for the issue in bug #431547 (which pretty looks like a duplicate of this issue): https://bugs.eclipse.org/bugs/attachment.cgi?id=241591

@Simon (especially you, as it looks like you have a real project with that JavaScript), @Chris and @Nitin, could you please review and verify if that patch works properly and makes the editor not to hang or throw any SOE?
Comment 9 Victor Rubezhny CLA 2014-04-03 18:21:12 EDT
PS: Forgot to mention that my patch is made against Luna (master).
Comment 10 Andy Wallace CLA 2014-06-17 14:26:58 EDT
I am seeing this behavior in Kepler. Selecting text in an editor window on a javascript file freezes Eclipse for between 10 seconds an a minute. I'm on a Mac, I get a beach ball, and the Activity Monitor shows that Eclipse is unresponsive. It doesn't happen every time, but it does happen more often than not. Details:

   Eclipse Standard/SDK
   Version: Kepler Service Release 2
   Build id: 20140224-0627

The current file I am working on has <1000 lines in it.

I have the Progress window open, it shows nothing. workspace/.metatdata/.log shows no activity. This makes Eclipse pretty much useless to me for editing my javascript files, so I have to edit them outside my regular workflow. This is driving me completely nuts. I have found this behavior in Juno, Kepler, and whatever came before Juno. Why has this not been addressed?
Comment 11 Kaloyan Raev CLA 2014-06-17 15:09:15 EDT
Andy, as mentioned in comment 8, it is very likely that this bug is fixed for Luna (to be officially released on June 25) with the fix in bug 431547. 

My advice is to try the latest Luna Release Candidate available for download here: https://www.eclipse.org/downloads/index-developer.php
Comment 12 Andy Wallace CLA 2014-06-17 15:14:24 EDT
Kaloyan - thanks for the response. Sorry I missed that comment... when I get a breather from our production schedule, I may try the Luna download.
Comment 13 Andy Wallace CLA 2014-07-08 16:59:19 EDT
Sadly, it is still a problem. I downloaded Eclipse Luna:

Eclipse for PHP Developers

Version: Luna Release (4.4.0)
Build id: 20140612-0600

And the behavior is just the same - if I select a line in the editor when working on a javascript file, I get beach ball city. Sigh. It might be slightly improved, the Activity Monitor doesn't show Eclipse as unresponsive, but otherwise...
Comment 14 Rob C CLA 2014-07-13 14:19:03 EDT
Yeah I am having this same issue on the newest version of PDT. https://bugs.eclipse.org/bugs/show_bug.cgi?id=439486

Windows 8.1 - Oracle jre1.8.0_05 - PDT 3.3.0.201407111911 - Eclipse 4.4.0 (20140612-0600)
Comment 15 Dawid Pakula CLA 2014-07-14 07:24:42 EDT
What happened:

1. env.rhino.1.2.js have a lot methods/types.
2. Override indicator, ask each for TypeHierarchy:
  * IndexBasedTypeHierarchyBuilder, internally got env.rhino.1.2.js, but CLOSED!
  * Open it, reparse, generate inferred types (2x AST Traversing), collect them...     
  * Finish build type hierarchy for one type

Summary:
JSDT TypeHierarchyBuilder recompile rhino n times (n = number of types)