Skip to content

nixos/waybar: restart service #77392

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

Closed
wants to merge 1 commit into from

Conversation

erictapen
Copy link
Member

@erictapen erictapen commented Jan 9, 2020

Motivation for this change

Waybar sometimes fails, especially when sway is being started. This should circumvent some headaches.

Things done

Restart waybar automatically after 5 seconds.

Related: #57602

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @FlorianFranzen @minijackson @Synthetica9

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 9, 2020
@minijackson
Copy link
Member

I haven't tried it yet, but it seems fine and pretty useful to me!

@ghost
Copy link

ghost commented Jan 10, 2020

What's the root cause of the failure? I would prefer to solve it upstream than restarting and hoping for the best.

@erictapen
Copy link
Member Author

I haven't identified a single root cause yet. But I observe my waybar sometimes restarting when I change display configuration via kanshi and when sway starts up.

I also think it is best practice to have this kind of service restart automatically. There is no good reason to stop waybar while sway is running and if people still want it for some reason, they can override it.

@FlorianFranzen
Copy link
Contributor

FlorianFranzen commented Jan 20, 2020

@doom3wasagoodgame Waybar still has known bugs that can lead to crashes e.g. Alexays/Waybar#487, Alexays/Waybar#481 and Alexays/Waybar#433.

I would remove the RestartSec = 5 completely as there is no need to wait that long (the default is 100ms). By default the start rate limit stops any restarts that exceed 5 attempt per 10 seconds.

I think a Restart = "on-abnormal" would also be more in our interest, because that is really the case we want to fix here (see man systemd.service 5 for details). Otherwise this change will also restart the bar multiple times on shutdown through clean signals as well as when returning clean or unclean exit codes, e.g. when the config is invalid.

@erictapen erictapen force-pushed the waybar-restart-service branch from 8417e49 to e4af70f Compare January 20, 2020 14:18
waybar sometimes fails, especially when sway is being started. This
should circumvent some headaches.
@erictapen erictapen force-pushed the waybar-restart-service branch from e4af70f to 492f8c2 Compare January 20, 2020 14:43
@erictapen
Copy link
Member Author

@FlorianFranzen Thanks for the hint. I discovered that my waybar doesn't come up when I restart on-abnormal so I changed it back to always. At the moment it fails at first start with

Jan 20 15:31:32 maschine systemd[1616]: Started Waybar as systemd service.
Jan 20 15:31:32 maschine waybar[1637]: cannot open display: 
Jan 20 15:31:32 maschine systemd[1616]: waybar.service: Main process exited, code=exited, status=1/FAILURE
Jan 20 15:31:32 maschine systemd[1616]: waybar.service: Failed with result 'exit-code'.

Otherwise this change will also restart the bar multiple times on shutdown through clean signals as well as when returning clean or unclean exit codes, e.g. when the config is invalid.

That's not something I observed at least. Anyway I think its safer atm to restart it more often than less often.

Regarding RestartSec: I use the default value now.

@stale
Copy link

stale bot commented Jul 18, 2020

Hello, I'm a bot and I thank you in the name of the community for your contributions.

Nixpkgs is a busy repository, and unfortunately sometimes PRs get left behind for too long. Nevertheless, we'd like to help committers reach the PRs that are still important. This PR has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

If this is still important to you and you'd like to remove the stale label, we ask that you leave a comment. Your comment can be as simple as "still important to me". But there's a bit more you can do:

If you received an approval by an unprivileged maintainer and you are just waiting for a merge, you can @ mention someone with merge permissions and ask them to help. You might be able to find someone relevant by using Git blame on the relevant files, or via GitHub's web interface. You can see if someone's a member of the nixpkgs-committers team, by hovering with the mouse over their username on the web interface, or by searching them directly on the list.

If your PR wasn't reviewed at all, it might help to find someone who's perhaps a user of the package or module you are changing, or alternatively, ask once more for a review by the maintainer of the package/module this is about. If you don't know any, you can use Git blame on the relevant files, or GitHub's web interface to find someone who touched the relevant files in the past.

If your PR has had reviews and nevertheless got stale, make sure you've responded to all of the reviewer's requests / questions. Usually when PR authors show responsibility and dedication, reviewers (privileged or not) show dedication as well. If you've pushed a change, it's possible the reviewer wasn't notified about your push via email, so you can always officially request them for a review, or just @ mention them and say you've addressed their comments.

Lastly, you can always ask for help at our Discourse Forum, or more specifically, at this thread or at #nixos' IRC channel.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 18, 2020
@erictapen
Copy link
Member Author

I stopped using Waybar, so I don't really care anymore.

@erictapen erictapen closed this Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants