Bug 466355

Summary: plasmashell service reports multiple child processes
Product: [Plasma] plasmashell Reporter: GoldBarb <q9hc26ia>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: kde
Priority: NOR    
Version First Reported In: 5.27.1   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description GoldBarb 2023-02-24 14:42:02 UTC
SUMMARY
***

Whenever I launch a program from the application menu they automatically get added to the plasmashell service status. Consequently increasing the memory usage of the plasmashell service. If for example plasmashell crashes it takes down any subprocesses with it including FF, Sublime or any other open program.

The question is whether this design is normal behavior, or something changed as part of the Linux Kernel ?

If I launch FF or any program directly from the terminal then the plasmashell service status does not get populated with additional processes.

I can understand why FF has these processes as these are controlled via "dom.ipc.processCount.webIsolated", but the above question remains.

systemctl --user status plasma-plasmashell
plasma-plasmashell.service - KDE Plasma Workspace
     Loaded: loaded (/usr/lib/systemd/user/plasma-plasmashell.service; disabled; preset: enabled)
     Active: active (running) since Fri 2023-02-24 13:58:42 GMT; 28min ago
   Main PID: 17576 (plasmashell)
      Tasks: 669 (limit: 38199)
     Memory: 1.9G
        CPU: 1min 9.815s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-plasmashell.service
             ├─17576 /usr/bin/plasmashell --no-respawn
             ├─18895 /usr/lib/kf5/kioslave5 /usr/lib/qt/plugins/kf5/kio/kio_http.so https "" local:/run/user/1000/plasmashellJwEIqa.7.kioworker.socket
             ├─18923 /usr/lib/kf5/kioslave5 /usr/lib/qt/plugins/kf5/kio/kio_http.so https "" local:/run/user/1000/plasmashellPuaGeu.8.kioworker.socket
             ├─19651 /usr/lib/firefox/firefox
             ├─19733 /usr/lib/firefox/firefox -contentproc -parentBuildID 20230214230245 -prefsLen 33391 -prefMapSize 236521 -appDir /usr/lib/firefox/browser {813ad8db-5cd6-477d-b667-f80d6f1edf69} 19651 true socket
             ├─19758 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 33494 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {760ccd13-cd8b-4e56-82a8-39b4fbde7>
             ├─19799 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 34350 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {9893cd18-6f48-48e6-bfba-48c792baf>
             ├─19849 /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 38793 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {2272922a-6902-4e12-8b5f-18660cc8f>
             ├─19905 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 38780 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {f51b37ec-b30c-4e63-a0d0-da3ad2a57>
             ├─19908 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 38780 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {789d89e8-3c67-4ee5-bfe8-dd84b8669>
             ├─19913 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 38780 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {9acb5117-941b-41a3-a80c-471c5cbf4>
             ├─20019 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 38780 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {174f3e05-e6e7-4754-a3f9-86ecea1f8>
             ├─20022 /usr/lib/firefox/firefox -contentproc -childID 8 -isForBrowser -prefsLen 38780 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {d1657234-8c22-4058-a5cc-b2430beb2>
             ├─20050 /usr/lib/firefox/firefox -contentproc -childID 9 -isForBrowser -prefsLen 38780 -prefMapSize 236521 -jsInitLen 246560 -parentBuildID 20230214230245 -appDir /usr/lib/firefox/browser {ebba6a2a-4230-4aff-bd21-92261e3b4>
             ├─20106 /usr/bin/subl --detached
             ├─20192 /opt/sublime_text/plugin_host-3.3 20106 /opt/sublime_text/sublime_text 
             ├─20195 /opt/sublime_text/plugin_host-3.8 20106 /opt/sublime_text/sublime_text
***


STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Linux Kernel: 6.1.13-1-lts
(available in About System)
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Comment 1 David Edmundson 2023-02-24 15:36:46 UTC
>. If for example plasmashell crashes it takes down any subprocesses with it including FF, Sublime or any other open program.

Please verify that is the case.
Comment 2 GoldBarb 2023-02-24 17:14:26 UTC
(In reply to David Edmundson from comment #1)
> >. If for example plasmashell crashes it takes down any subprocesses with it including FF, Sublime or any other open program.
> 
> Please verify that is the case.

It has happened a few days ago.
FF was running, along with Spotify.
Something caused Plasmashell to crash resulting in both programs to subsequently exit.

Some further observations.

Currently I have launched FF from the terminal.

As you can see from the below systemctl status from plasmashell FF doesn't appear in the list of subprocesses.
plasma-plasmashell.service - KDE Plasma Workspace
     Loaded: loaded (/usr/lib/systemd/user/plasma-plasmashell.service; disabled; preset: enabled)
     Active: active (running) since Fri 2023-02-24 14:51:19 GMT; 2h 17min ago
   Main PID: 24669 (plasmashell)
      Tasks: 113 (limit: 38199)
     Memory: 1.0G
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-plasmashell.service
             ├─24669 /usr/bin/plasmashell --no-respawn
             ├─25927 "/opt/discord/Discord --type=zygote --no-zygote-sandbox"
             ├─25928 "/opt/discord/Discord --type=zygote"
             ├─25930 "/opt/discord/Discord --type=zygote"
             ├─25972 "/opt/discord/Discord --type=gpu-process --field-trial-handle=3519898571147893682,6286612681406132475,131072 --disable-features=CookiesWithoutSameSiteMustBeSecure,Ha>
             ├─29204 /usr/bin/subl --detached
             ├─29279 /opt/sublime_text/plugin_host-3.3 29204 /opt/sublime_text/sublime_text /home/.config/sublime-text /home/.cache/sublime-text /opt/sublime_text/Packages
             ├─29282 /opt/sublime_text/plugin_host-3.8 29204 /opt/sublime_text/sublime_text /home/.config/sublime-text /home//.cache/sublime-text /opt/sublime_text/Packages
             ├─36858 /usr/lib/kf5/kioslave5 /usr/lib/qt/plugins/kf5/kio/kio_http.so https "" local:/run/user/1000/plasmashellgwdWPV.22.kioworker.socket
             └─36962 /usr/lib/kf5/kioslave5 /usr/lib/qt/plugins/kf5/kio/kio_http.so https "" local:/run/user/1000/plasmashellhebSYC.23.kioworker.socket

Is there some special inner mechanism of how systemd works with managing CGroups ?
Comment 3 GoldBarb 2023-02-24 23:40:56 UTC
After further investigation I was initially launching FF by calling a shell script to run on the discrete GPU.
This shell script sets a few environment variables and then runs FF.

I modified the application entry for FF inside kmenuedit and instead of calling a shell script, I entered the environment variables manually, and inside Program I entered firefox.

After making this change, FF no longer appears inside the systemctl status of plasmashell.