You are not logged in.

#1 2018-05-19 18:31:51

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

[SOLVED] Processes spawning tons of child processes

This is a weird one. Basically, any application that I start (and some systemd services) spawn varying numbers of children. They don't really do much except use up RAM and CPU, but that's annoying and after a while my laptop gets slow and I have to reboot.

It's hard to explain, so here's what htop looks like (each screenshot is one page below the previous): https://imgur.com/a/wUwj8CA

Here's some outputs of commands that might help:
uname -a
Linux thinkpad 4.16.9-1-ARCH #1 SMP PREEMPT Thu May 17 02:10:09 UTC 2018 x86_64 GNU/Linux

neofetch --backend off

tom@thinkpad 
------------ 
OS: Arch Linux x86_64 
Model: 20J1CTO1WW ThinkPad 13 2nd Gen 
Kernel: 4.16.9-1-ARCH 
Uptime: 1 hour 
Packages: 1209 
Shell: zsh 5.5.1 
Resolution: 1366x768 
Theme: Adwaita [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: urxvtd 
Terminal Font: DejaVu Sans Mono 
CPU: Intel i3-7100U (4) @ 2.400GHz 
GPU: Intel HD Graphics 620 
Memory: 1534MiB / 3833MiB

pstree -c
https://pastebin.com/YcrTzUL0

If I need to post any more command output, just tell me.

Last edited by peanutbutter144 (2018-05-21 12:06:53)

Offline

#2 2018-05-19 19:57:49

mpan
Member
Registered: 2012-08-01
Posts: 1,675
Website

Re: [SOLVED] Processes spawning tons of child processes

Can you provide the screenshot in some more standard color scheme (non-monochrome)? On the picture it’s hard to tell which entries are processes and which are not. For that reason I also guess that you might have mistaken threads for processes.

Offline

#3 2018-05-19 20:08:53

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

Re: [SOLVED] Processes spawning tons of child processes

https://imgur.com/a/VhuMYj5

Ok, if they are threads not processes is this a problem or not? Because I just thought that it didn't look right. I'm not that experienced with linux processes, but I thought that different PIDs meant different processes?

Maybe the CPU/RAM issue is just my laptop, it's not very high specced.

Last edited by peanutbutter144 (2018-05-19 20:10:47)

Offline

#4 2018-05-19 20:10:18

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: [SOLVED] Processes spawning tons of child processes

@mpan all the entries appear to have unique PID's

Offline

#5 2018-05-19 20:11:23

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

Re: [SOLVED] Processes spawning tons of child processes

loqs wrote:

@mpan all the entries appear to have unique PID's

yeah that's what i thought

Offline

#6 2018-05-19 21:28:50

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,849

Re: [SOLVED] Processes spawning tons of child processes

Threads have unique PIDs (techincally they're resource sharing processes)
Try "pstree -T"

At least chromium & firefox however use one "real" process per tab - security feature.

I however doubt this is somehow related to "after a while my laptop gets slow and I have to reboot" which sounds far more like *one* leaking process.

Offline

#7 2018-05-19 21:39:23

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: [SOLVED] Processes spawning tons of child processes

Perhaps add the output of `cat /proc/meminfo` as well to see if it is userspace or the kernel with the memory.

Offline

#8 2018-05-19 21:50:44

mpan
Member
Registered: 2012-08-01
Posts: 1,675
Website

Re: [SOLVED] Processes spawning tons of child processes

There is no PIDs in Linux. Only TIDs. What is considered “Process ID” is really just the identifier of the first thread in a process.

From the colorful htop output it seems like all the entries are normal threads, which is also confirmed by their MEM% column: shared among etnries and summing to over 100%. If you want to see processes only¹: “Setup” → “Display options” and uncheck “Hide userland process threads”.

It is hard to guess, from the information provided, what is hogging up your system, but I don’t think it’s the number of threads: it seems reasonable. For example I have over 350 threads now. You can count them using:

sudo find /proc/ -maxdepth 3 -path '*/task/*' | wc -l

The screenshots from htop also indicate that there is nearly no load on your system. 1.5G RAM, 7% CPUs, 0.65 load average, swap not even touched: a perfectly healthy system.

____
¹ Or rather only the initial threads.

Last edited by mpan (2018-05-19 21:54:54)

Offline

#9 2018-05-20 08:13:19

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

Re: [SOLVED] Processes spawning tons of child processes

seth wrote:

Threads have unique PIDs (techincally they're resource sharing processes)
Try "pstree -T"

At least chromium & firefox however use one "real" process per tab - security feature.

I however doubt this is somehow related to "after a while my laptop gets slow and I have to reboot" which sounds far more like *one* leaking process.

pstree -T

systemd─┬─NetworkManager
        ├─avahi-daemon───avahi-daemon
        ├─crond
        ├─cups-browsed
        ├─cupsd───dbus
        ├─dbus-daemon
        ├─login───zsh───startx───xinit─┬─X───xf86-video-inte
        │                              └─xmonad-x86_64-l─┬─dunst
        │                                                ├─firefox───4*[We+
        │                                                ├─udiskie
        │                                                └─xmobar
        ├─lvmetad
        ├─polkitd
        ├─rtkit-daemon
        ├─systemd─┬─(sd-pam)
        │         ├─at-spi-bus-laun───dbus-daemon
        │         ├─at-spi2-registr
        │         ├─dbus-daemon
        │         ├─dconf-service
        │         ├─gconfd-2
        │         ├─gvfs-udisks2-vo
        │         ├─gvfsd─┬─gvfsd-dnssd
        │         │       ├─gvfsd-network
        │         │       └─gvfsd-trash
        │         ├─gvfsd-fuse
        │         ├─gvfsd-metadata
        │         └─pulseaudio
        ├─systemd-journal
        ├─systemd-logind
        ├─systemd-udevd
        ├─udisksd
        ├─urxvtd───zsh───pstree
        └─wpa_supplicant

Offline

#10 2018-05-20 08:14:11

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

Re: [SOLVED] Processes spawning tons of child processes

loqs wrote:

Perhaps add the output of `cat /proc/meminfo` as well to see if it is userspace or the kernel with the memory.

cat /proc/meminfo

MemTotal:        3925320 kB
MemFree:         1508752 kB
MemAvailable:    2730256 kB
Buffers:          114720 kB
Cached:           774900 kB
SwapCached:          172 kB
Active:          1214168 kB
Inactive:         940768 kB
Active(anon):     619732 kB
Inactive(anon):   168868 kB
Active(file):     594436 kB
Inactive(file):   771900 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       4194300 kB
SwapFree:        4193276 kB
Dirty:               724 kB
Writeback:             0 kB
AnonPages:       1265260 kB
Mapped:           346368 kB
Shmem:             87916 kB
Slab:             156296 kB
SReclaimable:     115864 kB
SUnreclaim:        40432 kB
KernelStack:        6192 kB
PageTables:        17040 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     6156960 kB
Committed_AS:    3630140 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      198216 kB
DirectMap2M:     3878912 kB
DirectMap1G:           0 kB

Offline

#11 2018-05-20 08:25:02

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

Re: [SOLVED] Processes spawning tons of child processes

mpan wrote:

There is no PIDs in Linux. Only TIDs. What is considered “Process ID” is really just the identifier of the first thread in a process.

From the colorful htop output it seems like all the entries are normal threads, which is also confirmed by their MEM% column: shared among etnries and summing to over 100%. If you want to see processes only¹: “Setup” → “Display options” and uncheck “Hide userland process threads”.

It is hard to guess, from the information provided, what is hogging up your system, but I don’t think it’s the number of threads: it seems reasonable. For example I have over 350 threads now. You can count them using:

sudo find /proc/ -maxdepth 3 -path '*/task/*' | wc -l

The screenshots from htop also indicate that there is nearly no load on your system. 1.5G RAM, 7% CPUs, 0.65 load average, swap not even touched: a perfectly healthy system.

____
¹ Or rather only the initial threads.

Thanks for clarifying. It's just that when I started discord, all my CPU cores were on around 90%. That might be just a problem with it being an electron app, but it didn't seem right. Also thanks for telling me how to see processes only in htop, that makes it much easier to understand.

By the way, here's the output of sudo find /proc/ -maxdepth 3 -path '*/task/*' | wc -l
386

Last edited by peanutbutter144 (2018-05-20 08:34:14)

Offline

#12 2018-05-20 11:51:23

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,849

Re: [SOLVED] Processes spawning tons of child processes

a problem with it being an electron app

Bingo.

The meminfo looks ok, ~1GB is actually used (and probably by FF, since discord or chromium don't seem running)

Offline

#13 2018-05-21 09:38:09

peanutbutter144
Member
Registered: 2017-12-11
Posts: 23

Re: [SOLVED] Processes spawning tons of child processes

seth wrote:

a problem with it being an electron app

Bingo.

The meminfo looks ok, ~1GB is actually used (and probably by FF, since discord or chromium don't seem running)

Ok, so I can mark this thread as solved?

Offline

#14 2018-05-21 10:05:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Processes spawning tons of child processes

If you feel that it is, yes.

Offline

Board footer

Powered by FluxBB