I have a problem with a recent customer migration to Linux (64-bit) when running a Java process.
The process is spawning thousands of threads most with an identifier of futex. I've looked up futex (fast userspace mutex) and it's a Linux construct to implement basic locking.
The code has recently changed to implement a BlockingQueue and an ExecutorService to spawn child threads but the number of child threads is controlled by a config setting and I can prove that this specific mechanism is not running out of control. I can only assume that something internal to the JVM is spawning all these threads due to the BlockingQueue and some lock?
So can anyone tell me 开发者_Python百科how to find out what these threads actually are and what I might do to control/stop them?
Below is a few lines of the process list; the actual list before the process had to be killed was over 13000 lines long.
0 - 54321 447 446 1 - - - 5953085 - ? 00:15:50 java
0 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 - 1 S 54321 - - 0 82 2 - - futex_ - 00:00:00 -Any suggestions gratefully accepted.
If you cannot load the application in the debugger of an IDE, you might want to load the application with VisualVM to look at what the threads are actually doing:
http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/threads.html
Make sure you can kill the app, as it might run out of resources because of the high number of threads (i.e. in linux, have a shell ready).
精彩评论