Skip to content

Conversation

@flokli
Copy link
Contributor

@flokli flokli commented Apr 18, 2025

This prevents the network from being torn down before alloy itself it stopped.

Alloy tries to flush its WAL on SIGTERM, and if the network stack is already down, it tries to flush logs up to 90s during shutdown/reboot.

From https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/:

network.target has very little meaning during start-up. It only
indicates that the network management stack is up after it has been
reached. Whether any network interfaces are already configured when
it is reached is undefined. Its primary purpose is for ordering
things properly at shutdown: since the shutdown ordering of units in
systemd is the reverse of the startup ordering, any unit that is order
After=network.target can be sure that it is stopped before the network
is shut down if the system is powered off. This allows services to
cleanly terminate connections before going down, instead of abruptly
losing connectivity for ongoing connections, leaving them in an
undefined state. […]

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

This prevents the network from being torn down before alloy itself it
stopped.

Alloy tries to flush its WAL on SIGTERM, and if the network stack is
already down, it tries to flush logs up to 90s during shutdown/reboot.

From https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/:

> network.target has very little meaning during start-up. It only
> indicates that the network management stack is up after it has been
> reached. Whether any network interfaces are already configured when
> it is reached is undefined. Its primary purpose is for ordering
> things properly at shutdown: since the shutdown ordering of units in
> systemd is the reverse of the startup ordering, any unit that is order
> After=network.target can be sure that it is stopped before the network
> is shut down if the system is powered off. This allows services to
> cleanly terminate connections before going down, instead of abruptly
> losing connectivity for ongoing connections, leaving them in an
> undefined state. […]
@flokli flokli requested review from azahi and hbjydev April 18, 2025 21:40
@github-actions github-actions 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: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 18, 2025
@flokli flokli requested a review from arianvp April 19, 2025 14:01
@flokli flokli merged commit 8ee81a2 into NixOS:master Apr 19, 2025
31 of 35 checks passed
@flokli flokli deleted the alloy-network-target branch April 19, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants