ble.sh icon indicating copy to clipboard operation
ble.sh copied to clipboard

[kitty] Hangs on exit

Open 10b14224cc opened this issue 1 year ago • 45 comments

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.

10b14224cc avatar Feb 04 '24 17:02 10b14224cc

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.

akinomyoga avatar Feb 04 '24 21:02 akinomyoga

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

10b14224cc avatar Feb 04 '24 23:02 10b14224cc

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 avatar Feb 05 '24 00:02 akinomyoga

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?

akinomyoga avatar Feb 05 '24 00:02 akinomyoga

I've put this:

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

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

10b14224cc avatar Feb 05 '24 06:02 10b14224cc

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?

10b14224cc avatar Feb 05 '24 06:02 10b14224cc

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 avatar Feb 05 '24 06:02 akinomyoga

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.

akinomyoga avatar Feb 05 '24 06:02 akinomyoga

/ 󰌾 
➜ 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<sl 06:37   0:03  \_ /usr/bin/pipewire
USERNAME    4097  1.3  0.3 769524 54808 ?        S<Lsl 06:37   0:31  \_ /usr/bin/wireplumber
USERNAME    4109  0.0  0.3 462140 48328 ?        Ssl  06:37   0:00  \_ /usr/lib/xdg-desktop-portal-hyprland
USERNAME    4153  0.3  0.1 120400 31704 ?        S<Lsl 06:37   0:07  \_ /usr/bin/pipewire-pulse
USERNAME   10248  0.0  0.3 547456 59100 ?        Ssl  07:01   0:00  \_ /usr/bin/python /usr/bin/blueman-applet
USERNAME   12837  0.0  0.0 229116 11272 ?        Ssl  07:03   0:00  \_ /usr/lib/dconf-service

10b14224cc avatar Feb 05 '24 06:02 10b14224cc

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.

akinomyoga avatar Feb 05 '24 06:02 akinomyoga

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

10b14224cc avatar Feb 05 '24 06:02 10b14224cc

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 avatar Feb 05 '24 06:02 akinomyoga

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

  • Q3: You seem to load many configurations in Bash, but can you test if the problem of non-closing tabs can be reproduced with the minimal setup, i.e., with only the ble.sh setting in ~/.bashrc.

akinomyoga avatar Feb 05 '24 22:02 akinomyoga

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

10b14224cc avatar Feb 06 '24 01:02 10b14224cc

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

akinomyoga avatar Feb 09 '24 15:02 akinomyoga

I messed up my kitty installation.

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

So I'm trying other terminals.

10b14224cc avatar Feb 10 '24 10:02 10b14224cc

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

akinomyoga avatar Feb 10 '24 11:02 akinomyoga

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

ribru17 avatar Feb 10 '24 19:02 ribru17

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)?

akinomyoga avatar Feb 10 '24 21:02 akinomyoga

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!

ribru17 avatar Feb 10 '24 22:02 ribru17

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?

akinomyoga avatar Feb 10 '24 23:02 akinomyoga

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<sl Feb09   0:00  \_ /usr/bin/pipewire
rileyb      2034  0.0  0.1  93148  9864 ?        Ssl  Feb09   0:00  \_ /usr/bin/pipewire-media-session
rileyb      2112  0.0  0.0 309368  6072 ?        Ssl  Feb09   0:00  \_ /usr/lib/geoclue-2.0/demos/agent
rileyb      2115  0.0  0.6 770664 51596 ?        Ssl  Feb09   0:04  \_ /usr/bin/kaccess
rileyb      2121  0.0  0.9 1213096 70200 ?       Ssl  Feb09   0:01  \_ /usr/lib/DiscoverNotifier
rileyb      2135  0.1  0.2 2111604 17492 ?       S<sl Feb09   3:03  \_ /usr/bin/pulseaudio --daemonize=no --log-target=journ
rileyb      2239  0.0  0.0 311880  7332 ?        Sl   Feb09   0:00  |   \_ /usr/lib/pulse/gsettings-helper
rileyb      2303  0.0  0.0 33575736 4484 ?       Sl   Feb09   0:00  \_ /opt/brave-bin/chrome_crashpad_handler --monitor-self
rileyb      2305  0.0  0.0 33567524 2304 ?       Sl   Feb09   0:00  \_ /opt/brave-bin/chrome_crashpad_handler --no-periodic-
rileyb      2378  0.0  0.1 382084  8768 ?        Ssl  Feb09   0:00  \_ /usr/lib/at-spi-bus-launcher
rileyb     27019  0.0  0.0   2632   640 ?        S    18:35   0:00  \_ /usr/bin/wl-copy --type text/plain

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'

ribru17 avatar Feb 11 '24 02:02 ribru17

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.

akinomyoga avatar Feb 11 '24 03:02 akinomyoga

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

ribru17 avatar Feb 11 '24 03:02 ribru17

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

Are you by any chance using nnn as file manager?

10b14224cc avatar Feb 14 '24 03:02 10b14224cc

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

ribru17 avatar Feb 14 '24 05:02 ribru17

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.

akinomyoga avatar Feb 14 '24 05:02 akinomyoga

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)

ribru17 avatar Feb 14 '24 05:02 ribru17

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.

akinomyoga avatar Feb 14 '24 06:02 akinomyoga

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

But I cannot reproduce it consistently still.

10b14224cc avatar Feb 14 '24 07:02 10b14224cc