Bug 540921 - Recurring StackOverflowError when building project, editing, or idling
Summary: Recurring StackOverflowError when building project, editing, or idling
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.9   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-08 09:27 EST by Lucas von Karger CLA
Modified: 2023-04-04 07:30 EDT (History)
3 users (show)

See Also:


Attachments
Log file containing the error (124.82 KB, application/octet-stream)
2018-11-08 09:27 EST, Lucas von Karger CLA
no flags Details
experimental jdt.core (6.33 MB, application/x-java-archive)
2018-11-08 12:08 EST, Stephan Herrmann CLA
no flags Details
Screenshot (82.15 KB, image/png)
2018-11-08 18:49 EST, Lucas von Karger CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas von Karger CLA 2018-11-08 09:27:13 EST
Created attachment 276510 [details]
Log file containing the error

Hello,

we are getting recurring and persistent StackOverflowErrors in our eclipse IDE. These errors occur in a variety of situations, most reliably when attempting to build the entire project, or when opening the "Open Type" dialog window (shortcut SHIFT+CTRL+T). They also occur intermittently while editing code, or simply while the IDE is (apparently) idling.
We have observed this error while editing the project on three different PCs.

Since this has effectively paralysed our development, any help on the matter would be greatly appreciated.
Comment 1 Andrey Loskutov CLA 2018-11-08 09:29:08 EST
Relevant error part:

!ENTRY org.eclipse.jdt.core 4 4 2018-11-08 15:17:10.922
!MESSAGE Background Indexer Crash Recovery
!STACK 0
java.lang.StackOverflowError
	at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.updateTagBits(ParameterizedTypeBinding.java:1734)
	at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.updateTagBits(ParameterizedTypeBinding.java:1734)
Comment 2 Andrey Loskutov CLA 2018-11-08 09:35:06 EST
Stephan, can it be that ParameterizedTypeBinding finds itself in the "arguments" array?

@Lucas: I guess this must be something with generic types. Which JLS version is set for Java compiler? Could you try to provide some standalone project which shows this error? Can you try latest 4.10 SDK build?
Comment 3 Lucas von Karger CLA 2018-11-08 10:06:42 EST
@Andrey

I have tried the latest 4.10 build, the error still occurs. The compiler is set to JLS version 10, and we use currently the 10.0.2 version of the jdk.

I unfortunately cannot recreate the error in a sample project thus far. I believe that it is connected to null analysis, as disable null analysis entirely seems to get rid of the error, or at least suppress it.
Comment 4 Stephan Herrmann CLA 2018-11-08 10:07:45 EST
(In reply to Andrey Loskutov from comment #2)
> Stephan, can it be that ParameterizedTypeBinding finds itself in the
> "arguments" array?

Such is known to be possible for TypeVariableBinding & WildcardBinding. So perhaps also a PTB can occur somewhere on the path of such cyclic structures.

See bug 435962 for prior art on avoiding such structures to explode.

If we have a test case, we will probably find s.t. like the following pattern to be helpful also in updateTagBits():

   try {
       if (!enterRecursiveFunction())
           return super.updateTagBits();
      ...
   } finally {
       exitRecursiveFunction();
   }
Comment 5 Stephan Herrmann CLA 2018-11-08 10:12:52 EST
(In reply to Stephan Herrmann from comment #4)
> (In reply to Andrey Loskutov from comment #2)
> > Stephan, can it be that ParameterizedTypeBinding finds itself in the
> > "arguments" array?
> 
> Such is known to be possible for TypeVariableBinding & WildcardBinding. So
> perhaps also a PTB can occur somewhere on the path of such cyclic structures.

This theory doesn't exactly match the stack trace, since there PTB *directly* calls itself. To the best of my understanding that would require an infinite type like
  P<P<P<...>>>
or
  P<P<P<...X>,Y>,Z>
or ...
Comment 6 Stephan Herrmann CLA 2018-11-08 12:08:44 EST
Created attachment 276517 [details]
experimental jdt.core

@Lucas, could you please:
- grab the attached jdt.core.jar
- replace it inside plugins of your 4.10 I-build installation
  - you may want to backup the existing jar, first.
  - while replacing, rename it to the exact versioned name in your installation
- start eclipse from a console

Instead of the stack overflow you should be seeing lines on the console starting with

  Recursion in updateTagBits() for 

This should lead us to the troublesome type triggering the bug.
Comment 7 Lucas von Karger CLA 2018-11-08 18:49:08 EST
Created attachment 276520 [details]
Screenshot
Comment 8 Lucas von Karger CLA 2018-11-08 18:52:32 EST
Hello Stephan,

I tried following you instructions, but it did not work as hoped. I am still getting the overflow error, and no console output.

I did put the jar file you attached in the eclipse/plugins folder, but unlike you suggested, there wasn't an existing version for me to replace.

I attached a screenshot, maybe you can see what I did wrong and give me some new instructions.
Comment 9 Stephan Herrmann CLA 2018-11-09 09:37:01 EST
(In reply to Lucas von Karger from comment #8)
> Hello Stephan,
> 
> I tried following you instructions, but it did not work as hoped. I am still
> getting the overflow error, and no console output.
> 
> I did put the jar file you attached in the eclipse/plugins folder, but
> unlike you suggested, there wasn't an existing version for me to replace.

If you didn't replace, then the new jar could not take effect :)

How did you install Eclipse: unzip or using the eclipse-installer?

The installer uses a central bundle-pool to store bundles for all installations. If that's what you have, you'd need to find the bundle pool and replace their (after backup).
Comment 10 Lucas von Karger CLA 2018-11-10 09:12:28 EST
@Stephan

I have managed to replace the .jar file in my 4.10 I-build and launched it through the console, but I cannot see any output like you described. The only change I have observed so far is that the error message is slightly different:
 
!ENTRY org.eclipse.jdt.core 4 4 2018-11-10 15:08:04.507
!MESSAGE Background Indexer Crash Recovery
!STACK 0
java.lang.StackOverflowError
	at org.eclipse.jdt.internal.compiler.lookup.TypeBinding.annotatedDebugName(TypeBinding.java:152)
	at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.annotatedDebugName(ParameterizedTypeBinding.java:433)
	at org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding.annotatedDebugName(RawTypeBinding.java:144)
	at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.annotatedDebugName(ParameterizedTypeBinding.java:438)
Comment 11 Eclipse Genie CLA 2020-10-31 08:17:35 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 12 Eclipse Genie CLA 2023-04-04 07:30:29 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.