Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-14-2005, 07:47 AM   #1
LQ Newbie
Registered: Nov 2005
Posts: 2

Rep: Reputation: 0
Java threads listed using kill -3 does not contain all threads found using ps -auxww


We are currently experiencing a problem running ServletExec (java Servlet container) where a process starts hogging the CPU. We end up having to restart the program.

As a Java developer, in these situations you tend to issue "kill -3 <pid>" commands to try to determine the rogue thread. The java VM traps this signal and outputs it's currently executing threads to system error.

In Linux, each java thread is implemented as a process. The rogue process I mentioned above does NOT appear in the "kill -3" stack trace which is very strange.

So I ran a very simple java program that starts a thread and continuously sleeps for 2 seconds and then prints out "Sleeping..". If I issue kill -3 commands against this program and compare against a listing of the threads using ps -auxww the latter contains more 2 threads.

So the "problem" is not a ServletExec issue.

Am I correct in my assumption that all the processes seen using ps -auxww should be visible in the Java stack trace? If not, how can I find out what the rogue java process is doing?

Many thanks for any info.


Red Hat release ES 2.1
kernel version 2.4.9-e.62smp
hardware hp ProLiant DL360 G3
java j2sdk1.4.2_09
ServletExec 4.1.1 patch 27
Old 11-14-2005, 08:06 AM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Am I correct in my assumption that all the processes seen using ps -auxww should be visible in the Java stack trace?
You're wrong, not every JVM thread is a Java thread, some are pure C threads.
If not, how can I find out what the rogue java process is doing?
I would use pstack on Solaris, I'm not sure what the equivalent is with Linux, anyway if it's a system thread, there is not that much you can do to control it.
I suspect it to be some garbage collection task, so you can try upgrading the JVM, switching GC algorithm, checking if the real culprit is not a memory leak in your code, ...
Old 11-14-2005, 08:57 AM   #3
LQ Newbie
Registered: Nov 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Many thanks for the quick response!

After using java for over 6 years there's still more to learn!

We're going to revert back to the vanilla GC algorithm. We were using the Concurrent Mark and Sweep algorithm which has worked fine for us. We're wondering if it is related to our upgrade to Java 1.4.2_09 which we made recently.

BTW, a useful point on the subject of Java garbage collection. It appears that the default value of -XX:NewRatio on Intel/Linux is 32 and not the same as the default value on Sparc/Solaris of 2. Presumably it thinks your running desktop application. It can really adversely affect your GC tuning!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Threads + wx bianchi Programming 1 11-28-2005 02:38 AM
java threads poeta_boy Programming 1 06-14-2005 04:34 PM
Java Threads - are they really redhatrosh Programming 1 04-05-2005 02:04 AM
java multithreading wait for all threads to die true_atlantis Programming 1 10-01-2004 06:26 PM
Java Threads vs Native Threads rjmendez Programming 0 08-16-2004 05:58 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration