You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zellij --version: 0.8.1 tput lines: irrelevant tput cols: irrelevant uname -av or ver(Windows): Linux nixos 5.14.10 #1-NixOS SMP Thu Oct 7 05:53:20 UTC 2021 x86_64 GNU/Linux alacritty --version: alacritty 0.9.0
Further information
Here is what I get in lsof -p $$ of the shell started from zellij:
zsh 189291 pc 0u CHR 136,7 0t0 10 /dev/pts/7
zsh 189291 pc 1u CHR 136,7 0t0 10 /dev/pts/7
zsh 189291 pc 2u CHR 136,7 0t0 10 /dev/pts/7
zsh 189291 pc 5u unix 0x0000000000000000 0t0 22962 /run/user/1000/zellij/0.18.1/session1 type=STREAM (LISTEN)
zsh 189291 pc 6u unix 0x0000000000000000 0t0 22963 /run/user/1000/zellij/0.18.1/session1 type=STREAM (CONNECTED)
zsh 189291 pc 7u unix 0x0000000000000000 0t0 22963 /run/user/1000/zellij/0.18.1/session1 type=STREAM (CONNECTED)
zsh 189291 pc 8u unix 0x0000000000000000 0t0 22084 /run/user/1000/zellij/0.18.1/session1 type=STREAM (CONNECTED)
zsh 189291 pc 9u unix 0x0000000000000000 0t0 22084 /run/user/1000/zellij/0.18.1/session1 type=STREAM (CONNECTED)
zsh 189291 pc 10u CHR 136,7 0t0 10 /dev/pts/7
zsh 189291 pc 11u CHR 5,2 0t0 85 /dev/ptmx
zsh 189291 pc 14u unix 0x0000000000000000 0t0 22098 /run/user/1000/zellij/0.18.1/session1 type=STREAM (CONNECTED)
zsh 189291 pc 15u unix 0x0000000000000000 0t0 22098 /run/user/1000/zellij/0.18.1/session1 type=STREAM (CONNECTED)
zsh 189291 pc 17r FIFO 0,13 0t0 637219 pipe
zsh 189291 pc 18w FIFO 0,13 0t0 637219 pipe
zsh 189291 pc 19u CHR 5,2 0t0 85 /dev/ptmx
zsh 189291 pc 20u CHR 5,2 0t0 85 /dev/ptmx
zsh 189291 pc 21u CHR 5,2 0t0 85 /dev/ptmx
This is the same shell running from alacritty directly:
zsh 515006 pc 0u CHR 136,12 0t0 15 /dev/pts/12
zsh 515006 pc 1u CHR 136,12 0t0 15 /dev/pts/12
zsh 515006 pc 2u CHR 136,12 0t0 15 /dev/pts/12
zsh 515006 pc 10u CHR 136,12 0t0 15 /dev/pts/12
So unix sockets are clearly leaking to the child, but probably pipes and ptmx is too.
To fix it you have to either consistently set cloexec flag on all files/sockets or close all sockets after fork (by iterating from 3 to ulimit, or using closefrom/close_range on systems that support that). Preferably doing both, because cloexec saves from leaking to processes run by any method (say zellij use a library that spawns a process), and closing after fork saves you from libraries that use file descriptors but didn't implement cloexec.
The text was updated successfully, but these errors were encountered:
tailhook
changed the title
Zellij leaks file descriptors the running processes/shell
Zellij leaks file descriptors to the running processes/shell
Oct 21, 2021
Basic information
zellij --version
: 0.8.1tput lines
: irrelevanttput cols
: irrelevantuname -av
orver
(Windows): Linux nixos 5.14.10 #1-NixOS SMP Thu Oct 7 05:53:20 UTC 2021 x86_64 GNU/Linuxalacritty --version
: alacritty 0.9.0Further information
Here is what I get in
lsof -p $$
of the shell started from zellij:This is the same shell running from alacritty directly:
So unix sockets are clearly leaking to the child, but probably pipes and ptmx is too.
To fix it you have to either consistently set cloexec flag on all files/sockets or close all sockets after fork (by iterating from 3 to ulimit, or using
closefrom
/close_range
on systems that support that). Preferably doing both, becausecloexec
saves from leaking to processes run by any method (say zellij use a library that spawns a process), and closing after fork saves you from libraries that use file descriptors but didn't implement cloexec.The text was updated successfully, but these errors were encountered: