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?
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.
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.
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)