Bug 428180 - [building] Building "hangs" in endless loop
Summary: [building] Building "hangs" in endless loop
Status: CLOSED DUPLICATE of bug 417735
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 4.3.1   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2014-02-14 06:04 EST by Lukas Eder CLA
Modified: 2014-12-19 05:27 EST (History)
5 users (show)

See Also:


Attachments
Symptom: Build task is sleeping (1) (17.65 KB, image/png)
2014-02-14 06:04 EST, Lukas Eder CLA
no flags Details
Symptom: Build task is sleeping (2) (18.55 KB, image/png)
2014-02-14 06:05 EST, Lukas Eder CLA
no flags Details
Thread dump (1) (83.27 KB, text/plain)
2014-02-14 06:05 EST, Lukas Eder CLA
no flags Details
Thread dump (2) (79.03 KB, text/plain)
2014-02-14 06:05 EST, Lukas Eder CLA
no flags Details
Thread dump (3) (79.03 KB, text/plain)
2014-02-14 06:05 EST, Lukas Eder CLA
no flags Details
Thread dump (4) (75.41 KB, text/plain)
2014-02-14 06:05 EST, Lukas Eder CLA
no flags Details
Thread dump (5) (75.41 KB, text/plain)
2014-02-14 06:06 EST, Lukas Eder CLA
no flags Details
Profiler (1) - M2E building (182.56 KB, image/png)
2014-02-14 06:06 EST, Lukas Eder CLA
no flags Details
Profiler (2) - DeltaProcessor listening and firing all the time (178.60 KB, image/png)
2014-02-14 06:07 EST, Lukas Eder CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2014-02-14 06:04:08 EST
I constantly run into this issue and none of the remedies that I've found on Stack Overflow seemed to help. Whenever I activate "Build Automatically", building starts to hang with two alternating states that are illustrated in the attached "sleeping-1.png" and "sleeping-2.png" screenshots.

I have also attached 5 randomly collected thread dumps ("jstack-N.txt"), if this helps. In jstack-1.txt, I might have had a lucky punch that showed some activity in M2E's invoking the JAXB plugin, which generates new files:

"Worker-104" #15544 prio=5 os_prio=0 tid=0x0000000051fbb800 nid=0x2c9c runnable [0x00000000549ca000]
   java.lang.Thread.State: RUNNABLE
	at java.util.zip.Inflater.inflateBytes(Native Method)
	at java.util.zip.Inflater.inflate(Unknown Source)
	- locked <0x00000000d7da9850> (a java.util.zip.ZStreamRef)
	at java.util.zip.InflaterInputStream.read(Unknown Source)
	at sun.misc.Resource.getBytes(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	- locked <0x00000000d86cb430> (a java.lang.Object)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.jvnet.annox.parser.XAnnotationParser.parseField(XAnnotationParser.java:182)
	at org.jvnet.annox.parser.XAnnotationParser.parseFields(XAnnotationParser.java:139)
	at org.jvnet.annox.parser.XAnnotationParser.parse(XAnnotationParser.java:86)
	at org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin.annotate(AnnotatePlugin.java:387)
	at org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin.annotateClassOutline(AnnotatePlugin.java:268)
	at org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin.processClassOutline(AnnotatePlugin.java:153)
	at org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin.run(AnnotatePlugin.java:115)
	at com.sun.tools.xjc.model.Model.generateCode(Model.java:294)
	at org.jvnet.mjiip.v_2_2.XJC22Mojo.generateCode(XJC22Mojo.java:65)
	at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:40)
	at org.jvnet.mjiip.v_2_2.XJC22Mojo.doExecute(XJC22Mojo.java:26)
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:309)


Maybe, there is really a loop between XJC / M2E / and the resources listener, which thinks that a new build has to be triggered! I profiled this with Oracle's Java Mission Control, whose results I have also attached ("profiler-N.png")

I'm happy to provide additional information, if needed.
Comment 1 Lukas Eder CLA 2014-02-14 06:04:56 EST
Created attachment 239941 [details]
Symptom: Build task is sleeping (1)
Comment 2 Lukas Eder CLA 2014-02-14 06:05:09 EST
Created attachment 239942 [details]
Symptom: Build task is sleeping (2)
Comment 3 Lukas Eder CLA 2014-02-14 06:05:26 EST
Created attachment 239943 [details]
Thread dump (1)
Comment 4 Lukas Eder CLA 2014-02-14 06:05:37 EST
Created attachment 239944 [details]
Thread dump (2)
Comment 5 Lukas Eder CLA 2014-02-14 06:05:48 EST
Created attachment 239946 [details]
Thread dump (3)
Comment 6 Lukas Eder CLA 2014-02-14 06:05:59 EST
Created attachment 239947 [details]
Thread dump (4)
Comment 7 Lukas Eder CLA 2014-02-14 06:06:10 EST
Created attachment 239948 [details]
Thread dump (5)
Comment 8 Lukas Eder CLA 2014-02-14 06:06:35 EST
Created attachment 239949 [details]
Profiler (1) - M2E building
Comment 9 Lukas Eder CLA 2014-02-14 06:07:17 EST
Created attachment 239950 [details]
Profiler (2) - DeltaProcessor listening and firing all the time
Comment 10 Lukas Eder CLA 2014-02-14 06:15:32 EST
Some version information:

Eclipse
  Version: Kepler Service Release 1
  Build id: 20130919-0819

M2E
  Version 1.4.0.20130601-037

Although... After having seen this issue here (https://bugs.eclipse.org/bugs/show_bug.cgi?id=203058) and after having uninstalled all SVN plugins, everything worked smoothly again :-/

So, I'm not sure if this is really an Eclipse issue
Comment 11 Szymon Ptaszkiewicz CLA 2014-02-14 06:21:14 EST
Stephan, this looks almost the same as your bug 417735 (and also m2e with SVN).
Comment 12 Szymon Ptaszkiewicz CLA 2014-02-14 06:25:55 EST
Lukas, are you able to prepare reproducible test case that you could attach to this bug? This would greatly help us to troubleshoot this problem further.
Comment 13 Lukas Eder CLA 2014-02-14 06:34:28 EST
I might have some time on Monday.
Comment 14 Szymon Ptaszkiewicz CLA 2014-02-14 06:48:26 EST
(In reply to Lukas Eder from comment #13)
> I might have some time on Monday.

Thanks! Can you also attach a screen shot with the bottom part of profiler output (the remaining third part of the output)? I expect we should see there some SVN resource change listener that is probably interacting with m2e.
Comment 15 Lukas Eder CLA 2014-02-14 06:55:33 EST
I will, on Monday :-)
Comment 16 Jay Arthanareeswaran CLA 2014-02-14 08:46:34 EST
Moving to platform for investigation.
Comment 17 Stephan Herrmann CLA 2014-02-15 10:01:15 EST
(In reply to Szymon Ptaszkiewicz from comment #11)
> Stephan, this looks almost the same as your bug 417735 (and also m2e with
> SVN).

Yes, thanks for making the connection.
I'm curious to see if the profiler data will reveal more than my manual debugging.
Comment 18 Lukas Eder CLA 2014-02-17 05:17:06 EST
Guys, I'm sorry, I cannot seem to reproduce this easily...
Comment 19 Szymon Ptaszkiewicz CLA 2014-02-17 10:33:06 EST
(In reply to Lukas Eder from comment #18)
> Guys, I'm sorry, I cannot seem to reproduce this easily...

Thanks for trying. Let us know when you see it again.
Comment 20 Igor Fedorenko CLA 2014-02-17 13:11:32 EST
This is most likely a user problem (of sorts). Although m2e does not do this by default, the user is able to force execution of Maven plugins during Eclipse workspace build. Forcing execution of "incompatible" maven plugins (as defined in [1]) results in endless workspace build. I can have a closer look and tell for sure this this is the case if somebody provides me with a small standalone example that demonstrates the problem.

[1] https://wiki.eclipse.org/M2E_compatible_maven_plugins
Comment 21 Stephan Herrmann CLA 2014-02-24 13:36:04 EST
(In reply to Igor Fedorenko from comment #20)
> This is most likely a user problem (of sorts).

I guess m2e is free to give an error message exactly when the dangerous situation happens, and precisely point to the user's fault. In that case m2e would be free of all suspicion :)


Anyway, I just observed another instance of this issue on a project that normally builds just fine. Profiler showed activity at

- org.eclipse.core.internal.events.AutoBuildJob.run()
  ...
  - org.eclipse.m2e.core.internal.builder.MavenBuilder.build()
    ...
    - org.apache.maven.plugin.resources.ResourceMojo.execute()
  - org.eclipse.jdt.internal.core.builder.JavaBuilder.build()
- org.eclipse.team.svn.ui.decorator.SVNLightweightDecorator.decorate()
  ...
  - org.eclipse.team.core.subscribers.Subscriber.accept()
    ...
    - org.eclipse.team.svn.core.synchronize.AbstractSVNSubscriber.getDiff()

In this state the project in question had a build error in Eclipse because a subdirectory of target/test-classes could not be deleted (I had a shell open in that directory, as a Linux-native I keep forgetting that Windows cannot delete what someone is looking at).

And here's the rub: the very moment I made a "cd ../.." in that shell, the build error disappeared *and* the infinite build loop came to an end.

Does this ring a bill with anybody?
Comment 22 Szymon Ptaszkiewicz CLA 2014-02-28 10:27:12 EST
(In reply to Stephan Herrmann from comment #21)
> Anyway, I just observed another instance of this issue on a project that
> normally builds just fine. Profiler showed activity at

This doesn't tell me much, full stacks would be more helpful.

> In this state the project in question had a build error in Eclipse because a
> subdirectory of target/test-classes could not be deleted (I had a shell open
> in that directory, as a Linux-native I keep forgetting that Windows cannot
> delete what someone is looking at).
> 
> And here's the rub: the very moment I made a "cd ../.." in that shell, the
> build error disappeared *and* the infinite build loop came to an end.
> 
> Does this ring a bill with anybody?

Interesting. It seems that workspace state could be involved, but I don't know how doing "cd ../.." outside Eclipse could break the endless loop. Maybe auto-refresh kicks in? I just fixed bug 368376 related to refresh which impacted m2e build, so if that bug was related, hopefully after M6 things will get better.

Regarding general problems with m2e build, here is a tip from Igor copied from bug 368376 comment 2:

"As a side note, m2e provides "Maven Workspace Build" view that helps troubleshooting endless workspace builds. When enabled, the view shows resource deltas that trigger invocation of MavenBuilder and also about resources changed through m2e APIs. Although not perfect, it often gives enough clues to help understand the problem."
Comment 23 Igor Fedorenko CLA 2014-02-28 10:38:05 EST
(In reply to Szymon Ptaszkiewicz from comment #22)
> 
> Interesting. It seems that workspace state could be involved, but I don't
> know how doing "cd ../.." outside Eclipse could break the endless loop.
> Maybe auto-refresh kicks in? I just fixed bug 368376 related to refresh
> which impacted m2e build, so if that bug was related, hopefully after M6
> things will get better.

Builders tend to do less amazing things when they hit exceptions. For example, I 95% certain JavaBuidler will escalate build from incremental to full mode when it runs into exceptions, which may explain the observed endless build.

> 
> Regarding general problems with m2e build, here is a tip from Igor copied
> from bug 368376 comment 2:
> 
> "As a side note, m2e provides "Maven Workspace Build" view that helps
> troubleshooting endless workspace builds. When enabled, the view shows
> resource deltas that trigger invocation of MavenBuilder and also about
> resources changed through m2e APIs. Although not perfect, it often gives
> enough clues to help understand the problem."

Loosely related to this problem -- if there was a way for me to somehow observe incoming and outgoing resource deltas for each workspace builder invocation, I'd be able to extend that view to work for all projects and builders, not just m2e.
Comment 24 Szymon Ptaszkiewicz CLA 2014-10-03 11:30:30 EDT
Lukas, have you seen this problem recently or maybe you have some more info about it?
Comment 25 Szymon Ptaszkiewicz CLA 2014-12-19 05:27:44 EST

*** This bug has been marked as a duplicate of bug 417735 ***