Bug 70526 - Java editor cannot open big files
Summary: Java editor cannot open big files
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords: vm
Depends on:
Blocks:
 
Reported: 2004-07-21 07:33 EDT by Mark Rzepka CLA
Modified: 2007-06-21 11:18 EDT (History)
5 users (show)

See Also:


Attachments
The file that caused the the stack overflow (219.28 KB, text/plain)
2004-07-22 02:14 EDT, Mark Rzepka CLA
no flags Details
The superclass of FrTest.java (2.70 KB, text/plain)
2004-07-22 02:32 EDT, Mark Rzepka CLA
no flags Details
A needed class for FrTest.java (6.19 KB, text/plain)
2004-07-22 02:33 EDT, Mark Rzepka CLA
no flags Details
The whole log (16.51 KB, application/octet-stream)
2004-07-22 02:57 EDT, Mark Rzepka CLA
no flags Details
The whole log zipped (27.09 KB, application/octet-stream)
2004-07-22 03:38 EDT, Mark Rzepka CLA
no flags Details
Whole log of a fresh install (463 bytes, text/plain)
2004-07-22 03:55 EDT, Mark Rzepka CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rzepka CLA 2004-07-21 07:33:10 EDT
Eclipse cannot initialize the java editor on big files (more then 207 KB and
about 280 KB). When you try second time to open the big file, it caused an
Internal Error: A stack overflow error has occured. And you are recommended to
exit the workbench. Here comes the .log-file:


!ENTRY org.eclipse.ui 4 4 Jul 21, 2004 13:15:17.156
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 Jul 21, 2004 13:15:17.156
!MESSAGE Failed to execute runnable (java.lang.StackOverflowError)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.StackOverflowError)
	at org.eclipse.swt.SWT.error(SWT.java:2691)
	at org.eclipse.swt.SWT.error(SWT.java:2616)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:109)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2749)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2434)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
	at org.eclipse.core.launcher.Main.run(Main.java:644)
	at org.eclipse.core.launcher.Main.main(Main.java:628)

!ENTRY org.eclipse.ui 4 4 Jul 21, 2004 13:15:17.156
!MESSAGE *** SWT nested exception

!ENTRY org.eclipse.ui 4 0 Jul 21, 2004 13:15:17.156
!MESSAGE java.lang.StackOverflowError
!STACK 0
java.lang.StackOverflowError

!ENTRY org.eclipse.ui 4 4 Jul 21, 2004 13:18:10.515
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 Jul 21, 2004 13:18:10.531
!MESSAGE java.lang.StackOverflowError
!STACK 0
java.lang.StackOverflowError
Comment 1 Dani Megert CLA 2004-07-21 13:24:12 EDT
-Which build?
-Did you install additional plug-ins?
-Is this repeatable?
-Are there other errors in .log?
-You say a stack overflow happened the second time - what happened the first
time? -Dialog? Anything in .log?
-What kind of file did you try to open? Can you attach the file?
Comment 2 David Williams CLA 2004-07-21 14:07:20 EDT
I would also ask which VM and if there's any special VM arguments specified 
that might effect stack size? I know I routinely open 300K java files (as part 
of a test suite) and I've never seen this. So, unlikely to be just file size. 
I'm sure there's something there, and would be nice to know what ... could it 
be related to number of warnings (or annotations) in file?
Comment 3 Mark Rzepka CLA 2004-07-22 02:14:43 EDT
Created attachment 13508 [details]
The file that caused the the stack overflow
Comment 4 Mark Rzepka CLA 2004-07-22 02:31:26 EDT
- I try to open the file: Dialog: Cannot open default editor on FrTest.java.
Editor could not be initialized.
- I try second time: Dialog: A stack overflow error has occured. ... Do you want
to exit the workbench?
- Here are the corresponding .log entries:
!SESSION Jul 22, 2004 07:46:25.78 ----------------------------------------------
eclipse.buildId=I200406251208
java.version=1.4.2_04
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE

!ENTRY org.eclipse.core.runtime 4 2 Jul 22, 2004 08:01:46.671
!MESSAGE An internal error occurred during: "Launching".
!STACK 0
java.lang.StackOverflowError

!ENTRY org.eclipse.ui 4 4 Jul 22, 2004 08:08:10.359
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 Jul 22, 2004 08:08:10.359
!MESSAGE java.lang.StackOverflowError
!STACK 0
java.lang.StackOverflowError

- plugins:
exmples, CDT, EMF-SDO-XSD

- the bug is repeatable with the attached FrTest.java file

- I start eclipse with:
C:\eclipse\eclipse.exe -vmargs    -Djava.endorsed.dirs=C:\java\xalan-j_2_6_0\bin\

- There are no warnings in file



Comment 5 Mark Rzepka CLA 2004-07-22 02:32:53 EDT
Created attachment 13509 [details]
The superclass of FrTest.java
Comment 6 Mark Rzepka CLA 2004-07-22 02:33:45 EDT
Created attachment 13510 [details]
A needed class for FrTest.java
Comment 7 Dani Megert CLA 2004-07-22 02:39:54 EDT
The log entries you attached seem to be only parts. Please attach the whole .log
file (zip if too large). Also, the following entry rather looks like you
launched and not opened the editor:

!ENTRY org.eclipse.core.runtime 4 2 Jul 22, 2004 08:01:46.671
!MESSAGE An internal error occurred during: "Launching".
!STACK 0
java.lang.StackOverflowError

How do you open the editor exactly? Is the file part of a Java project?
Comment 8 Mark Rzepka CLA 2004-07-22 02:54:03 EDT
I dubble click on the file in the package explorer.
The file is part of Java project in the default package.
Comment 9 Mark Rzepka CLA 2004-07-22 02:57:33 EDT
Created attachment 13511 [details]
The whole log
Comment 10 Dani Megert CLA 2004-07-22 03:22:18 EDT
Sorry, I don't have rar installed. Can you use simple zip or attach it
uncompressed. Thanks.

Another thing: can you try
1) open the file using Open With > "Java Editor"
2) try with a fresh Eclipse SDK?
Comment 11 Mark Rzepka CLA 2004-07-22 03:38:35 EDT
Created attachment 13512 [details]
The whole log zipped
Comment 12 Mark Rzepka CLA 2004-07-22 03:45:17 EDT
open the file using Open With > "Java Editor"

>>> the same behaviour
Comment 13 Dani Megert CLA 2004-07-22 03:48:44 EDT
Too me the log looks like all the stackoverflows come from Debug when you try to
launch.
>at
org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:80)

I also found errros caused by XMLBuddy but in comment 4 you only wrote:
- plugins: exmples, CDT, EMF-SDO-XSD

How is that possible?

Does it really fail when you simply open that file? Can you clear the .log and
simply open that file? Also, please try with a fresh install.
Comment 14 Mark Rzepka CLA 2004-07-22 03:55:14 EDT
Created attachment 13513 [details]
Whole log of a fresh install
Comment 15 Mark Rzepka CLA 2004-07-22 03:59:55 EDT
I have removed XMLbuddy and the behaviour was the same.

I have tried with fresh build (see new log)
The bahaviour ist the same.
Comment 16 Dani Megert CLA 2004-07-22 04:02:28 EDT
OK. I think I got it. You launch with default VM args i.e. don't give Eclipse
enough memory to hanlde this large file. Try 
eclipse.exe -vmargs -Xmx200M -Djava.endorsed.dirs=C:\java\xalan-j_2_6_0\bin\
Comment 17 Mark Rzepka CLA 2004-07-22 04:15:43 EDT
I start with -Xmx200M
1. Eclipse don't want to start because FrTest.java was editing in last session.
So I must delete the file.
2. Open with -> Java Editor is OK!
3. Open with dubble click on the file -> old error
Comment 18 Dani Megert CLA 2004-07-22 04:20:56 EDT
ok - a bit better now ;-)
Go to the preferences and check what's the default editor for *.java files.
Comment 19 Mark Rzepka CLA 2004-07-22 04:26:08 EDT
There is no default editor associated with *.java files, but on dubble click in
the windows explorer the usual notepad is opened
Comment 20 Mark Rzepka CLA 2004-07-22 04:44:53 EDT
reference to comment #7:
I cannot also launch the application with FrTest.java
Comment 21 Dani Megert CLA 2004-07-22 06:50:00 EDT
In comment 18 I meant which one is associated in Eclipse:
Window > Preferences > Workbench > File Associtations
Comment 22 Mark Rzepka CLA 2004-07-22 07:00:41 EDT
the default editor is Java Editor
Comment 23 Dani Megert CLA 2004-07-22 08:04:34 EDT
Can reproduce the problem with the attached files.
Comment 24 Dani Megert CLA 2004-07-22 08:25:57 EDT
Can be reproduced using SDK 1.4.2_03 (build 1.4.2_03-b02) but not using IBM J2SC
(with or without -XJ9 flag). Works if running in interpreted mode (-Xint).
==> JIT bug in VM.

Here's where the stack overflow happens:

BinaryExpression.resolveType(BlockScope scope) {

		boolean leftIsCast, rightIsCast;
		if ((leftIsCast = left instanceof CastExpression) == true) left.bits |=
IgnoreNeedForCastCheckMASK; // will check later on
		TypeBinding leftType = left.resolveType(scope);
                                            ^^^^^^^^^^^
Comment 25 Dani Megert CLA 2004-07-22 08:42:10 EDT
Correction to last comment: it also does not work when using:
  build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cndev-20040524 (JIT enabled: jitc)
without -Xj9. Works if JIT is disabled or -Xj9 is used.
Comment 26 Philipe Mulet CLA 2005-04-07 07:26:55 EDT
David - can you still reproduce ?
Comment 27 David Audel CLA 2005-04-07 09:33:19 EDT
I can reproduce the bug in I20050405-0800
Comment 28 David Audel CLA 2005-04-07 10:35:55 EDT
The problem come from the resolution of an AST that represent a concatenation of
more than 2800 String.
Comment 29 Olivier Thomann CLA 2005-04-07 11:27:37 EDT
The problem is that the string concatenation has not been optimized in the
compiler's tree in order to produce all the string literals for the DOM/AST. The
resulting issue is that the compiler cannot resolve the tree because of the
StackOverFlowError.
Comment 30 Olivier Thomann CLA 2005-04-07 11:28:52 EDT
The only way I can see to fix it is to optimize the string literals during the
DOM/AST parsing and reparse the whole string literal to get the proper positions.
Comment 31 Olivier Thomann CLA 2005-04-07 11:59:08 EDT
In fact on this specific source, even if I use the optimizeStringLiteral support
from the compiler it won't work.
The problem comes from the fact that the huge string concatenation starts with a
method invocation and then it is not optimized.
So the problem is really in the compiler that cannot compile this file.
javac 1.5 also fails with a StackOverFlowError.
Comment 32 Olivier Thomann CLA 2005-04-08 11:04:11 EDT
Philippe,

This might require the addition of a new node in the compiler.
Jikes can successfully compile it. It is the only java compiler that
successfully compiles this code.
Comment 33 Olivier Thomann CLA 2005-04-08 12:22:14 EDT
If the code is simply using a huge string concatenation, the conversion works fine.
Add regression test in
org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0602.
Comment 34 Philipe Mulet CLA 2005-05-09 12:55:12 EDT
not for 3.1
Comment 35 Dani Megert CLA 2006-06-16 10:35:58 EDT
What about 3.3 ;-)
Comment 36 Philipe Mulet CLA 2007-04-02 07:44:23 EDT
reopening
Comment 37 Philipe Mulet CLA 2007-04-02 07:44:58 EDT
Olivier - is this still an issue ?
Comment 38 Jerome Lanneluc CLA 2007-06-04 05:03:12 EDT
If this is still an issue, please investigate for 3.4. Otherwise please close.
Comment 39 Olivier Thomann CLA 2007-06-21 11:18:01 EDT
Could not reproduce the failure using 3.3RC4.
Closing as WORKSFORME.
Please reopen if you get it again.