Skip to content

nixos/phpfpm: set systemd Type to notify-reload when possible#434262

Open
aanderse wants to merge 2 commits into
NixOS:masterfrom
aanderse:nixos/phpfpm
Open

nixos/phpfpm: set systemd Type to notify-reload when possible#434262
aanderse wants to merge 2 commits into
NixOS:masterfrom
aanderse:nixos/phpfpm

Conversation

@aanderse

@aanderse aanderse commented Aug 16, 2025

Copy link
Copy Markdown
Member

Things done

as promised in #430490 (comment) adding notify-reload support

from php-fpm documentation:

systemd_interval int

When FPM is build with systemd integration, specify the interval, in second, between health report notification to systemd. Set to 0 to disable. Default value: 10.

i browsed through the php-fpm source and basically if this option isn't 0 then php-fpm will write READY=1\n to the systemd socket every n seconds as defined in config... which means incidentally notify-reload will work


btw... @roberth any idea what is going on here? did something change or was this error missed somehow in the last PR? when i run nix-build -A nixosTests.php.fpm-modular i get this error:

       error: The option `nodes.machine.system.services.php-fpm.meta' does not exist. Definition values:
       - In `/home/aaron/nixpkgs/pkgs/development/interpreters/php/service.nix':
           {
             maintainers = [
               {
                 email =
  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nix-owners nix-owners Bot requested review from Ma27, drupol, globin, jtojnar and talyz August 16, 2025 15:54
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 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/` 6.topic: php PHP is a general-purpose scripting language geared towards web development. labels Aug 16, 2025
@roberth

roberth commented Aug 19, 2025

Copy link
Copy Markdown
Member

error: The option `nodes.machine.system.services.php-fpm.meta' does not exist.

Working on a better implementation, but #435005 will take care of the error in the meantime.

Comment thread nixos/modules/services/web-servers/phpfpm/default.nix Outdated
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 28, 2025

@Ma27 Ma27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM.

@roberth

roberth commented Aug 31, 2025

Copy link
Copy Markdown
Member

You might also be able to set WatchdogSec=, maybe derived from the php interval (times 2?), and/or vice versa.

(not a blocker)

@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 2, 2025

@Ma27 Ma27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I deploy this to a relatively normal Nextcloud installation, the reload runs into a timeout:


Sep 05 08:29:10 cloud php-fpm[1779427]: [NOTICE] Reloading in progress ...
Sep 05 08:29:10 cloud systemd[1]: Reloading PHP FastCGI Process Manager service for pool nextcloud...
Sep 05 08:29:10 cloud php-fpm[1779427]: [NOTICE] reloading: execvp("/nix/store/7c9pia7r4vvjb28lmndm46pkzqdc65wv-php-with-extensions-8.3.24/bin/php-fpm", {"/nix/store/7c9pia7r4vvjb28lmndm46pkzqdc65wv-php-with-extensions-8.3.24/bin/php-fpm", "-y", "/nix/store/c6lm1hzg6v4ygiinvw6s3inprp6ksxx1-phpfpm-nextcloud.conf", "-c", "/nix/store/xpq174hpbllkiw7hgryi43k91433ssxg-php.ini"})
Sep 05 08:29:10 cloud php-fpm[1779427]: [NOTICE] using inherited socket fd=7, "/run/phpfpm/nextcloud.sock"
Sep 05 08:29:10 cloud php-fpm[1779427]: [NOTICE] using inherited socket fd=7, "/run/phpfpm/nextcloud.sock"
Sep 05 08:29:10 cloud php-fpm[1779427]: [NOTICE] fpm is running, pid 1779427
Sep 05 08:29:11 cloud php-fpm[1779427]: [NOTICE] ready to handle connections
Sep 05 08:29:11 cloud php-fpm[1779427]: [NOTICE] systemd monitor interval set to 10000ms
[...]
Sep 05 08:29:56 cloud systemd[1]: phpfpm-nextcloud.service: Reload operation timed out. Killing reload process.
Sep 05 08:29:56 cloud systemd[1]: Reload failed for PHP FastCGI Process Manager service for pool nextcloud.

The reload signal was correctly handled given the logs, but apparently the sd_notify isn't happening?

Did you have some special configuration that made it work for you and we're probably missing in nixpkgs?

This is btw not a Nextcloud-specific thing, I can reproduce this with other phpfpm installations as well.

Blocking for now to prevent accidental merges until this is resolved.

@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 14, 2025
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 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 6.topic: php PHP is a general-purpose scripting language geared towards web development. 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.

3 participants