akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.32k stars 77 forks source link

[kitty] Hangs on exit #402

Open 10b14224cc opened 4 months ago

10b14224cc commented 4 months ago

ble version: Bash version:

GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu) [Arch Linux]
ble.sh, version 0.4.0-devel4+838b4652 (noarch) [git 2.43.0, GNU Make 4.4.1, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)]
starship, version 1.17.1 (rustc 1.75.0 (82e1608df 2023-12-21) (Arch Linux rust 1:1.75.0-1), 2024-01-03 07:54:53 +00:00)
zoxide, version 0.9.2 (/usr/bin/zoxide)
atuin, version 17.2.1 (/usr/bin/atuin)
locale: LANG=en_US.UTF-8 LC_TIME=en_DK.UTF-8
terminal: TERM=xterm-kitty wcwidth=15.0-west/15.1-2+ri, kitty:0 (1;4000;31)

When I type exit and press Enter, sometimes (not always) ble.sh just hangs here:

image

It displays this and then nothing happens.

The kitty tab is not closed.

akinomyoga commented 4 months ago

Thank you for the report. I haven't had the problem in my environment, so I need to ask questions to reproduce the problem in my environment or identify the cause.

The terminal (kitty tab) closes when all the file descriptors of the TTY slave, which are held by the processes in the session, are closed. There are two possibilities. The Bash process hangs, or other processes started from Bash and connected to the TTY are alive.

When I type exit and press Enter, sometimes (not always)

How easy is it to reproduce the problem in your environment? For example, can you reproduce the problem within a minute by repeating opening a new tab and closing the tab by running exit? Or does it happen only once per hour or day?

I'd like to ask you to do experiments on your side because I cannot reproduce the behavior, but depending on the frequency of the problem, I need to reconsider the set of experiments. For example, if that only happens once per hour even when you repeat opening and closing the session, it would be very hard to do many experiments, so I need to prepare configurations to catch everything at one event as much as possible.

ble.sh just hangs here:

Did you confirm that what is hanging is actually the ble.sh? Or does it just mean the terminal tab with ble.sh doesn't close? For example, have you checked the process list to confirm that the Bash process hangs? As mentioned above, there are other possibilities.

10b14224cc commented 4 months ago

It is possible to hook a function on exit that would print the processes before actually exiting?

akinomyoga commented 4 months ago

It is possible to hook a function on exit that would print the processes before actually exiting?

It's possible. You can do something like

ble/function#advice before exit 'your-shell-function'

But I'm not sure if that's useful because it is equivalent to just running

$ your-shell-function; exit

If you want to hook to blesh's exit processing, you can instead set a hook as

blehook EXIT+='your-shell-function'

But even in that case, it's not sufficient to check whether there are remaining processes or not because other processes can be started after the EXIT hook finished. To confirm whether there are remaining processes, after the hanging happens, you can check the process list (e.g. by running ps uxf) in another kitty tab. It would be useful to record the tty name before exiting (or you may log the tty name in the EXIT hook). For example,

# blerc

blehook EXIT+='{ date; echo "pid $$"; tty; } >> ~/debug.txt'

then after the hanging happens, while keeping the hanging window, you can run the following command in another terminal window or tab:

$ date
$ tail -n 3 ~/debug.txt
$ ps uxf

If you could manage to do the above, could you give me the output?

akinomyoga commented 4 months ago

To come to the original question, how often do you face with this problem? For example, roughly how many times does this problem happen when you exit the ble.sh session 10 or 100 times? In short, what is the rough probability?

10b14224cc commented 4 months ago

I've put this:

blehook EXIT+='{ date; echo "pid $$"; tty; } >> ~/debug.txt'

in $HOME/.config/blesh/init.sh

10b14224cc commented 4 months ago

To come to the original question, how often do you face with this problem? For example, roughly how many times does this problem happen when you exit the ble.sh session 10 or 100 times? In short, what is the rough probability?

4 every 10?

akinomyoga commented 4 months ago
blehook EXIT+='{ date; echo "pid $$"; tty; } >> ~/debug.txt'

in $HOME/.config/blesh/init.sh

OK, let's wait for the next hanging. Once the hanging happens, please follow the instructions in https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1926017866. I mean this part:

after the hanging happens, while keeping the hanging window, you can run the following command in another terminal window or tab:

$ date
$ tail -n 3 ~/debug.txt
$ ps uxf
akinomyoga commented 4 months ago

To come to the original question, how often do you face with this problem? For example, roughly how many times does this problem happen when you exit the ble.sh session 10 or 100 times? In short, what is the rough probability?

4 every 10?

Great! Then it shouldn't be difficult to collect the information.

10b14224cc commented 4 months ago
``` / 󰌾 ➜ date 2024-02-05T07:17:03 CET / 󰌾 ➜ tail -n 3 ~/Documents/blesh_debug.txt 2024-02-05T07:16:40 CET pid 21265 /dev/pts/0 / 󰌾 ➜ ps uxf USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND USERNAME 3901 7.0 1.2 1342492 202620 tty1 Sl+ 06:37 2:47 Hyprland USERNAME 23271 0.1 0.2 123496 42436 ? Sl 07:16 0:00 hyprpaper USERNAME 18916 0.6 1.5 1135664 255920 tty1 Sl+ 07:12 0:01 kitty USERNAME 18923 5.5 0.2 41016 37240 pts/1 Ss+ 07:12 0:17 \_ /usr/bin/bash --posix USERNAME 23814 16.8 0.2 39400 35780 pts/2 Ss 07:17 0:03 \_ /usr/bin/bash --posix USERNAME 24438 0.0 0.0 12504 5424 pts/2 R+ 07:17 0:00 \_ ps uxf USERNAME 18773 0.0 0.0 7524 3680 tty1 S+ 07:11 0:00 bash /home/USERNAME/data/progetti_miei/various_tools/desktop USERNAME 18774 0.1 0.6 1794540 112504 tty1 Sl+ 07:11 0:00 \_ waybar USERNAME 18793 0.0 0.0 17084 10708 tty1 S 07:11 0:00 \_ /usr/bin/python /home/USERNAME/.config/waybar/script USERNAME 18799 0.5 0.6 1128856 105148 tty1 Sl 07:11 0:01 \_ python3 /home/USERNAME/.config/waybar/waybar-mediapl USERNAME 5611 16.2 4.3 12720168 695728 tty1 Sl+ 06:44 5:17 /usr/lib/firefox/firefox USERNAME 5703 0.0 0.2 247468 45152 tty1 Sl+ 06:44 0:00 \_ /usr/lib/firefox/firefox -contentproc -parentBuildID 202 USERNAME 5739 0.0 0.5 2458756 88020 tty1 Sl+ 06:44 0:00 \_ /usr/lib/firefox/firefox -contentproc -childID 1 -isForB USERNAME 5785 0.6 1.1 2615488 179288 tty1 Sl+ 06:44 0:13 \_ /usr/lib/firefox/firefox -contentproc -childID 2 -isForB USERNAME 5874 1.6 0.3 489112 59820 tty1 Sl+ 06:44 0:31 \_ /usr/lib/firefox/firefox -contentproc -parentBuildID 202 USERNAME 5894 0.0 0.3 347848 50812 tty1 Sl+ 06:44 0:00 \_ /usr/bin/plasma-browser-integration-host /usr/lib/mozill USERNAME 5915 0.0 0.1 155140 21888 tty1 SLl+ 06:44 0:00 \_ /usr/bin/keepassxc-proxy /home/USERNAME/.mozilla/native- USERNAME 5997 21.8 3.7 3302108 595916 tty1 Sl+ 06:44 7:05 \_ /usr/lib/firefox/firefox -contentproc -childID 6 -isForB USERNAME 6804 1.1 0.7 804788 122028 tty1 Sl+ 06:45 0:21 \_ /usr/lib/firefox/firefox -contentproc -parentBuildID 202 USERNAME 7994 0.0 0.5 2468920 96236 tty1 Sl+ 06:48 0:00 \_ /usr/lib/firefox/firefox -contentproc -childID 11 -isFor USERNAME 13177 0.7 1.4 2641692 226644 tty1 Sl+ 07:04 0:05 \_ /usr/lib/firefox/firefox -contentproc -childID 15 -isFor USERNAME 13316 0.0 0.4 2435620 77412 tty1 Sl+ 07:04 0:00 \_ /usr/lib/firefox/firefox -contentproc -childID 16 -isFor USERNAME 20601 0.0 0.4 2435636 77628 tty1 Sl+ 07:13 0:00 \_ /usr/lib/firefox/firefox -contentproc -childID 17 -isFor USERNAME 20664 0.0 0.4 2435636 77900 tty1 Sl+ 07:13 0:00 \_ /usr/lib/firefox/firefox -contentproc -childID 18 -isFor USERNAME 4008 0.0 0.1 366856 29784 tty1 S+ 06:37 0:00 mako USERNAME 4006 0.0 0.4 561752 75408 tty1 Sl+ 06:37 0:00 /usr/bin/python /usr/bin/udiskie USERNAME 4003 0.0 0.5 596340 82684 tty1 SLl+ 06:37 0:00 /usr/lib/kdeconnectd USERNAME 3996 0.0 0.7 1713012 123544 tty1 Sl+ 06:37 0:00 /usr/bin/python /usr/bin/maestral_qt USERNAME 4266 0.2 0.6 984116 108396 tty1 SNl+ 06:37 0:06 \_ /usr/bin/python -c import maestral.daemon; maestral.daem USERNAME 3993 0.0 0.3 549460 56964 tty1 Sl+ 06:37 0:00 nm-applet --indicator USERNAME 3989 0.1 1.2 1002820 195904 tty1 SLl+ 06:37 0:02 keepassxc USERNAME 3981 0.0 0.0 6544 3200 tty1 S+ 06:37 0:00 swayidle -w timeout 600 swaylock -f -c 000000 timeout 900 hy USERNAME 3977 0.0 0.2 537232 48212 tty1 Sl+ 06:37 0:00 /usr/lib/polkit-kde-authentication-agent-1 USERNAME 3890 0.0 0.0 21184 12320 ? Ss 06:37 0:00 /usr/lib/systemd/systemd --user USERNAME 3892 0.0 0.0 23552 3396 ? S 06:37 0:00 \_ (sd-pam) USERNAME 3899 0.2 0.2 400592 32468 ? Ss 06:37 0:06 \_ python3 -m radicale USERNAME 3943 0.0 0.0 8860 3660 ? Ss 06:37 0:00 \_ /usr/bin/dbus-broker-launch --scope user USERNAME 3947 0.0 0.0 4868 2516 ? S 06:37 0:00 | \_ dbus-broker --log 4 --controller 10 --machine-id 396 USERNAME 4024 0.0 0.1 630496 25256 ? Ssl 06:37 0:00 \_ /usr/lib/xdg-desktop-portal USERNAME 4045 0.0 0.1 606804 19152 ? Ssl 06:37 0:00 \_ /usr/lib/xdg-document-portal USERNAME 4050 0.0 0.0 305592 13476 ? Ssl 06:37 0:00 \_ /usr/lib/xdg-permission-store USERNAME 4063 0.0 0.1 382020 17340 ? Ssl 06:37 0:00 \_ /usr/lib/at-spi-bus-launcher USERNAME 4070 0.0 0.0 8860 3840 ? S 06:37 0:00 | \_ /usr/bin/dbus-broker-launch --config-file=/usr/share USERNAME 4071 0.0 0.0 3992 2188 ? S 06:37 0:00 | \_ dbus-broker --log 4 --controller 9 --machine-id USERNAME 4064 0.0 0.2 454112 37424 ? Ssl 06:37 0:00 \_ /usr/lib/xdg-desktop-portal-gtk USERNAME 4077 0.0 0.0 235116 13344 ? Ssl 06:37 0:00 \_ /usr/lib/at-spi2-registryd --use-gnome-session USERNAME 4096 0.1 0.1 202976 31328 ? S
akinomyoga commented 4 months ago

Thanks.

USERNAME   18916  0.6  1.5 1135664 255920 tty1   Sl+  07:12   0:01 kitty
USERNAME   18923  5.5  0.2  41016 37240 pts/1    Ss+  07:12   0:17  \_ /usr/bin/bash --posix
USERNAME   23814 16.8  0.2  39400 35780 pts/2    Ss   07:17   0:03  \_ /usr/bin/bash --posix
USERNAME   24438  0.0  0.0  12504  5424 pts/2    R+   07:17   0:00      \_ ps uxf

This part is related. Hmm, what I can tell from the result is that the Bash process 21265 doesn't exist anymore. The remaining Bash processes are 18923 and 23814, but the latter is the terminal window where you run ps uxf, and the former seems to be another different tab. Also, there are no processes associated with the original TTY session (pts/0).

To make sure, did you have three tabs when running ps uxf, right? One is the hanging tab, another is the tab where you run ps uxf, and there was another tab.

10b14224cc commented 4 months ago

To make sure, did you have three tabs when running ps uxf, right?

Yes. The second one hanged.

One is the hanging tab, another is the tab where you run ps uxf, and there was another tab.

Yes

akinomyoga commented 4 months ago

Thank you for the confirmation. Hmm, it is a puzzle that a tab remains even though there are no remaining processes. I don't have an idea now. I'll think about other possibilities. When I come up with one, I'll again ask you to test it.

I thought it should be an issue of remaining processes, which are common to all the terminals, but maybe this could be something specific to kitty. I think I also have to check the behavior in kitty, although I haven't experienced it when I used ble.sh in kitty before.

akinomyoga commented 4 months ago

I tried kitty in my environment, but I don't seem to be able to reproduce the problem.

10b14224cc commented 4 months ago

I have to find a way to consistently reproduce it first.

akinomyoga commented 4 months ago

Do you have any updates on this? Do you still experience the problem?

10b14224cc commented 4 months ago

I messed up my kitty installation.

I can't type characters like : in neovim anymore.

So I'm trying other terminals.

akinomyoga commented 4 months ago

I messed up my kitty installation.

I can't type characters like : in neovim anymore.

From yesterday, many Atuin users are reporting this: https://github.com/atuinsh/atuin/issues/1693

ribru17 commented 4 months ago

I also experience this problem, came here to report a bug. I am also on Kitty. I was going to run the instructions in the comment and post the output as well but then after a few minutes the process did actually exit :sweat_smile: So maybe that information is of some use

akinomyoga commented 4 months ago

Thank you for the information. Does that mean it doesn't reproduce frequently enough that you can run the instructions in the next occurrence?

@ribru17 Can you provide the information about your environment? What is the result of the following command?

$ ble/widget/display-shell-version

after a few minutes the process did actually exit 😅

Did you see the actual process in the ps output or another process monitor? If so, do you remember which process remained (e.g. Bash)?

ribru17 commented 4 months ago

I can try, I will keep this tab open. Also only happens maybe 1/3 times for me

Can you provide the information about your environment? What is the result of the following command?

GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu) [Arch Linux]
ble.sh, version 0.4.0-devel4+27e6309 (noarch) [git 2.43.0, GNU Make 4.4.1, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)]
bash-completion, version 2.11 (hash:2d02f73e803daa87a06e94e33b2a7b3e672a2c0c, 76338 bytes) (noarch)
locale: LANG=en_US.UTF-8
terminal: TERM=xterm-kitty wcwidth=15.0-west/15.1-2+ri, kitty:0 (1;4000;31)

Did you see the actual process in the ps output or another process monitor? If so, do you remember which process remained (e.g. Bash)?

No, sorry, I didn't get a chance to see it: I will try next time it happens to grep through the processes to find something related to bash or blesh!

akinomyoga commented 4 months ago

I will try next time it happens to grep through the processes to find something related to bash or blesh!

Thank you. If there is a chance to check the processes, I'd like to check the process tree and related TTY/PTY information (but not just the existence of the process) as quoted from https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1926017866:

For example,

# blerc

blehook EXIT+='{ date; echo "pid $$"; tty; } >> ~/debug.txt'

then after the hanging happens, while keeping the hanging window, you can run the following command in another terminal window or tab:

$ date
$ tail -n 3 ~/debug.txt
$ ps uxf

If you could manage to do the above, could you give me the output?

ribru17 commented 4 months ago

Here is the output of one that just happened:

``` Sat Feb 10 06:42:25 PM PST 2024 Sat Feb 10 06:42:20 PM PST 2024 pid 24586 /dev/pts/2 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND rileyb 1775 0.0 0.3 199080 24576 tty1 Ssl+ Feb09 0:00 /usr/bin/startplasma-wayland rileyb 1774 0.0 0.7 988548 57244 ? Sl Feb09 0:00 /usr/bin/kwalletd5 --pam-login 12 14 rileyb 1760 0.0 0.1 21260 12032 ? Ss Feb09 0:00 /usr/lib/systemd/systemd --user rileyb 1762 0.0 0.0 23424 2252 ? S Feb09 0:00 \_ (sd-pam) rileyb 1789 0.0 0.0 8860 3840 ? Ss Feb09 0:00 \_ /usr/bin/dbus-broker-launch --scope user rileyb 1790 0.0 0.0 5128 3072 ? S Feb09 0:00 | \_ dbus-broker --log 4 --controller 10 --machine-id rileyb 1798 0.0 0.2 160564 18432 ? Ssl Feb09 0:00 \_ /usr/bin/kwin_wayland_wrapper --xwayland rileyb 1802 0.7 2.3 2409684 180444 ? Sl Feb09 11:32 | \_ /usr/bin/kwin_wayland --wayland-fd 7 --socket way rileyb 1882 0.3 1.0 558776 77808 ? Sl Feb09 4:45 | \_ /usr/bin/Xwayland :1 -auth /run/user/1000/xau rileyb 1800 0.0 0.6 268740928 52300 ? SNsl Feb09 0:01 \_ /usr/lib/baloo_file rileyb 1813 0.0 0.3 630552 25804 ? Ssl Feb09 0:01 \_ /usr/lib/xdg-desktop-portal rileyb 1823 0.0 0.1 533068 10364 ? Ssl Feb09 0:00 \_ /usr/lib/xdg-document-portal rileyb 1827 0.0 0.0 305588 7472 ? Ssl Feb09 0:00 \_ /usr/lib/xdg-permission-store rileyb 1910 0.0 0.7 767360 55188 ? Ssl Feb09 0:02 \_ /usr/bin/ksmserver rileyb 1912 0.0 1.1 1713292 86644 ? Ssl Feb09 0:09 \_ /usr/bin/kded5 rileyb 1941 0.0 0.5 627804 38708 ? Ssl Feb09 0:00 \_ /usr/lib/kactivitymanagerd rileyb 1957 0.3 3.2 4281720 249772 ? Ssl Feb09 4:55 \_ /usr/bin/plasmashell --no-respawn rileyb 2301 0.9 7.5 34707976 580032 ? Sl Feb09 15:31 | \_ /opt/brave-bin/brave rileyb 2311 0.0 0.7 34215740 60928 ? S Feb09 0:00 | | \_ /opt/brave-bin/brave --type=zygote --no-zygot rileyb 2344 2.1 2.7 34811860 209764 ? Sl Feb09 34:32 | | | \_ /opt/brave-bin/brave --type=gpu-process - rileyb 2312 0.0 0.8 34215732 64000 ? S Feb09 0:00 | | \_ /opt/brave-bin/brave --type=zygote --crashpad rileyb 2314 0.0 0.2 34215760 17320 ? S Feb09 0:00 | | | \_ /opt/brave-bin/brave --type=zygote --cras rileyb 2358 0.0 0.9 34275644 70296 ? Sl Feb09 0:08 | | | \_ /opt/brave-bin/brave --type=utility - rileyb 2453 0.0 1.7 1186547212 135232 ? Sl Feb09 0:03 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 2584 0.1 3.8 1190953636 296688 ? Sl Feb09 2:17 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 2633 0.0 2.2 1186544600 176040 ? Sl Feb09 0:06 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 2685 0.1 5.4 1193115116 416400 ? Sl Feb09 2:46 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 3256 0.1 4.0 1186580160 314596 ? Sl Feb09 1:41 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 4846 0.0 2.3 1186543836 177140 ? Sl Feb09 0:02 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 14596 0.0 2.2 1186541320 173496 ? Sl 10:25 0:26 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 14913 4.7 8.3 1190928792 638392 ? Sl 10:54 22:12 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 21566 0.4 3.6 1188789960 280152 ? Sl 15:19 0:55 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 24307 0.4 2.9 1186558772 227316 ? Sl 17:58 0:11 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 25213 1.0 3.5 1188742352 269108 ? Sl 18:23 0:11 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 25253 0.0 1.7 1186531016 132656 ? Sl 18:23 0:00 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 25387 2.6 3.4 1186565000 266768 ? Sl 18:26 0:25 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 25452 0.0 1.0 1186489772 82908 ? Sl 18:28 0:00 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 2346 0.3 2.0 33993752 160596 ? Sl Feb09 5:33 | | \_ /opt/brave-bin/brave --type=utility --utility rileyb 2770 0.0 1.1 34232584 91368 ? Sl Feb09 0:47 | | \_ /opt/brave-bin/brave --type=utility --utility rileyb 22281 0.0 2.1 1114040 167008 ? Sl 15:42 0:06 | \_ /usr/bin/kitty rileyb 23871 0.2 0.4 40284 36632 pts/1 Ss 17:53 0:06 | \_ /bin/bash --posix rileyb 27483 0.0 0.0 11152 4608 pts/1 R+ 18:42 0:00 | \_ ps uxf rileyb 1973 0.0 0.2 229896 21120 ? Ssl Feb09 0:02 \_ /usr/bin/gmenudbusmenuproxy rileyb 1978 0.0 0.6 985972 53176 ? Ssl Feb09 0:00 \_ /usr/lib/polkit-kde-authentication-agent-1 rileyb 1979 0.0 0.6 981212 47972 ? Ssl Feb09 0:04 \_ /usr/lib/org_kde_powerdevil rileyb 1980 0.0 1.1 1345952 91616 ? Ssl Feb09 0:03 \_ /usr/lib/xdg-desktop-portal-kde rileyb 1982 0.0 0.2 228528 20408 ? Ssl Feb09 0:02 \_ /usr/bin/xembedsniproxy rileyb 1983 0.0 0.0 228984 5124 ? Ssl Feb09 0:00 \_ /usr/lib/dconf-service rileyb 2033 0.0 0.1 107468 13896 ? S

Edit: my config if needed

#!/bin/bash

# suppress error output
bleopt complete_ambiguous=
bleopt complete_auto_history=
bleopt exec_errexit_mark=''
bleopt prompt_eol_mark=''
bleopt term_index_colors=auto
bleopt exec_elapsed_mark=''

ble-bind -f 'C-SP' 'complete show_menu'
ble-bind -m auto_complete -f 'C-e' auto_complete/cancel
ble-bind -m isearch -f 'RET' isearch/accept-line
ble-bind -m isearch -f 'C-m' isearch/accept-line
ble-bind -m vi_imap -f 'C-c' discard-line
ble-bind -m vi_nmap -f 'C-c' discard-line
ble-bind -m vi_imap -f 'C-RET' accept-line
ble-bind -m vi_imap -f 'S-RET' newline
ble-bind -m vi_nmap -f 'S-RET' accept-line
ble-bind -m vi_nmap -f 'H' vi-command/beginning-of-line
ble-bind -m vi_omap -f 'H' vi-command/beginning-of-line
ble-bind -m vi_nmap -f 'L' vi-command/forward-eol
ble-bind -m vi_omap -f 'L' vi-command/forward-eol
ble-bind -m emacs -f 'S-RET' newline
# for kitty
ble-bind -m auto_complete -f C-i auto_complete/insert
ble-bind -m emacs -f 'M-DEL' kill-backward-fword
ble-bind -m vi_imap -f 'M-DEL' kill-backward-fword
# for wezterm
ble-bind -m auto_complete -f TAB auto_complete/insert
ble-bind -m emacs -f 'M-C-?' kill-backward-fword
ble-bind -m vi_imap -f 'M-C-?' kill-backward-fword

# colors
ble-face -s argument_error bg=red
ble-face -s argument_option fg=#f08080,italic
ble-face -s auto_complete fg=#5b5e5a,italic
ble-face -s cmdinfo_cd_cdpath fg=#96c7ef,bg=black,italic
ble-face -s command_alias fg=blue
ble-face -s command_builtin fg=#ff9966
ble-face -s command_directory fg=#96c7ef
ble-face -s command_file fg=blue
ble-face -s command_function fg=blue
ble-face -s command_keyword fg=purple
ble-face -s disabled fg=#5b5e5a
ble-face -s filename_directory fg=#96c7ef
ble-face -s filename_directory_sticky fg=black,bg=green
ble-face -s filename_executable fg=green,bold
ble-face -s filename_ls_colors none
ble-face -s filename_orphan fg=cyan,bold
ble-face -s filename_other none
ble-face -s filename_setgid fg=black,bg=yellow,underline
ble-face -s filename_setuid fg=black,bg=#ff9966,underline
ble-face -s menu_filter_input fg=black,bg=#e2c792
ble-face -s overwrite_mode fg=black,bg=cyan
ble-face -s prompt_status_line bg=#5b5e5a
ble-face -s region bg=#3a3d37
ble-face -s region_insert bg=#3a3d37
ble-face -s region_match fg=black,bg=#e2c792
ble-face -s region_target fg=black,bg=purple
ble-face -s syntax_brace fg=#838781
ble-face -s syntax_command fg=blue
ble-face -s syntax_comment fg=#e2c792
ble-face -s syntax_delimiter fg=#838781
ble-face -s syntax_document fg=cyan,bold
ble-face -s syntax_document_begin fg=cyan,bold
ble-face -s syntax_error bg=red
ble-face -s syntax_escape fg=#f08080
ble-face -s syntax_expr fg=#c5c2ee
ble-face -s syntax_function_name fg=blue
ble-face -s syntax_glob fg=#ff9966
ble-face -s syntax_history_expansion fg=blue,italic
ble-face -s syntax_param_expansion fg=red
ble-face -s syntax_quotation fg=green
ble-face -s syntax_tilde fg=#c5c2ee
ble-face -s syntax_varname fg=none
ble-face -s varname_array fg=#ff9966
ble-face -s varname_empty fg=#ff9966
ble-face -s varname_export fg=#ff9966
ble-face -s varname_expr fg=#ff9966
ble-face -s varname_hash fg=#ff9966
ble-face -s varname_number fg=none
ble-face -s varname_readonly fg=#ff9966
ble-face -s varname_transform fg=#ff9966
ble-face -s varname_unset bg=red
ble-face -s vbell_erase bg=#3a3d37

# debugging
blehook EXIT+='{ date; echo "pid $$"; tty; } >> ~/debug.txt'
akinomyoga commented 4 months ago

Thank you for the results. Now you can remove the debugging setting.

The result is consistent with @10b14224cc's. There do not seem to exist any processes associated with the hanging tab (whose TTY/PTY is pts/2). Also, the process 24586 doesn't exist. I'm not sure what causes the delay in closing the kitty tab.

Maybe some settings of TTY cause an issue. In the latest push, there is a fix for Bash 5.2 that might affect the final state of the TTY. You seem to use the second last push (ble-0.4.0-devel4+27e6309), so could you try the latest version? You can update ble.sh by running ble-update. Then you can close all the tabs, open the tabs again, and try to see if the situation changes.

ribru17 commented 4 months ago

Thank you, I will do this and report if the issue stops

10b14224cc commented 4 months ago

Thank you, I will do this and report if the issue stops

Are you by any chance using nnn as file manager?

ribru17 commented 4 months ago

No, sorry. Also I am still getting the issue; but I realized it is less frequent than I thought, usually only happening with tabs that have been open for quite a while

akinomyoga commented 4 months ago

Thank you for the information. Hmm, so it would be harder to test it. Maybe some specific command that was run in the session is related.

ribru17 commented 4 months ago

Of course. My hunch says perhaps it is related to the elapsed time feature: I have this disabled in my personal config, and maybe that causes some weird behavior sometimes? I have seen that this only happens usually when the tab that has been open for a while also has had some process running for a while (e.g. I have a vim instance in it for a while and then forget its there, close it and exit the tab, and the hanging starts)

akinomyoga commented 4 months ago

My hunch says perhaps it is related to the elapsed time feature: I have this disabled in my personal config, and maybe that causes some weird behavior sometimes?

The config is just to turn off outputting the elapsed time. The measurement of the elapsed time is always performed by ble.sh even if you turn off bleopt exec_elapsed_mark. But I'm not sure if we can rule out the elapsed time feature for the culprit.

(e.g. I have a vim instance in it for a while and then forget its there, close it and exit the tab, and the hanging starts)

Thank you. That should be a hint, yet I don't have an idea now.

10b14224cc commented 4 months ago

I strongly suspect there is a subprocess of a shell subprocess still hanging around.

But I cannot reproduce it consistently still.

akinomyoga commented 4 months ago

Thank you for your reply. Yeah, that is my first suspicion, so I asked for the result of the ps command. However, there do not seem to be any processes in the results, https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1926302385 and https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1937401565.

There is still a possibility that some system processes (whose USER is not the current user) started in the session are alive (because ps uxf doesn't print the system processes), but I'm not sure how that could happen. In case you are still interested in this possibility, the system processes can be listed by ps uaxf (instead of ps uxf in the instructions https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1937354634).

ribru17 commented 4 months ago

I just had it happen again: here is the result of ps uaxf while hanging:

``` USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2 0.0 0.0 0 0 ? S Feb09 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S Feb09 0:00 \_ [pool_workqueue_release] root 4 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-rcu_g] root 5 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-rcu_p] root 6 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-slub_] root 7 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-netns] root 9 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/0:0H-events_highpri] root 12 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-mm_pe] root 14 0.0 0.0 0 0 ? I Feb09 0:00 \_ [rcu_tasks_kthread] root 15 0.0 0.0 0 0 ? I Feb09 0:00 \_ [rcu_tasks_rude_kthread] root 16 0.0 0.0 0 0 ? I Feb09 0:00 \_ [rcu_tasks_trace_kthread] root 17 0.0 0.0 0 0 ? S Feb09 0:01 \_ [ksoftirqd/0] root 18 0.0 0.0 0 0 ? I Feb09 0:18 \_ [rcu_preempt] root 19 0.0 0.0 0 0 ? S Feb09 0:00 \_ [rcub/0] root 20 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/0] root 21 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/0] root 22 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/0] root 23 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/1] root 24 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/1] root 25 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/1] root 26 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/1] root 28 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/1:0H-events_highpri] root 29 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/2] root 30 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/2] root 31 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/2] root 32 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/2] root 34 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/2:0H-events_highpri] root 35 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/3] root 36 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/3] root 37 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/3] root 38 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/3] root 40 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/3:0H-events_highpri] root 41 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/4] root 42 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/4] root 43 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/4] root 44 0.0 0.0 0 0 ? S Feb09 0:16 \_ [ksoftirqd/4] root 46 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/4:0H-events_highpri] root 47 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/5] root 48 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/5] root 49 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/5] root 50 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/5] root 52 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/5:0H-events_highpri] root 53 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/6] root 54 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/6] root 55 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/6] root 56 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/6] root 58 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/6:0H-events_highpri] root 59 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/7] root 60 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/7] root 61 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/7] root 62 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/7] root 64 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/7:0H-events_highpri] root 65 0.0 0.0 0 0 ? S Feb09 0:00 \_ [kdevtmpfs] root 66 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-inet_] root 67 0.0 0.0 0 0 ? S Feb09 0:00 \_ [kauditd] root 69 0.0 0.0 0 0 ? S Feb09 0:00 \_ [khungtaskd] root 70 0.0 0.0 0 0 ? S Feb09 0:00 \_ [oom_reaper] root 72 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-write] root 73 0.0 0.0 0 0 ? S Feb09 1:21 \_ [kcompactd0] root 74 0.0 0.0 0 0 ? SN Feb09 0:00 \_ [ksmd] root 75 0.0 0.0 0 0 ? SN Feb09 0:07 \_ [khugepaged] root 76 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kinte] root 77 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kbloc] root 78 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-blkcg] root 80 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-tpm_d] root 81 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ata_s] root 82 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-edac-] root 83 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-devfr] root 84 0.0 0.0 0 0 ? S Feb09 0:00 \_ [watchdogd] root 87 0.0 0.0 0 0 ? S Feb09 0:28 \_ [kswapd0] root 88 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kthro] root 93 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-acpi_] root 95 0.0 0.0 0 0 ? S Feb09 0:02 \_ [hwrng] root 96 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-mld] root 97 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ipv6_] root 104 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kstrp] root 106 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-charg] root 123 0.0 0.0 0 0 ? I< Feb09 0:08 \_ [kworker/5:1H-kblockd] root 124 0.0 0.0 0 0 ? I< Feb09 0:01 \_ [kworker/4:1H-kblockd] root 136 0.0 0.0 0 0 ? I< Feb09 0:05 \_ [kworker/7:1H-kblockd] root 160 0.0 0.0 0 0 ? I< Feb09 0:06 \_ [kworker/6:1H-kblockd] root 161 0.0 0.0 0 0 ? I< Feb09 0:04 \_ [kworker/1:1H-events_highpri] root 162 0.0 0.0 0 0 ? I< Feb09 0:04 \_ [kworker/2:1H-kblockd] root 163 0.0 0.0 0 0 ? I< Feb09 0:02 \_ [kworker/0:1H-kblockd] root 165 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-crypt] root 166 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 167 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 168 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 169 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 172 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-sdhci] root 903 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kdmfl] root 907 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kcryp] root 908 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kcryp] root 909 0.0 0.0 0 0 ? S Feb09 0:09 \_ [dmcrypt_write/254:0] root 922 0.0 0.0 0 0 ? S Feb09 0:13 \_ [jbd2/dm-0-8] root 923 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ext4-] root 1016 0.0 0.0 0 0 ? S Feb09 0:00 \_ [psimon] root 1102 0.0 0.0 0 0 ? S Feb09 2:01 \_ [irq/45-MSFT0001:00] root 1131 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/61-WACF2200:00] root 1140 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-cfg80] root 1158 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-USBC0] root 1162 0.0 0.0 0 0 ? S Feb09 0:06 \_ [irq/137-iwlwifi:default_queue] root 1163 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/138-iwlwifi:queue_1] root 1164 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/139-iwlwifi:queue_2] root 1165 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/140-iwlwifi:queue_3] root 1166 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/141-iwlwifi:queue_4] root 1167 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/142-iwlwifi:queue_5] root 1169 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/143-iwlwifi:queue_6] root 1170 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/144-iwlwifi:queue_7] root 1171 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/145-iwlwifi:queue_8] root 1172 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/146-iwlwifi:exception] root 1247 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ttm] root 1251 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc0] root 1252 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc1] root 1253 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc2] root 1254 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc3] root 1403 0.0 0.0 0 0 ? S Feb09 0:01 \_ [irq/152-AudioDSP] root 2251 0.0 0.0 0 0 ? S< Feb09 0:00 \_ [krfcommd] root 111837 0.0 0.0 0 0 ? S Feb12 0:00 \_ [psimon] root 178109 0.0 0.0 0 0 ? I< Feb13 0:00 \_ [kworker/3:2H] root 181256 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:10-events_unbound] root 181686 0.0 0.0 0 0 ? I< Feb13 0:04 \_ [kworker/u17:3-rb_allocator] root 184221 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/3:0-mm_percpu_wq] root 184829 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/7:1-mm_percpu_wq] root 184860 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/1:1-i915-unordered] root 185272 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/2:0-mm_percpu_wq] root 186276 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/0:1-mm_percpu_wq] root 186368 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:9-events_unbound] root 186370 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:13-events_unbound] root 186371 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:14-kcryptd/254:0] root 186656 0.0 0.0 0 0 ? D< Feb13 0:00 \_ [kworker/u17:0+i915_flip] root 186689 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/6:2-events] root 186985 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/4:2-i915-unordered] root 187384 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:0-events_unbound] root 187521 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/3:1-rcu_gp] root 187629 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/0:2-mm_percpu_wq] root 187641 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/5:1-mm_percpu_wq] root 187655 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:2-events_unbound] root 187811 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/7:0-mm_percpu_wq] root 187896 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/4:0-cgroup_destroy] root 187901 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/1:2-rcu_gp] root 188017 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/2:1-events] root 188041 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:11-events_unbound] root 188042 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:12-events_unbound] root 188043 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:15-events_unbound] root 188044 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:17-events_unbound] root 188771 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/6:1-i915-unordered] root 188772 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/5:2-mm_percpu_wq] root 188774 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/2:2-i915-unordered] root 188789 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/7:2-mm_percpu_wq] root 188811 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/1:0-mm_percpu_wq] root 188860 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:1-events_unbound] root 188861 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:3-events_unbound] root 188862 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:4-kcryptd/254:0] root 188863 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:5-events_unbound] root 188864 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:6-events_unbound] root 188865 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:7-events_unbound] root 188866 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:8-events_unbound] root 188867 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:16-events_unbound] root 188868 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:18-events_unbound] root 188869 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:19-events_unbound] root 188870 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:20-events_unbound] root 188871 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:21-events_unbound] root 188872 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:22-events_unbound] root 188873 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:23-kcryptd/254:0] root 188874 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:24-events_unbound] root 188875 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:25-events_unbound] root 188876 0.0 0.0 0 0 ? S 07:54 0:00 \_ [irq/126-mei_me] root 188877 0.0 0.0 0 0 ? S 07:54 0:00 \_ [irq/135-mmc0] root 188878 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:26-kcryptd/254:0] root 188879 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:27-events_unbound] root 188880 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:28-events_unbound] root 188881 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:29-kcryptd/254:0] root 188882 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:30-kcryptd/254:0] root 188883 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:31-events_unbound] root 188884 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:32-events_unbound] root 188885 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:33-kcryptd/254:0] root 188886 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:34] root 188887 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:35] root 188888 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/2:3] root 188889 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/0:0] root 188890 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/7:3-events] root 189035 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/4:1-i915-unordered] root 189038 0.0 0.0 0 0 ? I< 07:54 0:00 \_ [kworker/u17:1-rb_allocator] root 189039 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/7:4] root 189057 0.0 0.0 0 0 ? I< 07:54 0:00 \_ [kworker/u17:2-rb_allocator] root 189286 0.0 0.0 0 0 ? I 07:56 0:00 \_ [kworker/6:0-i915-unordered] root 189359 0.0 0.0 0 0 ? I 07:57 0:00 \_ [kworker/5:0] root 1 0.0 0.1 22792 9080 ? Ss Feb09 0:09 /sbin/init root 972 0.0 0.2 75620 18916 ? Ss Feb09 0:03 /usr/lib/systemd/systemd-journald root 1015 0.0 0.0 32624 6612 ? Ss Feb09 0:02 /usr/lib/systemd/systemd-udevd systemd+ 1244 0.0 0.0 91764 4764 ? Ssl Feb09 0:00 /usr/lib/systemd/systemd-timesyncd dbus 1277 0.0 0.0 12648 5040 ? Ss Feb09 0:00 /usr/bin/dbus-broker-launch --scope system --audit dbus 1317 0.0 0.0 10388 6284 ? S Feb09 0:28 \_ dbus-broker --log 4 --controller 9 --machine-id ebd54 root 1318 0.0 0.2 417240 19924 ? Ssl Feb09 1:35 /usr/bin/NetworkManager --no-daemon root 1319 0.0 0.0 18212 5216 ? Ss Feb09 0:01 /usr/lib/systemd/systemd-logind root 1339 0.0 0.1 152572 9984 ? Ssl Feb09 0:00 /usr/bin/sddm root 1441 0.0 0.2 776228 16308 tty2 Ssl+ Feb09 0:00 \_ /usr/lib/Xorg -nolisten tcp -background none -seat se root 1754 0.0 0.1 75832 9216 ? S Feb09 0:00 \_ /usr/lib/sddm/sddm-helper --socket /tmp/sddm-auth-a0f rileyb 1775 0.0 0.1 199080 10112 tty1 Ssl+ Feb09 0:00 \_ /usr/bin/startplasma-wayland root 1389 0.0 0.0 12232 3968 ? Ss Feb09 0:00 /usr/lib/bluetooth/bluetoothd root 1394 0.0 0.1 19172 8960 ? Ss Feb09 0:11 /usr/bin/wpa_supplicant -u -s -O /run/wpa_supplicant rileyb 1760 0.0 0.1 21396 7808 ? Ss Feb09 0:02 /usr/lib/systemd/systemd --user rileyb 1762 0.0 0.0 23424 1868 ? S Feb09 0:00 \_ (sd-pam) rileyb 1789 0.0 0.0 8992 3200 ? Ss Feb09 0:00 \_ /usr/bin/dbus-broker-launch --scope user rileyb 1790 0.0 0.0 5248 3200 ? S Feb09 0:03 | \_ dbus-broker --log 4 --controller 10 --machine-id rileyb 1798 0.0 0.1 160564 9472 ? Ssl Feb09 0:00 \_ /usr/bin/kwin_wayland_wrapper --xwayland rileyb 1802 0.5 2.0 2644284 155560 ? Sl Feb09 37:43 | \_ /usr/bin/kwin_wayland --wayland-fd 7 --socket way rileyb 1882 0.2 0.4 559400 36576 ? Sl Feb09 14:26 | \_ /usr/bin/Xwayland :1 -auth /run/user/1000/xau rileyb 1800 0.0 1.3 268743024 100120 ? SNsl Feb09 0:07 \_ /usr/lib/baloo_file rileyb 1813 0.0 0.1 630684 14772 ? Ssl Feb09 0:06 \_ /usr/lib/xdg-desktop-portal rileyb 1823 0.0 0.1 606800 9844 ? Ssl Feb09 0:00 \_ /usr/lib/xdg-document-portal root 1837 0.0 0.0 2496 1664 ? Ss Feb09 0:00 | \_ fusermount3 -o rw,nosuid,nodev,fsname=portal,auto rileyb 1827 0.0 0.0 305588 7088 ? Ssl Feb09 0:01 \_ /usr/lib/xdg-permission-store rileyb 1910 0.0 0.2 767360 18324 ? Ssl Feb09 0:07 \_ /usr/bin/ksmserver rileyb 1912 0.0 0.5 1716908 42436 ? Ssl Feb09 0:53 \_ /usr/bin/kded5 rileyb 1941 0.0 0.3 627968 25080 ? Ssl Feb09 0:03 \_ /usr/lib/kactivitymanagerd rileyb 1957 0.1 2.7 6254760 213732 ? Ssl Feb09 9:48 \_ /usr/bin/plasmashell --no-respawn rileyb 131719 0.8 6.3 34664544 490828 ? Sl Feb12 23:42 | \_ /opt/brave-bin/brave rileyb 131729 0.0 0.3 34215768 29056 ? S Feb12 0:00 | | \_ /opt/brave-bin/brave --type=zygote --no-zygot rileyb 131762 1.2 2.1 34862084 163336 ? Sl Feb12 35:19 | | | \_ /opt/brave-bin/brave --type=gpu-process - rileyb 131730 0.0 0.4 34215760 32128 ? S Feb12 0:00 | | \_ /opt/brave-bin/brave --type=zygote --crashpad rileyb 131732 0.0 0.1 34215788 9128 ? S Feb12 0:00 | | | \_ /opt/brave-bin/brave --type=zygote --cras rileyb 131774 0.0 0.8 34275800 67276 ? Sl Feb12 0:13 | | | \_ /opt/brave-bin/brave --type=utility - rileyb 131795 0.0 1.6 1186547240 129396 ? Sl Feb12 0:04 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131910 0.0 1.7 1186540700 133060 ? Sl Feb12 0:08 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131933 0.1 5.6 1193118924 432880 ? Sl Feb12 5:46 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131985 0.1 3.4 1190945052 263112 ? Sl Feb12 5:10 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 136166 0.1 4.0 1186580952 309408 ? Sl Feb12 3:50 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 140139 0.0 2.3 1188774380 180888 ? Sl Feb12 1:31 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 140744 0.1 3.9 1188752576 305816 ? Sl Feb12 4:01 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 147998 0.0 2.3 1186542776 178920 ? Sl Feb12 0:25 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 164251 0.0 1.4 1186539116 110408 ? Sl Feb13 0:01 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 164260 0.0 1.6 1186542688 129932 ? Sl Feb13 0:02 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 164270 0.0 1.7 1188702828 133488 ? Sl Feb13 0:16 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 165219 0.0 3.3 1186560160 254868 ? Sl Feb13 0:40 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 175887 0.2 3.1 1186582524 239128 ? Sl Feb13 1:51 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 185257 0.1 3.3 1186563108 255524 ? Sl Feb13 0:58 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 185328 0.0 2.7 1186563396 210716 ? Sl Feb13 0:24 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 187462 0.0 3.0 1186578532 236428 ? Sl Feb13 0:15 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 189263 0.0 0.9 1186489800 74872 ? Sl 07:56 0:00 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131764 0.2 1.6 33993548 124296 ? Sl Feb12 6:53 | | \_ /opt/brave-bin/brave --type=utility --utility rileyb 132002 0.0 0.8 34232612 63956 ? Sl Feb12 0:45 | | \_ /opt/brave-bin/brave --type=utility --utility rileyb 147830 0.0 1.7 1476252 136528 ? Sl Feb12 0:06 | \_ /usr/bin/dolphin rileyb 161710 0.1 1.8 1148104 145612 ? Sl Feb13 1:11 | \_ /usr/bin/kitty rileyb 161719 0.0 0.4 42668 37856 pts/1 Ss+ Feb13 0:23 | \_ /bin/bash --posix rileyb 185343 0.0 0.4 39752 36292 pts/2 Ss Feb13 0:02 | \_ /bin/bash --posix rileyb 187766 0.0 0.1 13704 8448 pts/2 Sl+ Feb13 0:00 | | \_ nvim other.py rileyb 187769 0.0 0.5 47204 42368 ? Ssl Feb13 0:04 | | \_ nvim --embed other.py rileyb 187777 0.0 0.6 284180 53136 ? Ssl Feb13 0:00 | | \_ /home/rileyb/.local/share/nvim/ma rileyb 187791 0.0 0.3 37244 28584 ? S Feb13 0:00 | | \_ /home/rileyb/.local/share/nvi rileyb 187088 0.0 0.4 39784 36476 pts/3 Ss Feb13 0:02 | \_ /bin/bash --posix rileyb 189363 0.0 0.0 11156 4608 pts/3 R+ 07:57 0:00 | \_ ps uaxf rileyb 1973 0.0 0.1 229896 10880 ? Ssl Feb09 0:07 \_ /usr/bin/gmenudbusmenuproxy rileyb 1978 0.0 0.1 985972 14264 ? Ssl Feb09 0:00 \_ /usr/lib/polkit-kde-authentication-agent-1 rileyb 1979 0.0 0.3 981344 24804 ? Ssl Feb09 0:18 \_ /usr/lib/org_kde_powerdevil rileyb 1980 0.0 0.5 1420576 43904 ? Ssl Feb09 0:14 \_ /usr/lib/xdg-desktop-portal-kde rileyb 1982 0.0 0.1 228528 10680 ? Ssl Feb09 0:07 \_ /usr/bin/xembedsniproxy rileyb 1983 0.0 0.0 228984 4612 ? Ssl Feb09 0:00 \_ /usr/lib/dconf-service rileyb 2033 0.0 0.0 108216 5972 ? S

And just in case, I ran it again after the hanging tab exited:

``` USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2 0.0 0.0 0 0 ? S Feb09 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S Feb09 0:00 \_ [pool_workqueue_release] root 4 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-rcu_g] root 5 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-rcu_p] root 6 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-slub_] root 7 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-netns] root 9 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/0:0H-events_highpri] root 12 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-mm_pe] root 14 0.0 0.0 0 0 ? I Feb09 0:00 \_ [rcu_tasks_kthread] root 15 0.0 0.0 0 0 ? I Feb09 0:00 \_ [rcu_tasks_rude_kthread] root 16 0.0 0.0 0 0 ? I Feb09 0:00 \_ [rcu_tasks_trace_kthread] root 17 0.0 0.0 0 0 ? S Feb09 0:01 \_ [ksoftirqd/0] root 18 0.0 0.0 0 0 ? I Feb09 0:18 \_ [rcu_preempt] root 19 0.0 0.0 0 0 ? S Feb09 0:00 \_ [rcub/0] root 20 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/0] root 21 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/0] root 22 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/0] root 23 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/1] root 24 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/1] root 25 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/1] root 26 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/1] root 28 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/1:0H-events_highpri] root 29 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/2] root 30 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/2] root 31 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/2] root 32 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/2] root 34 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/2:0H-events_highpri] root 35 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/3] root 36 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/3] root 37 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/3] root 38 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/3] root 40 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/3:0H-events_highpri] root 41 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/4] root 42 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/4] root 43 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/4] root 44 0.0 0.0 0 0 ? S Feb09 0:16 \_ [ksoftirqd/4] root 46 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/4:0H-events_highpri] root 47 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/5] root 48 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/5] root 49 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/5] root 50 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/5] root 52 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/5:0H-events_highpri] root 53 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/6] root 54 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/6] root 55 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/6] root 56 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/6] root 58 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/6:0H-events_highpri] root 59 0.0 0.0 0 0 ? S Feb09 0:00 \_ [cpuhp/7] root 60 0.0 0.0 0 0 ? S Feb09 0:00 \_ [idle_inject/7] root 61 0.0 0.0 0 0 ? S Feb09 0:00 \_ [migration/7] root 62 0.0 0.0 0 0 ? S Feb09 0:00 \_ [ksoftirqd/7] root 64 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/7:0H-events_highpri] root 65 0.0 0.0 0 0 ? S Feb09 0:00 \_ [kdevtmpfs] root 66 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-inet_] root 67 0.0 0.0 0 0 ? S Feb09 0:00 \_ [kauditd] root 69 0.0 0.0 0 0 ? S Feb09 0:00 \_ [khungtaskd] root 70 0.0 0.0 0 0 ? S Feb09 0:00 \_ [oom_reaper] root 72 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-write] root 73 0.0 0.0 0 0 ? S Feb09 1:21 \_ [kcompactd0] root 74 0.0 0.0 0 0 ? SN Feb09 0:00 \_ [ksmd] root 75 0.0 0.0 0 0 ? SN Feb09 0:07 \_ [khugepaged] root 76 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kinte] root 77 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kbloc] root 78 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-blkcg] root 80 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-tpm_d] root 81 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ata_s] root 82 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-edac-] root 83 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-devfr] root 84 0.0 0.0 0 0 ? S Feb09 0:00 \_ [watchdogd] root 87 0.0 0.0 0 0 ? S Feb09 0:28 \_ [kswapd0] root 88 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kthro] root 93 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-acpi_] root 95 0.0 0.0 0 0 ? S Feb09 0:02 \_ [hwrng] root 96 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-mld] root 97 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ipv6_] root 104 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kstrp] root 106 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-charg] root 123 0.0 0.0 0 0 ? I< Feb09 0:08 \_ [kworker/5:1H-events_highpri] root 124 0.0 0.0 0 0 ? I< Feb09 0:01 \_ [kworker/4:1H-kblockd] root 136 0.0 0.0 0 0 ? I< Feb09 0:05 \_ [kworker/7:1H-kblockd] root 160 0.0 0.0 0 0 ? I< Feb09 0:06 \_ [kworker/6:1H-events_highpri] root 161 0.0 0.0 0 0 ? I< Feb09 0:04 \_ [kworker/1:1H-kblockd] root 162 0.0 0.0 0 0 ? I< Feb09 0:04 \_ [kworker/2:1H-kblockd] root 163 0.0 0.0 0 0 ? I< Feb09 0:02 \_ [kworker/0:1H-kblockd] root 165 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-crypt] root 166 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 167 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 168 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 169 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-nvme-] root 172 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-sdhci] root 903 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kdmfl] root 907 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kcryp] root 908 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-kcryp] root 909 0.0 0.0 0 0 ? S Feb09 0:09 \_ [dmcrypt_write/254:0] root 922 0.0 0.0 0 0 ? S Feb09 0:13 \_ [jbd2/dm-0-8] root 923 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ext4-] root 1016 0.0 0.0 0 0 ? S Feb09 0:00 \_ [psimon] root 1102 0.0 0.0 0 0 ? S Feb09 2:01 \_ [irq/45-MSFT0001:00] root 1131 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/61-WACF2200:00] root 1140 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-cfg80] root 1158 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-USBC0] root 1162 0.0 0.0 0 0 ? S Feb09 0:06 \_ [irq/137-iwlwifi:default_queue] root 1163 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/138-iwlwifi:queue_1] root 1164 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/139-iwlwifi:queue_2] root 1165 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/140-iwlwifi:queue_3] root 1166 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/141-iwlwifi:queue_4] root 1167 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/142-iwlwifi:queue_5] root 1169 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/143-iwlwifi:queue_6] root 1170 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/144-iwlwifi:queue_7] root 1171 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/145-iwlwifi:queue_8] root 1172 0.0 0.0 0 0 ? S Feb09 0:00 \_ [irq/146-iwlwifi:exception] root 1247 0.0 0.0 0 0 ? I< Feb09 0:00 \_ [kworker/R-ttm] root 1251 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc0] root 1252 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc1] root 1253 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc2] root 1254 0.0 0.0 0 0 ? S Feb09 0:00 \_ [card1-crtc3] root 1403 0.0 0.0 0 0 ? S Feb09 0:01 \_ [irq/152-AudioDSP] root 2251 0.0 0.0 0 0 ? S< Feb09 0:00 \_ [krfcommd] root 111837 0.0 0.0 0 0 ? S Feb12 0:00 \_ [psimon] root 178109 0.0 0.0 0 0 ? I< Feb13 0:00 \_ [kworker/3:2H] root 181256 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:10-events_unbound] root 181686 0.0 0.0 0 0 ? I< Feb13 0:04 \_ [kworker/u17:3-rb_allocator] root 184221 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/3:0-mm_percpu_wq] root 184829 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/7:1-mm_percpu_wq] root 184860 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/1:1-i915-unordered] root 185272 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/2:0-events] root 186276 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/0:1-kdmflush/254:0] root 186368 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:9-events_unbound] root 186370 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:13-events_unbound] root 186371 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:14-kcryptd/254:0] root 186656 0.0 0.0 0 0 ? D< Feb13 0:01 \_ [kworker/u17:0+i915_flip] root 186689 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/6:2-events] root 186985 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/4:2-i915-unordered] root 187384 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:0-events_unbound] root 187521 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/3:1-rcu_gp] root 187629 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/0:2-mm_percpu_wq] root 187641 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/5:1-events] root 187655 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:2-events_unbound] root 187811 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/7:0-mm_percpu_wq] root 187896 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/4:0-cgroup_destroy] root 187901 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/1:2-rcu_gp] root 188017 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/2:1-events] root 188041 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:11-events_unbound] root 188042 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:12-events_unbound] root 188043 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:15-events_unbound] root 188044 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:17-events_unbound] root 188771 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/6:1-i915-unordered] root 188772 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/5:2-mm_percpu_wq] root 188774 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/2:2-events] root 188789 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/7:2-i915-unordered] root 188811 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/1:0-events] root 188860 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:1-events_unbound] root 188861 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:3-events_unbound] root 188862 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:4-i915] root 188863 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:5-events_unbound] root 188864 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:6-events_unbound] root 188865 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:7-events_unbound] root 188866 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:8-events_unbound] root 188867 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:16-events_unbound] root 188868 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:18-kcryptd/254:0] root 188869 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:19-events_unbound] root 188870 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:20-events_unbound] root 188871 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:21-events_unbound] root 188872 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:22-events_unbound] root 188873 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:23-kcryptd/254:0] root 188874 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:24-events_unbound] root 188875 0.0 0.0 0 0 ? I Feb13 0:00 \_ [kworker/u16:25-events_unbound] root 188876 0.0 0.0 0 0 ? S 07:54 0:00 \_ [irq/126-mei_me] root 188877 0.0 0.0 0 0 ? S 07:54 0:00 \_ [irq/135-mmc0] root 188878 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:26-kcryptd/254:0] root 188879 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:27-events_unbound] root 188880 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:28-events_unbound] root 188881 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:29-kcryptd/254:0] root 188882 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:30-kcryptd/254:0] root 188883 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:31-kcryptd/254:0] root 188884 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:32-events_unbound] root 188885 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:33-kcryptd/254:0] root 188886 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:34] root 188887 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/u16:35] root 188888 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/2:3] root 188889 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/0:0] root 188890 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/7:3-events] root 189035 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/4:1-i915-unordered] root 189038 0.0 0.0 0 0 ? I< 07:54 0:00 \_ [kworker/u17:1-rb_allocator] root 189039 0.0 0.0 0 0 ? I 07:54 0:00 \_ [kworker/7:4] root 189057 0.0 0.0 0 0 ? I< 07:54 0:00 \_ [kworker/u17:2-rb_allocator] root 189286 0.0 0.0 0 0 ? I 07:56 0:00 \_ [kworker/6:0-i915-unordered] root 189359 0.0 0.0 0 0 ? I 07:57 0:00 \_ [kworker/5:0] root 189372 0.0 0.0 0 0 ? I 07:59 0:00 \_ [kworker/3:2] root 1 0.0 0.1 22792 9080 ? Ss Feb09 0:09 /sbin/init root 972 0.0 0.2 75620 18916 ? Ss Feb09 0:03 /usr/lib/systemd/systemd-journald root 1015 0.0 0.0 32624 6612 ? Ss Feb09 0:02 /usr/lib/systemd/systemd-udevd systemd+ 1244 0.0 0.0 91764 4764 ? Ssl Feb09 0:00 /usr/lib/systemd/systemd-timesyncd dbus 1277 0.0 0.0 12648 5040 ? Ss Feb09 0:00 /usr/bin/dbus-broker-launch --scope system --audit dbus 1317 0.0 0.0 10388 6284 ? S Feb09 0:28 \_ dbus-broker --log 4 --controller 9 --machine-id ebd54 root 1318 0.0 0.2 417240 19924 ? Ssl Feb09 1:35 /usr/bin/NetworkManager --no-daemon root 1319 0.0 0.0 18212 5216 ? Ss Feb09 0:01 /usr/lib/systemd/systemd-logind root 1339 0.0 0.1 152572 9984 ? Ssl Feb09 0:00 /usr/bin/sddm root 1441 0.0 0.2 776228 16308 tty2 Ssl+ Feb09 0:00 \_ /usr/lib/Xorg -nolisten tcp -background none -seat se root 1754 0.0 0.1 75832 9216 ? S Feb09 0:00 \_ /usr/lib/sddm/sddm-helper --socket /tmp/sddm-auth-a0f rileyb 1775 0.0 0.1 199080 10112 tty1 Ssl+ Feb09 0:00 \_ /usr/bin/startplasma-wayland root 1389 0.0 0.0 12232 3968 ? Ss Feb09 0:00 /usr/lib/bluetooth/bluetoothd root 1394 0.0 0.1 19172 8960 ? Ss Feb09 0:11 /usr/bin/wpa_supplicant -u -s -O /run/wpa_supplicant rileyb 1760 0.0 0.1 21396 7808 ? Ss Feb09 0:02 /usr/lib/systemd/systemd --user rileyb 1762 0.0 0.0 23424 1868 ? S Feb09 0:00 \_ (sd-pam) rileyb 1789 0.0 0.0 8992 3200 ? Ss Feb09 0:00 \_ /usr/bin/dbus-broker-launch --scope user rileyb 1790 0.0 0.0 5248 3200 ? S Feb09 0:03 | \_ dbus-broker --log 4 --controller 10 --machine-id rileyb 1798 0.0 0.1 160564 9472 ? Ssl Feb09 0:00 \_ /usr/bin/kwin_wayland_wrapper --xwayland rileyb 1802 0.5 2.0 2633476 155436 ? Sl Feb09 37:44 | \_ /usr/bin/kwin_wayland --wayland-fd 7 --socket way rileyb 1882 0.2 0.4 559400 36576 ? Sl Feb09 14:26 | \_ /usr/bin/Xwayland :1 -auth /run/user/1000/xau rileyb 1800 0.0 1.3 268743024 100120 ? SNsl Feb09 0:07 \_ /usr/lib/baloo_file rileyb 1813 0.0 0.1 630684 14772 ? Ssl Feb09 0:06 \_ /usr/lib/xdg-desktop-portal rileyb 1823 0.0 0.1 606800 9844 ? Ssl Feb09 0:00 \_ /usr/lib/xdg-document-portal root 1837 0.0 0.0 2496 1664 ? Ss Feb09 0:00 | \_ fusermount3 -o rw,nosuid,nodev,fsname=portal,auto rileyb 1827 0.0 0.0 305588 7088 ? Ssl Feb09 0:01 \_ /usr/lib/xdg-permission-store rileyb 1910 0.0 0.2 767360 18324 ? Ssl Feb09 0:07 \_ /usr/bin/ksmserver rileyb 1912 0.0 0.5 1716908 42436 ? Ssl Feb09 0:53 \_ /usr/bin/kded5 rileyb 1941 0.0 0.3 627968 25080 ? Ssl Feb09 0:03 \_ /usr/lib/kactivitymanagerd rileyb 1957 0.1 2.7 6254184 213732 ? Ssl Feb09 9:49 \_ /usr/bin/plasmashell --no-respawn rileyb 131719 0.8 6.4 34664544 493168 ? Sl Feb12 23:43 | \_ /opt/brave-bin/brave rileyb 131729 0.0 0.3 34215768 29056 ? S Feb12 0:00 | | \_ /opt/brave-bin/brave --type=zygote --no-zygot rileyb 131762 1.2 2.1 34862900 163844 ? Sl Feb12 35:21 | | | \_ /opt/brave-bin/brave --type=gpu-process - rileyb 131730 0.0 0.4 34215760 32128 ? S Feb12 0:00 | | \_ /opt/brave-bin/brave --type=zygote --crashpad rileyb 131732 0.0 0.1 34215788 9128 ? S Feb12 0:00 | | | \_ /opt/brave-bin/brave --type=zygote --cras rileyb 131774 0.0 0.8 34275800 67276 ? Sl Feb12 0:13 | | | \_ /opt/brave-bin/brave --type=utility - rileyb 131795 0.0 1.6 1186547240 129396 ? Sl Feb12 0:04 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131910 0.0 1.7 1186540700 133060 ? Sl Feb12 0:08 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131933 0.2 5.3 1190955140 412780 ? Sl Feb12 5:48 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131985 0.1 3.6 1190945052 278636 ? Sl Feb12 5:10 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 136166 0.1 4.5 1186580952 352996 ? Rl Feb12 3:50 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 140139 0.0 2.3 1188774380 180888 ? Sl Feb12 1:31 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 140744 0.1 4.0 1188752576 307620 ? Sl Feb12 4:01 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 147998 0.0 2.3 1186542776 178920 ? Sl Feb12 0:25 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 164251 0.0 1.4 1186539116 110408 ? Sl Feb13 0:01 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 164260 0.0 1.6 1186542688 129932 ? Sl Feb13 0:02 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 164270 0.0 1.7 1188702828 133488 ? Sl Feb13 0:16 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 165219 0.0 3.3 1186560160 254868 ? Sl Feb13 0:40 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 175887 0.2 3.1 1186582524 239256 ? Sl Feb13 1:51 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 185257 0.1 3.3 1186563108 255524 ? Sl Feb13 0:58 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 185328 0.0 2.7 1186563396 210716 ? Sl Feb13 0:24 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 187462 0.0 3.1 1186578532 238980 ? Sl Feb13 0:30 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 189263 0.0 0.9 1186489800 74872 ? Sl 07:56 0:00 | | | \_ /opt/brave-bin/brave --type=renderer rileyb 131764 0.2 1.6 33993548 124568 ? Sl Feb12 6:53 | | \_ /opt/brave-bin/brave --type=utility --utility rileyb 132002 0.0 0.8 34232612 63956 ? Sl Feb12 0:45 | | \_ /opt/brave-bin/brave --type=utility --utility rileyb 147830 0.0 1.7 1476252 136528 ? Sl Feb12 0:06 | \_ /usr/bin/dolphin rileyb 161710 0.1 1.6 1124272 127796 ? Sl Feb13 1:11 | \_ /usr/bin/kitty rileyb 161719 0.0 0.4 42668 37856 pts/1 Ss+ Feb13 0:23 | \_ /bin/bash --posix rileyb 185343 0.0 0.4 39752 36292 pts/2 Ss Feb13 0:02 | \_ /bin/bash --posix rileyb 187766 0.0 0.1 13704 8448 pts/2 Sl+ Feb13 0:00 | | \_ nvim other.py rileyb 187769 0.0 0.5 47204 42368 ? Ssl Feb13 0:04 | | \_ nvim --embed other.py rileyb 187777 0.0 0.6 284180 53136 ? Ssl Feb13 0:00 | | \_ /home/rileyb/.local/share/nvim/ma rileyb 187791 0.0 0.3 37244 28584 ? S Feb13 0:00 | | \_ /home/rileyb/.local/share/nvi rileyb 187088 0.0 0.4 39784 36476 pts/3 Ss Feb13 0:02 | \_ /bin/bash --posix rileyb 189379 0.0 0.0 11156 4608 pts/3 R+ 07:59 0:00 | \_ ps uaxf rileyb 1973 0.0 0.1 229896 10880 ? Ssl Feb09 0:07 \_ /usr/bin/gmenudbusmenuproxy rileyb 1978 0.0 0.1 985972 14264 ? Ssl Feb09 0:00 \_ /usr/lib/polkit-kde-authentication-agent-1 rileyb 1979 0.0 0.3 981344 24804 ? Ssl Feb09 0:18 \_ /usr/lib/org_kde_powerdevil rileyb 1980 0.0 0.5 1420576 43904 ? Ssl Feb09 0:14 \_ /usr/lib/xdg-desktop-portal-kde rileyb 1982 0.0 0.1 228528 10680 ? Ssl Feb09 0:07 \_ /usr/bin/xembedsniproxy rileyb 1983 0.0 0.0 228984 4612 ? Ssl Feb09 0:00 \_ /usr/lib/dconf-service rileyb 2033 0.0 0.0 108216 5972 ? S

note that there were some 4 tabs open in Kitty at the time, only one hanging. It seems that the kitty processes are the exact same.

ribru17 commented 4 months ago

This may be because of this Kitty option

akinomyoga commented 4 months ago

Ah, I think I found it. I took the diff of your ps uaxf results before and after the hanging tab closes, where essential differences are found to be

@@ -187,6 +187,7 @@
 root      189057  0.0  0.0      0     0 ?        I<   07:54   0:00  \_ [kworker/u17:2-rb_allocator]
 root      189286  0.0  0.0      0     0 ?        I    07:56   0:00  \_ [kworker/6:0-i915-unordered]
 root      189359  0.0  0.0      0     0 ?        I    07:57   0:00  \_ [kworker/5:0]
+root      189372  0.0  0.0      0     0 ?        I    07:59   0:00  \_ [kworker/3:2]
 root           1  0.0  0.1  22792  9080 ?        Ss   Feb09   0:09 /sbin/init
 root         972  0.0  0.2  75620 18916 ?        Ss   Feb09   0:03 /usr/lib/systemd/systemd-journald
 root        1015  0.0  0.0  32624  6612 ?        Ss   Feb09   0:02 /usr/lib/systemd/systemd-udevd
@@ -251,7 +252,7 @@
 rileyb    187777  0.0  0.6 284180 53136 ?        Ssl  Feb13   0:00  |       |           \_ /home/rileyb/.local/share/nvim/ma
 rileyb    187791  0.0  0.3  37244 28584 ?        S    Feb13   0:00  |       |               \_ /home/rileyb/.local/share/nvi
 rileyb    187088  0.0  0.4  39784 36476 pts/3    Ss   Feb13   0:02  |       \_ /bin/bash --posix
-rileyb    189363  0.0  0.0  11156  4608 pts/3    R+   07:57   0:00  |           \_ ps uaxf
+rileyb    189379  0.0  0.0  11156  4608 pts/3    R+   07:59   0:00  |           \_ ps uaxf
 rileyb      1973  0.0  0.1 229896 10880 ?        Ssl  Feb09   0:07  \_ /usr/bin/gmenudbusmenuproxy
 rileyb      1978  0.0  0.1 985972 14264 ?        Ssl  Feb09   0:00  \_ /usr/lib/polkit-kde-authentication-agent-1
 rileyb      1979  0.0  0.3 981344 24804 ?        Ssl  Feb09   0:18  \_ /usr/lib/org_kde_powerdevil
@@ -270,7 +271,6 @@
 root      111511  0.0  0.0 154872  2080 ?        Ss   Feb12   0:01  \_ gpg-agent --homedir /etc/pacman.d/gnupg --use-standar
 rileyb    131721  0.0  0.0 33575736 4648 ?       Sl   Feb12   0:00  \_ /opt/brave-bin/chrome_crashpad_handler --monitor-self
 rileyb    131723  0.0  0.0 33567524 2304 ?       Sl   Feb12   0:00  \_ /opt/brave-bin/chrome_crashpad_handler --no-periodic-
-rileyb    187085  0.0  0.0   2632   640 ?        S    Feb13   0:00  \_ /usr/bin/wl-copy --type text/plain
 rileyb      1774  0.0  0.1 988548 14492 ?        Sl   Feb09   0:00 /usr/bin/kwalletd5 --pam-login 12 14
 root        1809  0.0  0.1 469656  9920 ?        Ssl  Feb09   0:02 /usr/lib/udisks2/udisksd
 polkitd     1828  0.0  0.1 386088 14512 ?        Ssl  Feb09   0:05 /usr/lib/polkit-1/polkitd --no-debug

Then I searched for wl-copy and found this issue: https://github.com/bugaevc/wl-clipboard/pull/154, where the same problem inside kity is reported.

Here, many questions come to my mind: What does that wl-copy do? The start time of wl-copy seems to be the previous day, but the time of ps uaxf is 7:57. This means that the process of wl-copy is alive for eight hours at least. A question is why wl-copy survives for such a long time. Another thing I noticed is that the problematic wl-copy process doesn't seem to have the associated controlling TTY. Maybe that wl-copy process creates a new process session with setsid(2)? But why? I'll look at wl-copy.

edit: I'm not sure how wl-copy could be related to ble.sh. ble.sh doesn't call wl-copy, so the wl-copy process should have been started through some hooks or settings or maybe manually executed.

edit2: Your first report on ps uxf also contains wl-copy, which is consistent. However, @10b14224cc's result https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1926302385 doesn't contain wl-copy, so I think the cause can be different. Maybe another utility is remaining in @10b14224cc's environment.


This may be because of this Kitty option

Thanks for the information. Yeah, that option should be related. However, the behavior with close_on_child_death no (i.e., the terminal doesn't close, even if the child dies, until all the TTY are closed) is a typical one in terminals, so it's not specific to kitty.

ribru17 commented 4 months ago

Ah, I see. Thanks very much for this information!

Edit: wl-copy is used by the wl-clipboard package to copy text to the system clipboard, used by things like Neovim

akinomyoga commented 4 months ago

The author of wl-copy seems to refuse to close the TTY. The author's thought is explained in https://github.com/bugaevc/wl-clipboard/pull/110#issuecomment-785153532. That explanation contains the following phrase:

including after forking into background.

This means that wl-copy has a background process, which partly answers my question. Then, the author tries to keep stderr of the background process connected to the TTY for error logging, but it seems a bit strange to use the TTY for error logging of a background process. A background process should save its error, if any, to a log file instead of the TTY where another application might be in the foreground.


Edit: wl-copy is used by the wl-clipboard package to copy text to the system clipboard, used by things like Neovim

Ah. I see. So it's not necessarily used as a command-line tool but can be a background worker for another program.

akinomyoga commented 4 months ago

I think the culprit in @10b14224cc's environment is hyprpaper. First, there are only two processes that started after the hanging session starts (21265) and before running ps uxf (24438):

[murase@letsnote2019 0 a]$ awk '21265 <= $2 && $2 < 24438' c.txt
USERNAME   23271  0.1  0.2 123496 42436 ?        Sl   07:16   0:00 hyprpaper
USERNAME   23814 16.8  0.2  39400 35780 pts/2    Ss   07:17   0:03  \_ /usr/bin/bash --posix

The Bash process on the second line of the output is another tab where ps uxf was run. Then, the only process is hyprpaper.

Second, hyprpaper is also a Wayland application similar to wl-copy. They probably lose their controlling terminal on wl_display_connect. Both programs call this function to initialize its Wayland session.

Third, hyprpaper has so-called IPC mode (which I guess stands for the interprocess communication mode?), which is enough to suspect that it launches a background worker. In fact, there seems to be a process of hyprpaper running in background in @10b14224cc's ps uxf result.


Also, I think now I can explain why the problem comes out when ble.sh is used. ble.sh internally backs up the file descriptor of the TTY to different numbers, so even if the standard streams are closed by the background process, the backed-up descriptors remain. What is needed is to specify O_CLOEXEC to the backed-up file descriptors so that they are automatically closed in the child processes on their startup, but there is no obvious way to specify O_CLOEXEC at the shell script level.

akinomyoga commented 4 months ago

I discovered that it is possible to add O_CLOEXEC to the specified file descriptor in pure Bash. It hacks the file descriptor that Bash internally uses to back up the original file descriptor for redirection. I implemented it in commit 785267e18c81ada61fb26a346339613a8a8b04e6. The trick only works in Bash >= 4.0, but I think it should be fine for most users. Now I think the hanging tab would happen less.

@10b14224cc @ribru17 Could you update ble.sh by running ble-update and use it for a while to see if the situation changes?

ribru17 commented 4 months ago

Just updated, I will let you know if this fixes it. Thank you!!!

akinomyoga commented 4 months ago

Thanks!

ribru17 commented 4 months ago

I believe this has fixed the issue for me :rocket:

akinomyoga commented 4 months ago

Great! Thank you for the testing and confirmation!

10b14224cc commented 1 month ago

The issue is here once again.

Please re-open.

akinomyoga commented 1 month ago

@10b14224cc

$ ble/widget/display-shell-version

To confirm whether there are remaining processes, after the hanging happens, you can check the process list (e.g. by running ps uxf) in another kitty tab. It would be useful to record the tty name before exiting (or you may log the tty name in the EXIT hook). For example,

# blerc

blehook EXIT+='{ date; echo "pid $$"; tty; } >> ~/debug.txt'

then after the hanging happens, while keeping the hanging window, you can run the following command in another terminal window or tab:

$ date
$ tail -n 3 ~/debug.txt
$ ps uxf

If you could manage to do the above, could you give me the output?

In addition, if the hanging kitty tab would be spontaneously closed after waiting for some time, could you run ps uxf again? If possible, I'd like to compare the results of ps uxf before and after the kitty tab closes.

10b14224cc commented 1 month ago

Q1: What is the current version of ble.sh and Bash in your environment? Could you copy and paste the result of the following command?

❯ ble/widget/display-shell-version
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu) [Arch Linux]
ble.sh, version 0.4.0-devel4+b8d63b7e (noarch) [git 2.45.1, GNU Make 4.4.1, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)]
starship, version 1.19.0 (rustc 1.78.0 (9b00956e5 2024-04-29) (Arch Linux rust 1:1.78.0-1), 2024-05-15 19:07:12 +00:00)
zoxide, version 0.9.4 (/usr/bin/zoxide)
atuin, version 18.2.0 (/usr/bin/atuin)
locale: LANG=en_US.UTF-8 LC_TIME=en_DK.UTF-8
terminal: TERM=xterm-kitty wcwidth=15.0-west/15.1-2+ri, kitty:0 (1;4000;35)

Q2: Can retry the following setup [ which I asked before in https://github.com/akinomyoga/ble.sh/issues/402#issuecomment-1926017866 ] again?

ok will post when it happens again