Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to reduce number of native threads in proc table

 
Andreas Niemeyer
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all

I'm fighting with remaining native threads for an server application.

By monitoring the process list with "ps -auxw" I noticed many threads of the same application are there. The server starts with 12 processes and after a while more then 100 processes are up, no socket connections still remains.

The Linux JRE version is

java version "1.4.2_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)

Comparing between two linux systems, Debian and Suse, shows me a different behavior, under Debian the native threads falls back to an initial value.

Is there a way to limit the number of processes, perhaps by using an JVM option?

Best regards and many thanks in advance,
Andreas
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

1) "Threads" and "processes" are different things; I can't tell which you mean based on this message. Which is it?

Adding to the confusion, older Linux systems will display each thread as a process in the "ps" listing. Modern ones using the New POSIX Thread Libraru (NPTL) won't do this.

2) This is likely to be a server option, not a JVM option; the JVM won't start threads or processes on its own: it's up to the application running on the JVM, which presumably is either an application server or an ad-hoc application. Which is it? If it's an app server, which one? The answer is very likely to be specific to the particular app server.
 
Andreas Niemeyer
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the fast reply and your welcome greetings :-)

Well, I mean processes on OS level and a running application server, which uses sockets in spawned threads to exchange controls and file streamings.

I'm wondering about the remaining huge number of processes if the server idle a while.

Is there an OS option available to change this?

Best regards,
Andreas
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, the number of thread or processes used is going to be an option of the server software, not of Java itself or of the OS. So what server are you using? Tomcat? JBoss? Weblogic?
 
Andreas Niemeyer
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the missunderstand. No J2EE server mentioned, it is an own developed client-server service for tranferring files.

I found this article here
http://www.unixville.com/~moazam/stories/2004/05/18/debuggingHangsInTheJvm.html

and want now to play around with stackdumps to find the reasons.

I guess some system sockets stays open for listing, for solaris there exists timeout values to close ports (netstat shows some results)

I'll let you know about the progress.
 
Andreas Niemeyeer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I found the bug about sending a `kill -3 ProcID' - dump a stack
trace. The most number of stacks are the same(see below)

A `java.util.zip.ZipInputStream.getNextEntry(Unknown Source)' exception causes a hanging ssl socket though no clients are connected.

A netstat -p shows me a huge number of established connections bounded to the process.

I fixed the code by catching this exception, all works fine now.

Cheers,
Andreas



2. in the ComServerDataThread:
"45" prio=1 tid=0x08367d30 nid=0x13eb runnable [50a79000..50a798b8]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.a(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
- locked <0x44faba20> (a java.lang.Object)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
- locked <0x44faba78> (a com.sun.net.ssl.internal.ssl.AppInputStream)
at java.io.FilterInputStream.read(Unknown Source)
at java.io.PushbackInputStream.read(Unknown Source)
at java.util.zip.ZipInputStream.readFully(Unknown Source)
at java.util.zip.ZipInputStream.readLOC(Unknown Source)
at java.util.zip.ZipInputStream.getNextEntry(Unknown Source)
at com.XXX.YYY.prog.thread.ComServerDataThread.receiveData(ComServerDataThread.java:215)
at com.XXX.YYY.prog.thread.ComServerDataThread.run(ComServerDataThread.java:120)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic