2.0.0: Major release with several potentially breaking changes and a large number of fixes and improvements
Latestgearmand 2.0.0 is a major release with several potentially breaking changes and a large number of fixes and improvements. It significantly improves reliability (especially under load with round-robin/epoch jobs), modernizes the build, and fixes long-standing issues.
Important: This is a major version bump. Review the breaking changes below before upgrading.
Breaking Changes
- Job priority is now global across all functions (PR #431 by @pythonerdog / @huamxu) -- Higher priority jobs are now assigned first globally across all functions. This may affect scheduling behavior for users relying on gearmand 1.x's per-function isolated priorities, but the new behavior is generally considered more desirable and intuitive.
--round-robinis now the default behavior (PR #432 by @esabol) -- This changes how gearmand assigns jobs to workers registered for multiple functions. Previously, workers strongly preferred their first-registered function, causing jobs to be processed in registration order across the pool. With round-robin, gearmand cycles fairly through available workers, providing more even load distribution regardless of function registration order. There is currently no option to disable the new behavior. If you feel there should be, please open an issue on GitHub to request such an enhancement. Again, the new default has long been considered by the gearmand maintainers to be generally more desirable for better utilization in modern deployments. The old behavior could lead to uneven load and was surprising to many users.- Client task list changed to FIFO order (PR #435 by @esabol) -- Libgearman now sends tasks to the gearmand server in the order they are added (FIFO order instead of LIFO). This may affect the order in which tasks are processed by the server, as well as aggregator behavior. Specifically, any Gearman client which uses libgearman and submits multiple tasks in a single job is affected. This change has been requested by users in multiple issues over the years.
Major New Features / Improvements
- Full implementation and stabilization of SUBMIT_JOB_EPOCH support, including proper wakeup timers for sleeping workers, race condition fixes, and shutdown handling (multiple PRs by @p-alik).
- Significant threading, shutdown, and data race fixes (ThreadSanitizer-driven), including double-free prevention, connection handling, and epoch timer synchronization (mostly by @p-alik in numerous PRs)
- Added missing
gearman_worker_set_ssl()API (@esabol). Enables libgearman-based workers to communicate with the gearmand server using SSL/TLS. Note that the client and worker SSL APIs are fully supported by recent (2.2.0 and newer) releases of the PHP Gearman extension when using libgearman 2.0.0 (or newer). - Added support for
gearman_wait()(used by both clients and workers) to optionally stop waiting and returnGEARMAN_IO_WAITwhen interrupted by a signal, instead of ignoring the signal and continuing to wait (PR #231 by @borro).
Notable Bug Fixes
- Fixed gearmand hang on CAN_DO_TIMEOUT with reused connections (PR #448 by @p-alik).
- Added support for reconnecting to PostgreSQL and addressed potential SQL injection vector (PR #453 by @p-alik).
- Fixed HTTP protocol plugin always responding with HTTP/1.0 even when client connects with HTTP/1.1 (PR #455 by @p-alik).
- Fixed "keepalive" network parameters not applying to accepted connections (PR #454 by @p-alik). The gearmand maintainers recommend adding the following command line options when using gearmand for production:
--keepalive --keepalive-idle=300 --keepalive-interval=30 --keepalive-count=5(or similar numerical values). - Fixed double-free race in multi-threaded shutdown (PR #450 by @p-alik).
- Fixed various test hangs/crashes (hostname resolution, round-robin double-close) (PR #451 by @p-alik).
- Fixed long-standing bug in
gearman_task_is_finished()(@esabol). - Fixed log message truncation and error logging levels (PR #443 by @p-alik).
- Fixed
pthread_timedjoin_npdetection on FreeBSD (PR #461 by @p-alik). - Fixed potential double-free of job data on job_queue error path (PR #449 by @p-alik).
- Guard
gearman_log_error()against NULL error strings (PR #476 by @p-alik). - Fixed test-stress hang that was caused by the polling of dead file descriptors and incorrect client task packet matching in
gearman_worker_grab_job()(PR #478 by @p-alik, fixes issue #54).
Build / CI / Maintenance
- Updated 30+ autoconf-archive m4 macros and adapted to API changes (PR #445 by @p-alik).
- Expanded GitHub Actions CI with more compilers, distros, queue backends (PostgreSQL, TokyoCabinet), and retry logic (@esabol, @p-alik).
- Improved Dockerfiles and release packaging (@esabol, @p-alik).
- Updated `gearman_wait() signal handling (Boris Tavadov).
- Dependabot updates and CodeQL improvements (@esabol).
- Updated documentation for global priority behavior (PR #467 by @vibhor-aggr), FIFO task ordering (PR #435 by @esabol), and round-robin default behavior (PR #463 by @esabol).
- Fixed data race in round_robin
--job-retriestest (PR #470 by @p-alik). - Fixed reduce-step ordering test validation by explicitly asserting aggregated content (PR #466 by @p-alik).
- Fixed port-reservation races and leaks in libtest::Server and test helpers (PRs #472 and #475 by @p-alik, fixes issues #471 and #474).
- Modernized documentation for generating SSL certificates to use with gearmand (PR #473 by @esabol).
- Support compiling with clang and add clang builds to CI workflow (PR #480 by @esabol).
- Fixed
get_free_port()byte order and closed a port-restart race int/multi_clienttest to resolve intermittent CI failures (PR #479 by @p-alik).
Contributors
Huge thanks to everyone who contributed to this release, notably:
- Alexei Pastuchov (@p-alik) -- the vast majority of bug fixes, epoch support, threading improvements, making tests more robust (many Co-Authored-By Claude models)
- Ed Sabol (@esabol) -- FIFO task ordering and round-robin changes (PRs #432 and #435), updated docs, CI, packaging, and various fixes
- @pythonerdog and @huamxu -- global job priority change (PR #431)
- Vibhor Aggarwal (@vibhor-aggr), Boris Tavadov, and Clint Byrum
New Contributors
- @borro made their first contribution in #231
- @pythonerdog made their first contribution in #431
- @vibhor-aggr made their first contribution in #467
- @dependabot made their first contribution in #434
Full Changelog: 1.1.22...2.0.0