Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sway reload leaves orphaned i3blocks instances #5584

Closed
oqwa opened this issue Jul 28, 2020 · 6 comments · Fixed by #6677
Closed

Sway reload leaves orphaned i3blocks instances #5584

oqwa opened this issue Jul 28, 2020 · 6 comments · Fixed by #6677
Labels
bug Not working as intended

Comments

@oqwa
Copy link

oqwa commented Jul 28, 2020

If I reload sway, recent i3block instance becomes orphaned and thus over time with frequent reloads there are too many of them. I checked i3 and it doesn't do that.

Sway: 1.5.2
i3blocks: 1.5.2
Kernel: x86_64 Linux 5.7.10_1
OS: Void Linux

@oqwa oqwa added the bug Not working as intended label Jul 28, 2020
@emersion
Copy link
Member

Duplicate of #4970?

@oqwa
Copy link
Author

oqwa commented Aug 1, 2020

Not exactly the same. In my case each reload produce one sh process and its child process i3blocks. Wherein recent sh process (if it was) ends, but its child i3blocks process becames orphaned. These orphaned i3blocks processes have exactly the same PIDs as before reloading.

In addition, if I change config to move to another bar (e.g. waybar) from native swaybar+i3blocks and reload then orphaned i3blocks process stays too.

@emersion
Copy link
Member

emersion commented Aug 1, 2020

Hmm. Maybe we're not sending the signal to the process group?

@WeaponX1
Copy link

Hello,

I can reproduce the multiple i3blocks orphaned instances whenever I refresh my sway config.

In addition, I discovered the mouse on-clicks "$BLOCK_BUTTON " does not register the first time swaybar calls i3blocks. I have to exit/restart Sway or refresh the sway config to get the on-click functionality working again (did not have any issues in previous sway versions until now).

i3blocks: 1.5-3
Sway: 1.5-1
Kernel: 5.7.12
OS: Arch

@panaman67
Copy link
Contributor

panaman67 commented Aug 10, 2020

Hello,

I can reproduce the multiple i3blocks orphaned instances whenever I refresh my sway config.

In addition, I discovered the mouse on-clicks "$BLOCK_BUTTON " does not register the first time swaybar calls i3blocks. I have to exit/restart Sway or refresh the sway config to get the on-click functionality working again (did not have any issues in previous sway versions until now).

i3blocks: 1.5-3
Sway: 1.5-1
Kernel: 5.7.12
OS: Arch

I also have been getting the multiple i3blocks instances whenever I refresh my sway config since sway 1.3.
Also have this problem with swaybg. Every time i reload sway config I get a new i3blocks and swaybg instance.

@Zocker1999NET
Copy link

I'm having a similar issue with sway 1.5.3, however mine seems to be an exact duplicate of #4970.
To test it properly, I configured status_command sleep infinity. After a few reloads, htop showed orphan processes which did not existed before:
2020-09-20_19-09-49

LDVG added a commit to LDVG/sway that referenced this issue Nov 21, 2021
Make the status command a process group leader and change the kill(2)
calls to target the new process group. Signals sent by swaybar will then
be received by both the status command and its children, if any. While
here, check the result of fork(2).

Without this, children spawned by the status command may not receive the
signals sent by swaybar. As a result, these children may be orphaned on
reload.

The issue could be shown by setting the bar to

    bar {
        status_command i3status | tee /tmp/i3status.out
    }

which would leave orphaned processes for each reload of sway

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43633   43624 sh -c i3status | tee /tmp/i3status.out
    43634   43633 i3status
    43635   43633 tee /tmp/i3status.out

    $ swaymsg reload

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43634       1 i3status
    43635       1 tee /tmp/i3status.out
    43801   43788 sh -c i3status | tee /tmp/i3status.out
    43802   43801 i3status
    43803   43801 tee /tmp/i3status.out

This fixes swaywm#5584.
emersion pushed a commit that referenced this issue Nov 25, 2021
Make the status command a process group leader and change the kill(2)
calls to target the new process group. Signals sent by swaybar will then
be received by both the status command and its children, if any. While
here, check the result of fork(2).

Without this, children spawned by the status command may not receive the
signals sent by swaybar. As a result, these children may be orphaned on
reload.

The issue could be shown by setting the bar to

    bar {
        status_command i3status | tee /tmp/i3status.out
    }

which would leave orphaned processes for each reload of sway

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43633   43624 sh -c i3status | tee /tmp/i3status.out
    43634   43633 i3status
    43635   43633 tee /tmp/i3status.out

    $ swaymsg reload

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43634       1 i3status
    43635       1 tee /tmp/i3status.out
    43801   43788 sh -c i3status | tee /tmp/i3status.out
    43802   43801 i3status
    43803   43801 tee /tmp/i3status.out

This fixes #5584.
RagnarGrootKoerkamp pushed a commit to RagnarGrootKoerkamp/sway that referenced this issue Mar 29, 2022
Make the status command a process group leader and change the kill(2)
calls to target the new process group. Signals sent by swaybar will then
be received by both the status command and its children, if any. While
here, check the result of fork(2).

Without this, children spawned by the status command may not receive the
signals sent by swaybar. As a result, these children may be orphaned on
reload.

The issue could be shown by setting the bar to

    bar {
        status_command i3status | tee /tmp/i3status.out
    }

which would leave orphaned processes for each reload of sway

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43633   43624 sh -c i3status | tee /tmp/i3status.out
    43634   43633 i3status
    43635   43633 tee /tmp/i3status.out

    $ swaymsg reload

    $ ps o pid,ppid,cmd | grep i3status | grep -v grep
    43634       1 i3status
    43635       1 tee /tmp/i3status.out
    43801   43788 sh -c i3status | tee /tmp/i3status.out
    43802   43801 i3status
    43803   43801 tee /tmp/i3status.out

This fixes swaywm#5584.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

Successfully merging a pull request may close this issue.

5 participants