github rapira-rs/rapira v0.10.0

one hour ago

0.10.0 (2026-12-03)

⚠️ Breaking Changes

  • 🧹 Single-Process ZTS Worker Threads: Replaced forked NTS worker processes with ZTS PHP worker threads in one server process. Release packages and container images now ship ZTS PHP. Self-hosted builds that run more than one worker or more than one pool must link ZTS PHP (--enable-zts --disable-zend-signals); NTS builds allow one pool and clamp workers to 1. Running more than one worker with OPcache enabled requires PHP 8.4.29, 8.5.14, 8.6.1, or later, #334.
  • 🧹 Server and Pool Configuration: Renamed [supervisor] to [server], process_control_timeout_secs to stop_timeout_secs, and [<plugin>.pool].processes to workers. Removed [<plugin>.pool].max_memory_mb and [http].io_threads. Update rapira.toml because unknown keys fail startup, #334.
  • 🧹 Relative Unix Socket Paths: Relative unix: listen paths in [http], [grpc], and [observability] now resolve against the directory of rapira.toml instead of the current working directory. Update relative paths or use absolute socket paths, #334.
  • 🧹 Observability Metrics: Removed rapira_worker_exits_total, rapira_worker_rss_bytes, and rapira_worker_pss_bytes because workers run as threads in one process. Remove these series from Prometheus dashboards and alerts, #334.
  • 🧹 Docker Images and Bundled Extensions: ghcr.io/rapira-rs/rapira:php8.x is now a complete Debian Trixie image with ZTS PHP instead of a scratch payload for COPY --from. Removed the redis extension because it is unsafe under ZTS PHP. Update Dockerfiles to base on ghcr.io/rapira-rs/rapira:php8.x or :php8.x-distroless, #321, #334, #346.
  • 🧹 gRPC Response Metadata Ownership: $call->getResponseMetadata() now returns the call object itself (UnaryCall or ServerStreamingCall). Do not keep a reference to the returned object after finalizing the call, #275.
  • 🧹 HTTP Content-Length Validation: Exchange::writeHead() now throws \ValueError when content-length repeats or is not a non-negative integer, #355.

🎯 Core

  • ✨ Pool Environment Variables: Added [http.pool.env] and [grpc.pool.env] tables with thread-local putenv() isolation. Pool variables populate $_SERVER, $_ENV, getenv(), and ${NAME} in php.ini, #300, #334.
  • ✨ Execution Timer Clock: Added [<plugin>.pool].execution_clock with "wall" (default) and "cpu" modes. "cpu" measures per-thread CPU time on Linux ZTS builds so I/O waits do not consume max_execution_time, #336.
  • ✨ Boot Failure Backoff: Added [<plugin>.pool].max_boot_failures (default 5, 0 disables the limit). Failed worker boots back off from 500 ms to 5 s and stop the server with exit code 70 if reached before the pool serves a request, #299.
  • ✨ Object Inspection API: Added \Rapira\count_objects() and \Rapira\get_objects(array $classes = []) to inspect live PHP objects without creating strong references, #305.
  • ✨ Request Watchdog: Reserved SIGRTMAX for the per-request watchdog and exited with code 124 only when every worker in a pool remains blocked past the five-second grace period, #334.
  • 🐛 Reloads and OPcache: Coordinated opcache_reset() across worker threads on SIGHUP/SIGUSR2, resolved symlinked deployment entrypoints per app instance, and handled OPcache scheduled restarts without killing workers, #288, #289, #290, #334.
  • 🐛 Session and Shutdown Handling: Saved active PHP sessions before sending responses, reported uncaught exceptions from register_shutdown_function() in worker mode, entered the entrypoint directory per worker thread, and reported the loaded libphp version in X-Powered-By, #286, #287, #296, #334.
  • 🐛 PHP 8.6 and 8.7 Compatibility: Added support for PHP 8.6 and tracked php-src master changes, including zero-copy POST bodies via pre_request_init, #322, #343, #355.
  • ⚡ Worker Scheduling and Boot: Woke the most recently parked worker first for queued work and cached constant $_SERVER entries once per worker, #303, #334.

📦 rapira pack and VFS

  • ✨ Application Packing: Added rapira pack <APP_DIR> -o <PATH> to embed a PHP application, rapira.toml, and optional --php-ini into a 64-bit ELF or Mach-O rapira executable with zstd compression and SHA-256 verification, #351.
  • ✨ In-Memory /app VFS: Packed executables on PHP 8.5+ mount the application read-only at /app in memory, supporting PHP stream wrappers, stat, glob, SplFileInfo/SplFileObject, opcache.preload, open_basedir, StaticFiles, Exchange::sendFile(), and gRPC schema/token files, #351, #355.
  • ✨ Extract Directory Mode: Added --extract-dir <DIR> and RAPIRA_EXTRACT_DIR to extract a packed bundle atomically to disk for PHP 8.4 or disk-backed deployments, #351.
  • ⚡ VFS Performance: Dropped the compressed bundle before serving, eliminated per-lookup allocations in Vfs::lookup and Vfs::glob, and mixed the bundle digest into zend_system_id for opcache.file_cache, #351.

📦 http plugin

  • ✨ HTTP Middleware and Compression: Added a shared HTTP middleware interface and built-in compress middleware (middleware = ["compress"] and [http.compress]) supporting zstd and gzip content negotiation, #334.
  • ⚡ Sharded I/O and Streaming Bodies: Replaced multi-process accept loops with dedicated single-threaded LocalSet I/O shards, streamed multipart parsing and raw php://input bodies directly from transport chunks, and wrote large writeBody() chunks in place, #271, #272, #274, #334.
  • 🐛 Spool, Sendfile, and Connection Hardening: Cleaned stale upload spool directories on startup, isolated /app VFS and host sendFile() roots, skipped queued classic units when clients disconnect, enforced Host/body limits, and hardened connection draining, #260, #285, #332, #351, #355.

📦 grpc plugin

  • ✨ Server-Streaming RPCs: Added server-streaming support via ServerStreamingCall::respond(\Generator) across gRPC, binary gRPC-Web, and Connect streaming, with MethodKind, HeadersAlreadyCommittedError, cancellation via WorkDiscardedException, and nested respond() protection, #312, #355.
  • ✨ Remote Descriptor Sets: Loaded [grpc].descriptor_set from http:// and https:// URLs at startup with system CA verification, Basic auth redaction, proxy variables, and a 64 MiB limit, #306.
  • ✨ Reserved REST Protocol Case: Declared Rapira\Grpc\Call\Protocol::Rest as a reserved extension point on the protocol enum, #304.
  • 🐛 Security and Deadlines: Compared SHA-256 bearer token digests in constant time in grpc.auth and enforced call deadlines before accepting responses and across complete streams, #312, #355.

📦 static_files middleware

  • 🐛 Symlink Confinement and Rename Detection: Confined static file symlinks to the configured root without traversing dot-prefixed or forbidden targets on both disk and /app VFS, and tracked inode and device IDs to detect atomic renames with identical mtime and length, #284, #355.
  • ⚡ Shared Cache: Shared the file cache across the single server process with RwLock, dispatched the VFS backend once at construction, and matched forbidden suffixes without allocating, #334, #351.

📊 Observability

  • ✨ In-Process Observability: Moved /metrics, /livez, and /readyz to a dedicated thread inside the server process and counted host-refused units in rapira_requests_total and rapira_requests_failed_total, #334.

📦 Packages and Docker Images

  • ✨ Static Linux Binaries: Added static single-binary Linux release archives (-static.tar.gz) for PHP 8.5 and PHP 8.6 (x86_64 and aarch64) linking libphp.a, exporting PHP symbols for dlopen() extensions, and probing host CA certificate bundles automatically, #347, #350.
  • ✨ Distroless Container Images: Added non-root Distroless images (php8.4-distroless, php8.5-distroless, php8.6-distroless) built on gcr.io/distroless/cc-debian13:nonroot, #346.
  • ✨ PHP 8.6 and Automatic Base Rebuilds: Added PHP 8.6 release packages, tarballs, and container images, and automated image rebuilds when upstream PHP or Distroless base images update, #321, #322, #346.
  • 🐛 Package Dependencies: Updated RPM packages to depend on the libssl.so.3 soname and required OpenSSL 3.3 and RHEL 9.7 glibc for PHP 8.6 packages, #324, #332.

Don't miss a new rapira release

NewReleases is sending notifications on new releases.