Swoole v6.3.0 Release Notes
New Features
Platform Support
- Native Windows support: Core capabilities such as the event loop, coroutines, Runtime Hook, and IOCP networking have officially arrived on the Windows platform, along with the addition of a cryptographic random byte source, WebSocket frame class registration, and nghttp2 support under static PHP builds.
/**
* On native Windows, a multi-threaded model is used, so the following classic asynchronous modules and process-management mechanisms are not yet supported:
* Classic asynchronous servers: including Swoole\Server, Swoole\Http\Server, Swoole\WebSocket\Server, and Swoole\Redis\Server.
* Process and task modules: including the task / process worker mechanisms and the Swoole\Process module.
* When doing server-side development on the Windows platform, please fully switch to an architecture that combines Swoole\Coroutine\Http\Server with coroutine-based clients, to ensure the service runs correctly and remains cross-platform compatible.
*/
<?php
use Swoole\Coroutine\Http\Server;
use function Swoole\Coroutine\run;
run(function () {
$server = new Server('127.0.0.1', 9502, false);
$server->handle('/', function ($request, $response) {
$response->end("<h1>Index</h1>");
});
$server->handle('/test', function ($request, $response) {
$response->end("<h1>Test</h1>");
});
$server->handle('/stop', function ($request, $response) use ($server) {
$response->end("<h1>Stop</h1>");
$server->shutdown();
});
$server->start();
});
Coroutines and Threads
- Thread mode now supports internal function entry points and serialized return values, and coroutine preemption is enabled during thread construction.
Swoole\Coroutine::cancel adds a third parameter, which works together with the new Swoole\Coroutine\CanceledException::getReason() method to let the canceled party clearly obtain the "reason for cancellation," providing complete context for resource cleanup and exception logging.
- Coroutine sockets add an
export() method, supporting duplication of the socket file descriptor.
- New
Swoole\SendFile class: introduces a dedicated object describing a "file to be sent." Swoole\Http\Response::sendfile() and Swoole\Server::sendfile() now accept this object, and a new delete_file parameter is added. For business scenarios that "generate a temporary report first and then send it," enabling this parameter causes the file to be automatically deleted once sending is complete, with no need to manually run unlink in application code, greatly simplifying file lifecycle management.
HTTP
- The HTTP client now supports streaming raw request bodies from PHP stream resources, avoiding the need to read the entire payload into memory.
- HTTP/2 stream resets cancel the request coroutine: a new server option
http2_cancel_on_stream_reset (disabled by default, requires enable_coroutine to be enabled) is added. When enabled and the peer sends RST_STREAM to reset a stream, the in-progress request coroutine receives a Swoole\Coroutine\CanceledException, whose reason is an array containing the session_id, stream_id, the HTTP/2 error code, and a message (HTTP2 Stream Reset); if the reset is received while the request is still queued, the callback is skipped directly. Please catch this exception in your request handler—an uncaught one will cause the worker process to exit.
$server->set(['http2_cancel_on_stream_reset' => true]);
$server->on('request', function ($request, $response) {
try {
// When the client cancels the request (e.g., the browser stops loading), the blocking call here will be interrupted
Co::sleep(10);
$response->end('done');
} catch (Swoole\Coroutine\CanceledException $e) {
// The client has already left; just clean up resources—no need to write a response
}
});
- The HTTP/2 client exposes trailing HEADERS frames via
Response::$trailers.
- The HTTP
QUERY method is now supported.
- The coroutine HTTP server supports sending
100 Continue responses.
Components and Extensions
- SSH2 adds
ssh2_set_timeout(), ssh2_keepalive_config(), ssh2_keepalive_send(), and ssh2_send_signal().
Swoole\Table adds five atomic methods—add, update, cmpset, cmpdel, and getdel—further improving the atomicity and safety of data operations in concurrent scenarios.
Swoole\Server now supports specifying service_name and name_resolver (and, when needed, service_address, service_port, and service_heartbeat_interval) through configuration, letting the framework automatically take over service registration, periodic heartbeat keep-alive, re-registration after a Worker restart, and service deregistration on graceful shutdown. Registration state is strictly isolated per Worker, completely resolving the previous problem of stale registration information left behind after a Worker crash and restart.
Bug Fixes
HTTP/2
- Fixed HPACK decoding not terminating at the end of the response headers, as well as errors in CONTINUATION frame and padding handling.
- Fixed the missing frame-length validation: reject GOAWAY frames that are too short, PING frames with an incorrect length, and invalid fixed-length frames, and guard against HTTP2-Bomb-style resource-amplification attacks.
- The connection-level flow-control window is corrected to start from 65535; response writes now add flow-control and send-deadline constraints, and flow-control processing is maintained while GOAWAY drains.
- Fixed coroutine servers where concurrent multi-stream writes blocked one another and the receive loop stopped reading while waiting for writes; stream writes are now scheduled round-robin.
- Fixed write stalls after a stream terminates, worker exits when control frames hit a full buffer, and crashes when releasing an incomplete response.
- When the request body exceeds the limit, only the corresponding stream is reset instead of closing the entire connection; fixed the inability to reuse a connection after resetting an oversized request.
- Fixed client-side send failures occurring during another pending write, and the connection not being closed after a write failure.
- Fixed request trailers and request-body completion states contaminating each other, leakage of duplicate
:path headers, and Content-Type being set too early.
- Fixed an explicit Content-Length being overwritten by the compression logic, sendfile responses not being sent in chunked streaming mode, and sessions not being cleaned up correctly after a fatal request.
HTTP/1 and WebSocket
- Fixed HTTP/1 parsing errors caused by optional whitespace (OWS) in headers and trailing whitespace in chunked encoding.
- Fixed inaccurate chunked request parsing in coroutine servers, non-growing buffers, and the failure to re-parse when the request line was incomplete.
- Fixed handling of request-body boundaries and
100 Continue; HTTP/1.0 requests no longer send 100-continue in error; malformed requests whose header block contains no request headers are now rejected.
- Fixed request fields being lost across multiple parse passes, response header values being corrupted, and incorrect HTTP/1 trailer completion states.
- Fixed a series of security issues in static-file responses; the Date header now uniformly outputs GMT.
- Fixed uploaded file paths being truncated or freed prematurely, multipart temporary-file errors, and loss of over-long temporary directory paths.
- Fixed deflate responses using raw format, package-length-limit underflow, and oversized Upgrade values not being rejected.
- WebSocket: fixed frames being dispatched before the handshake response was sent, unmasking/decompression errors for compressed frames, failed compression-extension negotiation, and uncompressed messages exceeding
package_max_length not being limited.
- WebSocket: fixed double-free and UAF caused by closing the connection inside BASE-mode callbacks, compressed control frames violating RFC 6455, and timed recv incorrectly closing connections under concurrent push on Windows IOCP.
HTTP Client
- Fixed truncated responses at EOF not being rejected, and corrupted or incomplete compressed responses not being detected.
- Fixed multipart fields and uploads being lost after a retry, multipart headers growing and being truncated, and request headers being lost during multipart uploads.
- Fixed 内部工具-state cleanup losing the retry target, connection-close state leaking across requests, and duplicate close calls overwriting the request error.
- Fixed 1xx informational responses not being consumed first, shared arrays being modified without being separated, and unsupported request Transfer-Encoding not being rejected.
- Fixed boundary handling for fragmented HTTP proxy responses and SOCKS5 responses, and rejected unsuccessful WebSocket upgrades.
- Fixed
write_func receiving an un-decompressed response body, and coroutine-client socket initialization errors.
Coroutines and Runtime Hook
- Hooked streams and server TLS now validate peer certificates and hostnames consistently with ext/openssl.
- Fixed hooked-stream writes not applying the timeout, read-timeout errors being lost, and incorrect handling of partial writes and cancellation after partial progress.
- Fixed zero-timeout stream behavior being inconsistent with native, still blocking when the buffer had data, and the error-suppression operator being ineffective.
- Fixed socket-type standard streams not being hooked, mysqlnd failing to recognize hooked Unix sockets, and null bytes in IP addresses not being rejected.
- Fixed
exit/exceptions not being correctly propagated to the ZendVM, coroutine exceptions being lost during SPL directory iteration, and Fiber observer call frames being lost.
- Fixed socket mappings being cleaned up before the fd was released,
accept not using the caller's address buffer, and ssl_sendfile sending too many bytes.
- Fixed precision and cleanup issues in
Coroutine::setTimeLimit(), and support for passing 0 to clear the time limit.
- Fixed external interrupts still being responded to when preemption was disabled, crashes when starting a PHP request in a thread not created by Swoole, and uninitialized global variables under the thread SAPI.
- Fixed the scheduler discarding queued tasks after a coroutine-creation failure, and delayed resumes touching an already-ended EventWaiter.
Server and Process Management
- Fixed worker lifecycle and shutdown ordering: workers exiting on fatal errors not releasing the reactor, out-of-order reload progress, lost reload wake-ups, and shutdown timers not being canceled.
- Fixed task results being lost after asynchronous worker replacement, inconsistent
taskCo/taskWaitMulti result contracts, and task IDs not being shared atomically across workers/threads.
- Fixed incomplete task serialization and illegal task-reply sources being rejected, and the force-kill alarm is now handled synchronously.
- Fixed
cpu_affinity_ignore handling and CPU-affinity ID validation, and configured affinities are now correctly applied to workers.
- Fixed BASE servers not restoring the caller's worker after stop, nested close/buffer callbacks not being deferred, and
session_id not being validated.
- Fixed buffered packets not being parsed after a paused connection resumed, and
onPackage pausing EOF protocol connections causing duplicate deliveries.
- Fixed SSL context initialization, SSL-port
get_port matching, and Port::set() return-value handling.
- Support added for receiving datagram sockets already bound and passed in by systemd; fixed FIN not being sent after the peer shut down on macOS.
Signal Handling
- Fixed signal handling failing after
Pool::start() and after an event-loop restart, and signals arriving during a signal-callback execution being discarded.
- Fixed the original signal action not being restored after removing a listener, and forked child processes inheriting listener state and the manager handler.
- Fixed signal masks being lost when starting background threads, other threads exiting corrupting the main thread's signal handler, and workers executing manager-only handlers.
- Fixed segmentation faults when the manager process called
Process::signal() under thread-context, and SIGCHLD not being registered with the reactor thread.
Process Pool and IPC
- Fixed master system timers not being released after
Pool::start(), and synchronous-worker timers not being dispatched.
- Fixed MessageBus resource release when reused across start cycles and when the owner shut down, as well as listener ownership and partial-startup cleanup.
- Fixed truncated streaming packets and packet-boundary validation, and rejected message-queue keys exceeding the
key_t range and oversized worker_num values.
io_uring and Windows IOCP
- Fixed io_uring SSL-socket error handling;
SSL_ERROR_ZERO_RETURN is now correctly recorded as a connection reset.
- Fixed the confusion between active cancellation and timeouts, link-timeout submissions not being reserved, and requests not being drained after an external wake-up.
- Fixed empty UDP datagrams, splice-event reuse, and sendfile byte ranges not taking effect.
- Fixed detection errors when the kernel major version is greater than 6, relaxed liburing minor-version compatibility, and added runtime validation.
- Fixed Windows IOCP completion errors and stale readiness dispatch; IOCP operations are now drained before PHP close returns.
Sockets and Network Protocols
- Fixed
sendfile offset and file size not being validated, and connections not being closed when a queued sendfile could not start or complete.
- Fixed fragmented packet reception failing under a custom
package_length_func, and reading continuing after the connection was closed inside a callback.
- Fixed out-of-bounds receipt of length-protocol headers, signed overflow in
default_length_func, and EOF delimiters being copied without validation.
- Fixed half-packets being lost after a receive timeout, partial
set configuration overriding the package-length limit, and recvfrom source addresses being lost for empty datagrams.
- Fixed wrong protocol levels for socket options and uninitialized buffers for short replies, and connections not being closed after unrecoverable send errors.
- Fixed rebinding of TCP listen ports, UNIX datagram address ownership, and cleanup of pending-close connections and UNIX paths.
- Fixed the pollfd array size in
swoole_client_select(), references not being released after asynchronous-client callbacks, and socket state not being checked before entering the pool.
Database Coroutinization
- PDO PgSQL: enforce
connect_timeout, fix query waits not being canceled, the failure to try the next host after a blocking-connection timeout, and out-of-bounds reads on empty error messages.
- PDO ODBC: move
SQLCloseCursor/SQLFreeHandle/SQLParamData/SQLDescribeParam into the AIO thread pool for execution, and fix the empty-credential length issue in the connection pool.
- PDO Oracle: fix the security of server-side auxiliary hooks during connection and of repeated statement execution.
- Fixed
PDO::connect() subclass mapping and the build against optional PDO dependencies.
- Redis Server: fix re-parsing of fragmented requests, receive-buffer handling, RESP number and bulk-length boundary validation, and request cleanup.
cURL Hook
- Synchronized the curl fixes already released in php-src for PHP 8.4 (handle copying, response buffering, etc.), while preserving the native handle-lifecycle handler.
- Fixed the lifecycle of resuming queued cURL, PHP stream callbacks running on the wrong thread, and multi-select readiness state being lost.
- On Windows, the curl native hook is now implemented using the VNet AFD_POLL API.
SSH2
- Fixed resource-release lifecycle and ownership, exec-completion metadata, and waiting for shell exit status.
- Fixed SCP reception not stopping on an early EOF,
# and ? being mishandled in SFTP wrapper paths, and the poll direction not being refreshed after EAGAIN.
- Fixed integer overflow in
ssh2_set_timeout(), and hardened API parameter handling.
DNS and Name Resolution
- Fixed c-ares sockets causing worker busy loops due to EPOLLERR, and wrong socket-callback types.
- The DNS request ID now starts from a randomized value and increments sequentially, only responses from DNS servers are accepted, and truncation of resolver addresses is fixed.
Tables, Locks, and Atomic Operations
- Fixed coroutine-lock re-entry counting and unlock ownership validation, and row locks held by live owners being incorrectly released after a force-unlock timeout.
- Fixed
Atomic futex timeouts and nonzero-value behavior, and lost wake-ups after interrupted waits.
- Fixed reentrant parameter conversion in Table and its constructor.
Timers
- Rejected overflowing timer deadlines, and fixed global timers not being removed before release and PHP timers not being cleaned up during the RSHUTDOWN phase.
- Fixed Windows timer interval validation.
Other
- Fixed parameter leaks when thread startup fails, stdio file-descriptor leaks, thread scheduling policies being overridden, and the inability to start without explicitly calling
set().
- Fixed cookies being lost in the FastCGI client and padding response-frame handling.
- Fixed function aliases losing variadic parameters, and the logger and static-file handler using the non-reentrant localtime/gmtime.
- Fixed build issues such as
mkostemp lacking O_CLOEXEC on Android, out-of-tree builds, and trigraph escaping in generated headers.
- Fixed numeric-identifier validation in the Admin API and unauthorized access to reactor-thread information.
Incompatible Changes
- The
stdext module has been removed: PHP language extensions such as strongly-typed arrays and primitive-type methods are no longer built into Swoole; these capabilities are now implemented independently by the project, and code that depends on them needs to be migrated.
- HTTP client response-header names are now uniformly lowercased: the keys of the
$headers array in Swoole\Coroutine\Http\Client are now always converted to lowercase (e.g., Content-Type → content-type); code that reads response headers by their original casing needs to be adjusted.
Swoole v6.3.0 发布说明
新特性
平台支持
- 原生 Windows 支持:事件循环、协程、Runtime Hook、IOCP 网络等核心能力正式登陆 Windows 平台,并补齐加密随机字节源、WebSocket 帧类注册、静态 PHP 下的 nghttp2 支持。
/**
* 在原生 Windows 环境下采用的是多线程模式,以下经典异步模块与进程管理机制暂不受支持:
* 经典异步 Server:包括 Swoole\Server、Swoole\Http\Server、Swoole\WebSocket\Server 以及 Swoole\Redis\Server。
* 进程与任务模块:包括 task / process worker 机制以及 Swoole\Process 模块。
* 在 Windows 平台进行服务端开发时,请全面改用 Swoole\Coroutine\Http\Server 结合 协程客户端 的架构模式,以确保服务的正常运行与跨平台兼容性。
*/
<?php
use Swoole\Coroutine\Http\Server;
use function Swoole\Coroutine\run;
run(function () {
$server = new Server('127.0.0.1', 9502, false);
$server->handle('/', function ($request, $response) {
$response->end("<h1>Index</h1>");
});
$server->handle('/test', function ($request, $response) {
$response->end("<h1>Test</h1>");
});
$server->handle('/stop', function ($request, $response) use ($server) {
$response->end("<h1>Stop</h1>");
$server->shutdown();
});
$server->start();
});
协程与线程
- 线程模式支持内部函数入口与序列化返回值,并在线程构建中启用协程抢占。
Swoole\Coroutine::cancel 新增第三个参数,配合新增的 Swoole\Coroutine\CanceledException::getReason() 方法,使被取消的一方能够明确获取“被取消的原因”,为资源清理与异常日志提供了完整的上下文信息。
- 协程 Socket 新增
export() 方法,支持复制套接字文件描述符。
- 新增
Swoole\SendFile 类:引入专门描述“待发送文件”的对象。Swoole\Http\Response::sendfile() 与 Swoole\Server::sendfile() 现支持接收该对象,并新增 delete_file 参数。针对“先生成临时报表再发送”的业务场景,开启该参数后,文件在发送完成时会自动删除,无需业务代码手动执行 unlink,大幅简化了文件生命周期管理。
HTTP
- HTTP 客户端支持从 PHP 资源流式上传原始请求体,避免整块读入内存。
- HTTP/2 流重置取消请求协程:新增服务器选项 http2_cancel_on_stream_reset(默认关闭,需开启 enable_coroutine)。开启后,对端发送 RST_STREAM 重置流时,正在处理的请求协程会收到 Swoole\Coroutine\CanceledException,其 reason 为包含 session_id、stream_id、HTTP/2 错误 code 与 message(HTTP2 Stream Reset)的数组;请求尚在排队时收到重置则直接跳过回调。请在请求处理器中捕获该异常,未捕获将导致 worker 进程退出。
$server->set(['http2_cancel_on_stream_reset' => true]);
$server->on('request', function ($request, $response) {
try {
// 客户端取消请求(如浏览器停止加载)时,此处的阻塞调用会被中断
Co::sleep(10);
$response->end('done');
} catch (Swoole\Coroutine\CanceledException $e) {
// 客户端已离开,清理资源即可,无需再写响应
}
});
- HTTP/2 客户端
Response::$trailers 暴露尾部 HEADERS 帧。
- 支持 HTTP
QUERY 方法。
- 协程 HTTP 服务器支持发送
100 Continue 响应。
组件与扩展
- SSH2 新增
ssh2_set_timeout()、ssh2_keepalive_config()、ssh2_keepalive_send()、ssh2_send_signal()。
Swoole\Table 补充了 add、update、cmpset、cmpdel、getdel 五个原子方法,进一步提升了并发场景下数据操作的原子性与安全性。
Swoole\Server 现支持通过配置 service_name 与 name_resolver(并按需配置 service_address、service_port、service_heartbeat_interval),由框架自动接管服务注册、周期心跳保活、Worker 重启后的重新注册,以及优雅退出时的服务注销。注册状态按 Worker 严格隔离,彻底解决了以往 Worker 崩溃重启后遗留脏注册信息的问题。
Bug 修复
HTTP/2
- 修复 HPACK 解码未在响应头结束时终止、CONTINUATION 帧与 padding 处理错误的问题。
- 修复帧长度校验缺失:拒绝过短的 GOAWAY、错误长度的 PING、非法的定长帧,并防范 HTTP2-Bomb 类资源放大攻击。
- 连接级流量控制窗口修正为从 65535 起始,响应写出增加流控与发送期限约束,GOAWAY 排空期间保持流控处理。
- 修复协程服务器多流并发写出互相阻塞、接收循环因等待写出而停读的问题,流写出改为轮流调度。
- 修复流终止后写出停滞、控制帧遇到满缓冲区导致 worker 退出、释放未完成响应时崩溃的问题。
- 请求体超限时只重置对应流而不再断开整个连接;修复超大请求重置后连接无法复用。
- 修复客户端在另一写出等待期间发送失败、写失败后未关闭连接的问题。
- 修复请求 trailer 与请求体完成状态互相污染、重复
:path 头泄漏、Content-Type 过早设置的问题。
- 修复显式 Content-Length 被压缩逻辑覆盖、sendfile 响应未分块流式发送、致命请求后会话未正确清理的问题。
HTTP/1 与 WebSocket
- 修复 HTTP/1 头部可选空白(OWS)及 chunked 编码尾部空白导致的解析错误。
- 修复协程服务器 chunked 请求解析不准、缓冲区不增长、请求行不完整时未重新解析的问题。
- 修复请求体边界与
100 Continue 处理,HTTP/1.0 请求不再误发 100-continue;拒绝头块中不含请求头的非法请求。
- 修复多次解析间请求字段丢失、响应头值被破坏、HTTP/1 trailer 完成状态错误的问题。
- 修复静态文件响应的一系列安全问题,Date 头统一输出 GMT。
- 修复上传文件路径被截断或提前释放、multipart 临时文件错误、超长临时目录路径丢失的问题。
- 修复 deflate 响应使用 raw 格式、包长限制下溢、超大 Upgrade 值未拒绝的问题。
- WebSocket:修复握手响应发出前分发帧、掩码压缩帧解包错误、压缩扩展协商失败、解压后消息超过
package_max_length 未限制的问题。
- WebSocket:修复 BASE 模式回调中关闭连接导致的双重释放与 UAF、压缩控制帧违反 RFC 6455、Windows IOCP 下并发 push 时定时 recv 误关连接的问题。
HTTP 客户端
- 修复 EOF 处截断响应未拒绝、损坏或不完整的压缩响应未检测的问题。
- 修复重试后 multipart 字段与上传丢失、multipart 头增长截断、请求头在 multipart 上传中丢失的问题。
- 修复下载状态清理丢失重试目标、连接关闭状态跨请求串扰、重复 close 覆盖请求错误的问题。
- 修复未先消费 1xx 信息响应、共享数组未分离即修改、不支持的请求 Transfer-Encoding 未拒绝的问题。
- 修复分片的 HTTP 代理响应与 SOCKS5 响应边界处理,拒绝不成功的 WebSocket 升级。
- 修复
write_func 收到未解压的响应体、协程客户端套接字初始化错误的问题。
协程与 Runtime Hook
- Hook 流与服务器 TLS 现在与 ext/openssl 一致地校验对端证书与主机名。
- 修复 hook 流写入未应用超时、读超时错误丢失、部分写入与部分进度后取消的处理错误。
- 修复零超时流行为与原生不一致、缓冲区有数据时仍阻塞、错误抑制符无效的问题。
- 修复 socket 型标准流未 hook、mysqlnd 无法识别 hook 后的 Unix socket、IP 地址中 null 字节未拒绝的问题。
- 修复
exit/异常未正确传递到 ZendVM、SPL 目录迭代中协程异常丢失、Fiber 观察器调用帧丢失的问题。
- 修复 socket 映射在 fd 释放前被清理、
accept 未使用调用方地址缓冲区、ssl_sendfile 超量发送的问题。
- 修复
Coroutine::setTimeLimit() 精度与清理问题,支持传 0 清除时间限制。
- 修复抢占禁用时仍响应外部中断、非 Swoole 创建的线程中启动 PHP 请求崩溃、线程 SAPI 下未初始化全局变量的问题。
- 修复调度器在协程创建失败后丢弃排队任务、延迟恢复触碰已结束 EventWaiter 的问题。
服务器与进程管理
- 修复 worker 生命周期与关停顺序:致命错误退出的 worker 未释放 reactor、reload 进度错序、reload 唤醒丢失、关停定时器未取消。
- 修复异步 worker 替换后 task 结果丢失、
taskCo/taskWaitMulti 结果契约不一致、task ID 未跨 worker/线程原子共享的问题。
- 修复拒绝不完整的 task 序列化与非法 task 回复来源,强杀闹钟改为同步处理。
- 修复
cpu_affinity_ignore 处理与 CPU 亲和性 ID 校验,配置的亲和性正确应用到 worker。
- 修复 BASE 服务器 stop 后未恢复调用方 worker、嵌套 close/buffer 回调未延迟执行、
session_id 未校验的问题。
- 修复暂停连接恢复后未解析缓冲包、
onPackage 暂停 EOF 协议连接导致重复投递的问题。
- 修复 SSL 上下文初始化、SSL 端口
get_port 匹配、Port::set() 返回值处理的问题。
- 支持接收 systemd 传入的已绑定数据报套接字;修复 macOS 上对端 shutdown 后未发送 FIN。
信号处理
- 修复
Pool::start() 与事件循环重启后信号处理失效、信号回调执行期间到达的信号被丢弃的问题。
- 修复移除监听器后未恢复原信号动作、fork 子进程继承监听器状态与 manager 处理器的问题。
- 修复后台线程启动丢失信号掩码、其他线程退出破坏主线程信号处理器、worker 执行 manager 专属处理器的问题。
- 修复 thread-context 下 manager 进程调用
Process::signal() 段错误、SIGCHLD 未注册到 reactor 线程的问题。
Process Pool 与 IPC
- 修复
Pool::start() 后 master 系统定时器未释放、同步 worker 定时器不分发的问题。
- 修复 MessageBus 跨 start 复用与属主关停时资源释放、监听器归属与部分启动清理的问题。
- 修复截断的流式包与包边界校验,拒绝超出
key_t 范围的消息队列 key 与过大的 worker_num。
io_uring 与 Windows IOCP
- 修复 io_uring SSL 套接字错误处理,
SSL_ERROR_ZERO_RETURN 正确记录为连接重置。
- 修复主动取消与超时混淆、链接超时提交未预留、外部唤醒后请求未排空的问题。
- 修复空 UDP 数据报、splice 事件复用、sendfile 字节范围不生效的问题。
- 修复内核版本主版本号大于 6 时检测错误,放宽 liburing 次版本兼容并增加运行时校验。
- 修复 Windows IOCP 完成错误与过期就绪分发,PHP close 返回前排空 IOCP 操作。
Socket 与网络协议
- 修复
sendfile 偏移与文件大小未校验、排队 sendfile 无法启动或完成时未关闭连接的问题。
- 修复自定义
package_length_func 下分片包接收失败、回调中 close 连接后继续读取的问题。
- 修复长度协议头接收越界、
default_length_func 有符号溢出、EOF 分隔符未校验即拷贝的问题。
- 修复接收超时后半包丢失、部分 set 配置覆盖包长限制、空数据报
recvfrom 源地址丢失的问题。
- 修复套接字选项协议层级错误与短回复未初始化缓冲区、不可恢复发送错误后未关闭连接的问题。
- 修复 TCP 监听端口重绑定、UNIX 数据报地址归属、待关闭连接与 UNIX 路径清理的问题。
- 修复
swoole_client_select() pollfd 数组尺寸、异步客户端回调后引用未释放、入池前未检查套接字状态的问题。
数据库协程化
- PDO PgSQL:强制执行
connect_timeout,修复查询等待取消、阻塞连接超时后未尝试下一主机、空错误消息越界读取。
- PDO ODBC:
SQLCloseCursor/SQLFreeHandle/SQLParamData/SQLDescribeParam 移入 AIO 线程池执行,修复连接池空凭据长度。
- PDO Oracle:修复连接时服务器附加 hook 与语句重复执行安全。
- 修复
PDO::connect() 子类映射与可选 PDO 依赖构建。
- Redis Server:修复分片请求重解析、接收缓冲区处理、RESP 数字与 bulk 长度边界校验、请求清理。
cURL Hook
- 同步 php-src 已发布的 PHP 8.4 curl 修复(句柄复制、响应缓冲等),保留原生句柄生命周期处理器。
- 修复排队 cURL 恢复的生命周期、PHP 流回调跑错线程、multi select 就绪状态丢失的问题。
- Windows 上改用 VNet AFD_POLL API 实现 curl native hook。
SSH2
- 修复资源释放生命周期与所有权、exec 完成元数据、shell 退出状态等待的问题。
- 修复 SCP 接收在提前 EOF 时未停止、SFTP wrapper 路径中
# 与 ? 被误处理、EAGAIN 后 poll 方向未刷新的问题。
- 修复
ssh2_set_timeout() 整数溢出,加固 API 参数处理。
DNS 与名字解析
- 修复 c-ares 套接字 EPOLLERR 导致 worker 忙循环、socket 回调类型错误的问题。
- DNS 请求 ID 随机化起点并顺序递增,仅接受来自 DNS 服务器的应答,修复解析器地址截断。
Table、锁与原子操作
- 修复协程锁重入计数与 unlock 属主校验、强解锁超时后活持有者的行锁被误释放的问题。
- 修复
Atomic futex 超时与非零值行为、中断等待后唤醒丢失的问题。
- 修复 Table 与构造函数中可重入参数转换的问题。
定时器
- 拒绝溢出的定时器期限,修复全局定时器释放前未摘除、RSHUTDOWN 阶段清理 PHP 定时器的问题。
- 修复 Windows 定时器间隔校验。
其他
- 修复线程启动失败时参数泄漏、stdio 文件描述符泄漏、线程调度策略被覆盖、未显式调用
set() 无法启动的问题。
- 修复 FastCGI 客户端 cookie 丢失与 padding 响应帧处理。
- 修复函数别名丢失可变参数、logger 与静态文件处理器使用非可重入 localtime/gmtime 的问题。
- 修复 Android 上
mkostemp 缺少 O_CLOEXEC、out-of-tree 构建、生成头文件 trigraph 转义等构建问题。
- 修复 Admin API 数字标识符校验与 reactor 线程信息越权访问。
不兼容变更
- 移除
stdext 模块:强类型数组、基础类型方法等 PHP 语言扩展不再由 Swoole 内置,相关能力改由 typephp 项目独立实现,依赖这些功能的代码需要迁移。
- HTTP 客户端响应头名称统一小写:
Swoole\Coroutine\Http\Client 的 $headers 数组键名现在一律转为小写(如 Content-Type → content-type),按原始大小写读取响应头的代码需要调整。