Java deadlock with light-hearted Eclipse CDT build
My case looks like this: Eclipse CDT Headless build hangs after the build is complete , but I delved into it a bit and found other problems.
Script . I have a C ++ app and Jenkins build server on Linux (Debian Jessie 8.2). I have Eclipse CDT in my dev environment and it builds my C ++ app fine (build locally). I have installed Eclipse CDT on a build server and my Jenkins script runs without a head end to build my application.
Problem : Jenkins hangs even after build finishes. But this is not Jenkins. I removed Jenkins from the equation and did a headlessbuild Eclipse on the build server and the result was the same, it hangs after printing "Build Finished". It's worth noting that I can successfully build my application if I open CDT Eclipse on a build server and run the build using the UI.
Versions . On the build server, I've tried Java 1.7 and 1.8. As for Eclipse, I tried Kepler, Luna, Mars, and Neon (the latter one required Java 1.8). For this post I am using this:
java -version
java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)
Teams . Here is the CDT Eclipse command for headless build I used:
~/eclipse/eclipse -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import ~/myAppProj/ -build myAppProj/Release -data ~/workspace/
Observations :
-
While Java is hanging, I can kill its process and get the executable ready to use. When I run a build from Jenkins and kill this stalled Java process, Jenkins just keeps further scripts running fine.
-
On the build server, when Java janging, I run:
jstack [java pid]
Then I get this:
Attaching to process ID 25262, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.111-b01
Deadlock Detection:
java.lang.RuntimeException: Unable to deduce type of thread from address 0x00007fc5c8032800 (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)
Conclusion : It looks like Java stalled when Eclipse is launched in headless mode. It doesn't happen all the time, but I think 99%. Plus, it doesn't stay hanging forever, it comes back in an hour or two, which is bad for any build server.
So, did anyone have a problem?
source to share
(As confirmed in the comments)
The problem you are facing is most likely a blockage in the CDT indexer. Sometimes, when the lifecycle in Eclipse is short, the CDT index is unfortunately blocked. On the command line, you can disable it using a command line option -no-indexer
(added in Eclipse Mars).
The lock itself is filed as an error, see Bug 327126 - Deadlock trying to cancel PDOMIndexerJob during delta resource notification
Your jstack issue is most likely unrelated and likely to do with a permissions, user, or JVM mismatch between the java process and the jstack process.
source to share