[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: debian running out of threads



hanasaki wrote:
executing "ulimit" from the bash shell reports "unlimited" and bash "ulimit -a" gives the same output for my account as for root.

I have googled for bugs and found nothing looking relevant.

The JVM memory allocations are much below system resource max.

Know of any way to find out how many threads a process uses and how many are free vs. available for use?

Hrm. Well, I can tell you what I know just now for starters.

You might need to recompile glibc. But first you should do some sanity checking to be sure that you are running up against hard limits.

To get the number of threads per process:
- In Java: ThreadGroup.getParent() until null, then ThreadGroup.activeCount(); should correspond 1:1 with native threads. - Native: passing -L or -m to ps should get you a threads listing (count the lines or write a script to do it for you I suppose).

For hard limits, there is /proc/sys/kernel/threads-max. Or grep /usr/include/bits/local_lim.h for 'THREAD'. local_lim.h is "Minimum guaranteed maximum values for system limits."

_POSIX_THREAD_THREADS_MAX is threads per process
_PTHREAD_THREAD_THREADS_MAX I think is max total

Precisely how this number is related to /proc/sys/kernel/threads-max, I personally am not quite sure.

You can update (echo # >) the value of /proc/sys/kernel/threads-max during runtime. But if that doesn't work, and it looks like you are running up against the limits in local_lim.h, then probably you will need to recompile glibc.

dircha



Reply to: