Skip to content

Releases

queue-prefork 1.2.0

Choose a tag to compare

@tevkert tevkert released this 20 Nov 16:17

Apps that run Horizon's supervisors inside the master can now fork their workers too.

  • Supervisors inside the master: some apps run their Horizon supervisors in the master process instead of one process each, which saves a process, and its Redis connections, per supervisor. Until now such an app had to run stock. With QUEUE_PREFORK_HORIZON_INLINE=true, a call to Master::start() in the app's own horizon command and the ForksWorkersFromTemplate trait on its process pool, the template forks those supervisors' workers directly. Every failure falls back to stock workers, as elsewhere. See "Supervisors inside the master" in the README. Apps that don't opt in run exactly as before. Contributed by Volodymyr Shandak (#7).
  • Paused workers after a restart: a Horizon worker paused before its first loop, then continued, came back paused after its next restart (for example after maxJobs or maxTime) and took no jobs until the next pause and continue. It now restarts in the latest state.

Upgrade: composer update tevkert/queue-prefork, then php artisan horizon:terminate (and queue:restart for plain workers) as after any deploy.

Full changelog: v1.1.2...v1.2.0

queue-prefork 1.1.2

Choose a tag to compare

@tevkert tevkert released this 19 Nov 22:00

Error trackers get the whole stack trace of a failed job again.

  • Stack traces in Flare, Sentry and Nightwatch: a forked worker's stack trace ends in the launcher the template was started from, not in artisan. The launcher was a copy outside vendor/, so error trackers counted it as the app's own code. Flare drops every frame above the first frame of the app's code, so for a job failing in vendor code (a package's job, for example) only the launcher was left. Sentry marked it as the app's code, and Nightwatch placed such exceptions there. Templates now start through a link to the package's own bin/template.php, so traces name it in vendor/, and error trackers see the trace as in stock. Reported by Funsho Arashi (#5).

Upgrade: composer update tevkert/queue-prefork, then php artisan horizon:terminate (and queue:restart for plain workers) as after any deploy.

Full changelog: v1.1.1...v1.1.2

queue-prefork 1.1.1

Choose a tag to compare

@tevkert tevkert released this 19 Nov 07:21

A job that calls Artisan::call() no longer gets its worker killed.

  • Workers survive Artisan::call(): Laravel fires CommandFinished for Artisan::call() too, and the package armed its exit watchdog on that event. A job that ran an Artisan command and kept working for more than 15 seconds (exit_grace) had its worker killed mid-job, in Horizon and in plain queue:work alike. The job wasn't marked failed; it ran again after retry_after. The watchdog is now armed when the console kernel terminates, which Laravel does only for the process's own command. Contributed by Ali Gulzar (#4).

Upgrade: composer update tevkert/queue-prefork, then php artisan horizon:terminate (and queue:restart for plain workers) as after any deploy.

Full changelog: v1.1.0...v1.1.1

queue-prefork 1.1.0

Choose a tag to compare

@tevkert tevkert released this 18 Nov 16:55
eefce3f

Horizon prefork works on Horizon 5.51, 5.52 and later 5.x releases, without waiting for a package update.

  • Any Horizon 5 release: prefork no longer turns off on a Horizon minor newer than the last tested one, as it did on 5.51 and 5.52. Instead it checks the Horizon classes it extends:

    • every method it overrides must be declared as in Horizon 5.23–5.52;
    • every method and property it uses must still be there and public.

    If anything differs, Horizon runs stock, and queue-prefork:doctor names what changed.

  • No fatal error from a changed Horizon: the check runs before the package's subclasses load, so a Horizon release that changed a signature makes Horizon run stock instead of stopping it.

  • allow_untested_horizon is removed; it has nothing left to allow, and setting it does nothing.

  • Tested with Horizon 5.52. A new CI workflow checks Packagist daily and runs the full CI, Docker integration suites included, once on each new Horizon release, the day it comes out.

Upgrade: composer update tevkert/queue-prefork, then php artisan horizon:terminate (and queue:restart for plain workers) as after any deploy.

Full changelog: v1.0.5...v1.1.0

queue-prefork 1.0.5

Choose a tag to compare

@tevkert tevkert released this 09 Nov 11:28

Job lines from forked Horizon workers no longer interleave in the log.

  • Whole log lines: forked Horizon processes write to the stdout they share with the master, and queue:work writes each job line in three or four pieces, so with several workers busy the pieces mixed mid-line. That breaks anything that reads the container log line by line: log-based job counts, alerts on FAIL. In the contributor's measurement on a large app, 1,348 of 4,686 job lines (29 %) came out mangled, and none with the fix. Each forked process now holds its stdout until the newline and writes the line in one piece, up to 4 KB. Shared-log queue:work workers get the same. Workers with their own stdout, and stderr everywhere, are as before.
  • README: the line-at-a-time stdout is listed under Limitations and differences from stock.

Thanks to @serpentblade for finding this, measuring it and sending the fix (#1).

Full changelog: v1.0.4...v1.0.5

queue-prefork 1.0.4

Choose a tag to compare

@tevkert tevkert released this 29 Oct 10:47

Laravel Cloud works without extra descriptor settings, and the doctor reads containers correctly.

  • gRPC with fork support: with grpc.enable_fork_support=1 on, a template no longer refuses the epoll set and eventfd that gRPC's poller opens at PHP startup. gRPC rebuilds them in each fork, as it already does its threads. On hosts that load ext-grpc, such as Laravel Cloud, QUEUE_PREFORK_ALLOW_DESCRIPTORS is no longer needed.
  • queue-prefork:doctor:
    • The queue:work line runs the template's extension checks. On hosts with New Relic or with gRPC without fork support, it now says "stock" and gives the reason, where it used to say "prefork".
    • In a container whose command is php artisan horizon or queue:work, that process is PID 1 and runs stock. The doctor now reports this, with the fix: give the container an init (init: true).
    • In shared-log mode, the FFI install line is marked optional.
  • README:
    • a Laravel Cloud section with the settings and measurements. On a Flex 2 GB instance, stock fits 27 Horizon workers and prefork about 200;
    • Docker's init: true for queue containers;
    • the doctor now runs on the server after the deploy.

1.0.2 and 1.0.3 were small fixes, listed in the changelog.

Full changelog: v1.0.3...v1.0.4

v1.0.1

Choose a tag to compare

@tevkert tevkert released this 28 Oct 10:51
  • PHP 8.2 and 8.3: forked processes no longer read their parent's /proc/self. Before PHP 8.4 a fork keeps its parent's realpath cache, so a worker copying its supervisor's ignored signals (as under nohup) read the template's instead of its own. PHP 8.4 and later weren't affected.
  • CI fixes: the test jobs load only the extensions the package needs (the runner's php-zmq holds an eventfd that a template won't fork with), have a 20-minute limit, and the Mechanics tests skip cleanly without FFI.

First release notes: 1.0.0 in the CHANGELOG.