LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-14-2005, 07:47 AM   #1
coneheed
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


Hello

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.

Environment:

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
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
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.
Quote:
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
coneheed
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!

cheers
 
  


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:02 AM.

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