Announcement Announcement Module
No announcement yet.
Thread leak? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Thread leak?

    recently my STS installation seems to be going crazy. I'm going to explain.
    First of all, I'm actually using Eclipse for JEE bundle (Kepler SR2) with STS 3.5.1. I have a workspace with 9 such projects:
    • three Gradle projects
    • two other non-Gradle Dynamic Web Projects
    • four general non-Java projects

    I have build automatically enabled and "Enable automatic refresh" for Gradle files set with a delay of 1000 ms. What I see is that Eclipse gets extremely slow after some time and starts eating one core of my 8-core CPU. If I make a thread dump, there's actually no real activity, but I see 80-90 live threads that are trying to synchronize with each other. Most of them are something like this:

    "Worker-1676" prio=6 tid=0x000000001e54c000 nid=0x5d0 in Object.wait() [0x000000002200f000]
    java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - locked <0x00000000d0684ee0> (a
    at (
    at ava:50)
    Locked ownable synchronizers:
    - None
    If I look the live thread graph with jVisualVM I see all those worker threads intermittently switch between running (for brief periods), wait (for long periods) and monitor (for brief periods) states.
    I can't understand what these many worker threads are for and why they were created. I suspect that this proliferation of threads may be due to the "automatic refresh" for Gradle projects, because I have never been seeing such a behaviour previously, even though I worked with much bigger projects, but it's the first time I try to work with the automatic refresh enabled. However I can't bet on this. I'm going to try to disable the automatic refresh, but any suggestion to try to understand what's going on will be highly appreciated.

    By the way, is there a way to limit the maximum number of worker threads that Eclipse can create?

    Update: it's not the "automatic refresh" for Gradle projects fault. I have now disabled it and still have this problem. After some minutes of Eclipse usage I got to 144 live threads! I have huge fluctuations from around 50 to 100 and more. The total amount of threads is around 200, more or less... I don't think this is normal...
    Last edited by mauromol; May 12th, 2014, 05:15 AM.

  • #2
    Further information: a new Worker thread is spawned approximately every 5 seconds, at least for most of the time. I even debugged the Eclipse instance that shows this behaviour, but the only thing I could observe is that these worker threads are created by the JobManager or by the WorkerPool. I really can't understand what's going on...
    Last edited by mauromol; May 12th, 2014, 10:47 AM.


    • #3
      I was able to stop this hell by removing the Spring nature from all the three projects in the workspace that had it enabled. Of course, this is not an acceptable workaround, however at least now I can use the IDE again.
      I don't think there's a thread leak, as I suspected in the beginning, because threads seems to be handled well by the Eclipse platform, the problem is that many of them gets created and threre's something that constantly keeps 1 thread of my CPU (about 12,50% CPU occupation on a 8-thread CPU, it's an Intel Core i7-3770) busy. If I do some thread dumps, I don't see anything obvious (all threads seem to be low on activity), so my suspect is about a too heavy thread synchronization issue due to the excessive number of threads. However, I am not able to go further in this analysis without help.


      • #4

        Thanks for the very detailed report and your first investigations, this is great. Would you be able to share your workspace or some of the projects so that we could try to reproduce this? That would be great.

        Thanks a lot for your help!


        • #5
          Hi Martin, thank you, I sent you a private message.


          • #6
            Thanks a lot for your help with this. Much appreciated!!!



            • #7
              Hi Martin, since I see that no mail notification is sent for private messages, I would like just to know if you received my last message. Thanks in advance!


              • #8

                Yes, I got your message, thanks a lot for that. I was able to download everything and will take a look as soon as possible. Will keep you updated.

                Thanks again very much for your help!