Number of threads to the roof

Normally a user can have around 1200 threads running.


djviking@machine:~> ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 128285
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1200
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

One should think this is enough.
I started to get problem starting applications, because the number of threads running on my system has gone to the roof.
Still after closing all my applications, there are roughly over 700 threads active.
Starting Vivaldi increases the number of threads to around 1000, Starting Chromium increase to 1200 threads.

I could increase the max user processes to 1850 (the same amount that root gets). I have done this on my work computer, but it seems like a workaround. Instead I would really like to address why there are so many threads, when I have no applications running.


top - 21:04:03 up 23 days, 22:41,  9 users,  load average: 1,53, 1,71, 1,70
Threads:** 1208 **total,**   1 **running,** 1205 **sleeping,**   0 **stopped,**   2 **zombie
%Cpu(s):**  3,2 **us,**  1,6 **sy,**  0,0 **ni,** 95,2 **id,**  0,0 **wa,**  0,0 **hi,**  0,0 **si,**  0,0 **st
KiB Mem: ** 32863936 **total,** 24904764 **used,**  7959172 **free,**   607484 **buffers
KiB Swap:**        0 **total,**        0 **used,**        0 **free.** 15635464 **cached Mem

Hi, looking at my fairly standard 42.2 here I see very different numbers. With only “top” in a terminal I see:


top - 21:18:59 up 39 min,  2 users,  load average: 0.14, 0.27, 0.33
**Threads: 412 total**,   1 running, 411 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  16317888 total,  2769448 used, 13548440 free,   110220 buffers
KiB Swap: 16777212 total,        0 used, 16777212 free.  2019108 cached Mem

and max user processes is 4096 here for a normal user (never touched that), while I confirm 1850 for root:


bruno@LT_B:~> ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63490
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
**max user processes              (-u) 4096**
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
bruno@LT_B:~>

Anything running “behind the scenes” in your system?

I completely forgot about this post…

I have done nothing fancy. The installation is not a fresh Leap 42.2, but an upgrade from 13.2

I think I will try to increase the max user processes to 4096, but would still like to find out why the thread count is so high.

The high thread count is seen when no desktop applications are running.
I am normally running
Vivaldi 30+ tabs
Chromium 8+ tabs (streaming)
Steam
DVD Profiler (Wine)
Services: sshd

I haven’t rebooted the machine in over a month. Will try running an upgrade and then restart to see what the thread count is right after startup.

After an upgrade and reboot, I have 334 threads running and no desktop applications.
Just opening Vivaldi spiked to 778 threads, but there are only 23 processes for vivaldi.

Opening Firefox with 27 tabs adds some 100 threads here (say 408 -> 512 or so). Don’t know if Vivaldi might be so much “multi-threaded”…

After running an upgrade of my Leap 42.2 the max user processes increased from 1200 to 4096


djviking@lbox:~> ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 128285
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited