Releases: swoole/swoole-src
v6.2.0
✨️ New Features
- Added coroutine-based
FTPclient. By including the--enable-swoole-ftpoption during compilation, coroutine support forFTPoperations can be enabled, avoiding network blocking. - Added coroutine-based
SSHclient. By including the--with-swoole-ssh2option during compilation, coroutine support forSSHoperations can be enabled, improving concurrency efficiency. - Added support for
io_uringin theHTTPcoroutine server. TheHTTPcoroutine server can now utilize the high-performanceio_uringevent mechanism. Enable it by adding the--enable-uring_socketoption during compilation for better I/O performance. - Added the
Swoole\RemoteObject\Servermodule, providing transparent coroutine operation support forMongoDB. - Added the
Swoole\Coroutine::setTimeLimit()function to control coroutine execution timeout, preventing coroutines from occupying resources for extended periods. - Added
URLrewriting support for theHTTPstatic file server. - Added coroutine support for
pdo_firebird. - Added support for
PHP 8.5. - Added coroutine support for the
gethostbynamefunction. - Optimized the implementation of
Server::shutdown(), replacing signal communication with pipe communication inProcessmode. - In the callback functions of Swoole's HTTP servers (including Swoole\Http\Server, Swoole\Http2\Server, and Swoole\Coroutine\Http\Server), the
serverproperty of theSwoole\Http\Requestobject now includes theserver_addrfield, which identifies the server's IP address. - Swoole\Coroutine::cancel now supports canceling all
iouringoperations.
SSHandFTPcoroutine clients cannot coexist with PHP'sext-sshandext-ftp. To enable these features, you must disable PHP'ssshandftpextensions.
🐛 Bug Fixes
- Fixed an issue where HTTP2 server sessions were released multiple times in a multi-threaded environment.
- Fixed an issue in version
8.5whererefresh_memory_manager()must be executed after forking a child process or creating a child thread; otherwise, the program would crash. - Fixed an issue where the
swoole_get_local_macfunction could not work properly onmacOSsystems. - Fixed a crash issue that could occur when manually suspending coroutines in a multi-threaded environment.
- Fixed a compilation error on Alpine systems.
- Fixed a memory leak issue when function hooking failed.
- Fixed thread safety issues during the coroutine conversion process for
pdo_sqliteandpdo_oci. - Fixed the
sw_php_print_backtracefunction to ensure its output format matches the backtrace information of PHP's built-in functions. - Fixed compilation failures caused by enabling
--enable-uring-socket,--enable-trace-log, and--enable-error-log. - Fixed the issue where
pdo_firebirdcould not be compiled due to undefined macros.
🛠️ Optimizations
- Running
php --ri swoolenow outputs the version information oflibpq. - Optimized the
io_uringrelated logic in file coroutine operations. - Added PHP call stack information output when event addition fails.
- Optimized the implementation code for
swoole_get_local_ipandswoole_get_local_macfunctions. - Optimized the coroutine waiting time for file locks, avoiding exponentially increasing sleep times that made locks increasingly difficult to acquire.
- Improved compatibility with the
Androidplatform.
📢 Notes
- Removed the
--enable-opensslcompilation option; support forOpenSSLis now included by default. --enable-uring-socketrequires explicitly specifying either--enable-iouringor--with-liburing-dir.- No longer supports
PHP 8.1. - The minimum required version of
liburingis 2.8.
✨️ 新特性
- 新增协程化
FTP客户端,现通过编译时加入--enable-swoole-ftp选项,即可启用FTP操作的协程化支持,避免网络阻塞 - 新增协程化
SSH客户端,现通过编译时加入--with-swoole-ssh2选项,即可启用SSH操作的协程化支持,提升并发效率 - 新增
HTTP协程服务端支持io_uring,HTTP协程服务端现可选用高性能的io_uring事件机制。在编译时加入--enable-uring_socket选项即可启用,以获得更优的 I/O 性能 - 新增
Swoole\RemoteObject\Server模块,为MongoDB提供透明化的协程操作支持 - 新增
Swoole\Coroutine::setTimeLimit()函数,用于控制协程执行超时时间,防止协程长时间占用资源 - 为
HTTP静态文件服务器添加URL重写支持 - 新增对
pdo_firebird的协程化支持 - 支持
PHP 8.5 - 支持协程化
gethostbyname函数 - 优化
Server::shutdown()的实现,在Process模式下将信号通信替换为管道通信 - 在 Swoole 的 HTTP 服务器(包括 Swoole\Http\Server、Swoole\Http2\Server 和 Swoole\Coroutine\Http\Server)的回调函数中,Swoole\Http\Request 对象的 server 属性新增了 server_addr 字段,该字段用于标识服务端的 IP 地址
- Swoole\Coroutine::cancel 现支持取消所有
iouring操作
SSH、FTP协程客户端与PHP的ext-ssh、ext-ftp无法共存,若要开启此项特性,需禁用PHP的ssh和ftp扩展
🐛 Bug修复
- 修复 HTTP2 服务器会话(session)在多线程环境下发生多次释放的问题
- 修复在
8.5版本中,子进程fork或者子线程生成后需执行refresh_memory_manager(),否则将导致程序崩溃的问题 - 修复
macOS系统中swoole_get_local_mac函数无法正常工作的问题 - 修复了在多线程环境下用户手动挂起协程时可能引发的崩溃问题
- 修复在 Alpine 系统下的编译错误
- 修复函数钩子(hook)调用失败时的内存泄漏问题
- 修复
pdo_sqlite和pdo_oci协程化过程中的线程安全问题 - 修复
sw_php_print_backtrace函数,使其输出与 PHP 内置函数的回溯信息格式保持一致 - 修复因启用 --enable-uring-socket、--enable-trace-log 和 --enable-error-log 导致的编译失败问题
- 修复因为宏定义不存在的问题,导致
pdo_firebird无法编译的问题
🛠️ 优化
- 执行
php --ri swoole会输出libpq的版本信息 - 优化文件协程化操作中的
io_uring相关逻辑 - 在添加事件失败时输出 PHP 调用堆栈信息
- 优化
swoole_get_local_ip和swoole_get_local_mac函数的实现代码 - 优化文件锁的协程化等待时间,避免指数递增的睡眠时间导致锁越来越难获取
- 提升了对
Android平台的兼容性
📢 注意
- 移除了
--enable-openssl编译选项,现在默认包含对OpenSSL的支持 --enable-uring-socket需要明确指定--enable-iouring或者--with-liburing-dir其中一个- 不再支持
PHP8.1 liburing要求的最低版本是2.8
v6.2.0-rc2
✨️ New Features
- Added coroutine-based
FTPclient. By including the--enable-swoole-ftpoption during compilation, coroutine support forFTPoperations can be enabled, avoiding network blocking. - Added coroutine-based
SSHclient. By including the--enable-swoole-sshoption during compilation, coroutine support forSSHoperations can be enabled, improving concurrency efficiency. - Added support for
io_uringin theHTTPcoroutine server. TheHTTPcoroutine server can now utilize the high-performanceio_uringevent mechanism. Enable it by adding the--enable-uring_socketoption during compilation for better I/O performance. - Added the
Swoole\RemoteObject\Servermodule, providing transparent coroutine operation support forMongoDB. - Added the
Swoole\Coroutine::setTimeLimit()function to control coroutine execution timeout, preventing coroutines from occupying resources for extended periods. - Added
URLrewriting support for theHTTPstatic file server. - Added coroutine support for
pdo_firebird. - Added support for
PHP 8.5. - Added coroutine support for the
gethostbynamefunction. - Optimized the implementation of
Server::shutdown(), replacing signal communication with pipe communication inProcessmode. - In the callback functions of Swoole's HTTP servers (including Swoole\Http\Server, Swoole\Http2\Server, and Swoole\Coroutine\Http\Server), the
serverproperty of theSwoole\Http\Requestobject now includes theserver_addrfield, which identifies the server's IP address. - Swoole\Coroutine::cancel now supports canceling all
iouringoperations.
SSHandFTPcoroutine clients cannot coexist with PHP'sext-sshandext-ftp. To enable these features, you must disable PHP'ssshandftpextensions.
🐛 Bug Fixes
- Fixed an issue where HTTP2 server sessions were released multiple times in a multi-threaded environment.
- Fixed an issue in version
8.5whererefresh_memory_manager()must be executed after forking a child process or creating a child thread; otherwise, the program would crash. - Fixed an issue where the
swoole_get_local_macfunction could not work properly onmacOSsystems. - Fixed a crash issue that could occur when manually suspending coroutines in a multi-threaded environment.
- Fixed a compilation error on Alpine systems.
- Fixed a memory leak issue when function hooking failed.
- Fixed thread safety issues during the coroutine conversion process for
pdo_sqliteandpdo_oci. - Fixed the
sw_php_print_backtracefunction to ensure its output format matches the backtrace information of PHP's built-in functions. - Fixed compilation failures caused by enabling
--enable-uring-socket,--enable-trace-log, and--enable-error-log. - Fixed the issue where
pdo_firebirdcould not be compiled due to undefined macros.
🛠️ Optimizations
- Running
php --ri swoolenow outputs the version information oflibpq. - Optimized the
io_uringrelated logic in file coroutine operations. - Added PHP call stack information output when event addition fails.
- Optimized the implementation code for
swoole_get_local_ipandswoole_get_local_macfunctions. - Optimized the coroutine waiting time for file locks, avoiding exponentially increasing sleep times that made locks increasingly difficult to acquire.
- Improved compatibility with the
Androidplatform.
📢 Notes
- Removed the
--enable-opensslcompilation option; support forOpenSSLis now included by default. --enable-uring-socketrequires explicitly specifying either--enable-iouringor--with-liburing-dir.- No longer supports
PHP 8.1. Swoole 6.2.0 RC2is currently a release candidate version and can only be used in testing environments. It is prohibited to use it in production environments.
🎉 Chinese Lantern Festival greetings
Today is the Chinese Lantern Festival. All members of Swoole wish you: good health, all the best; may you keep improving, have a bright future, achieve your dreams, and enjoy smooth success in everything!
✨️ 新特性
- 新增协程化
FTP客户端,现通过编译时加入--enable-swoole-ftp选项,即可启用FTP操作的协程化支持,避免网络阻塞 - 新增协程化
SSH客户端,现通过编译时加入--enable-swoole-ssh选项,即可启用SSH操作的协程化支持,提升并发效率 - 新增
HTTP协程服务端支持io_uring,HTTP协程服务端现可选用高性能的io_uring事件机制。在编译时加入--enable-uring_socket选项即可启用,以获得更优的 I/O 性能 - 新增
Swoole\RemoteObject\Server模块,为MongoDB提供透明化的协程操作支持 - 新增
Swoole\Coroutine::setTimeLimit()函数,用于控制协程执行超时时间,防止协程长时间占用资源 - 为
HTTP静态文件服务器添加URL重写支持 - 新增对
pdo_firebird的协程化支持 - 支持
PHP 8.5 - 支持协程化
gethostbyname函数 - 优化
Server::shutdown()的实现,在Process模式下将信号通信替换为管道通信 - 在 Swoole 的 HTTP 服务器(包括 Swoole\Http\Server、Swoole\Http2\Server 和 Swoole\Coroutine\Http\Server)的回调函数中,Swoole\Http\Request 对象的 server 属性新增了 server_addr 字段,该字段用于标识服务端的 IP 地址
- Swoole\Coroutine::cancel 现支持取消所有
iouring操作
SSH、FTP协程客户端与PHP的ext-ssh、ext-ftp无法共存,若要开启此项特性,需禁用PHP的ssh和ftp扩展
🐛 Bug修复
- 修复 HTTP2 服务器会话(session)在多线程环境下发生多次释放的问题
- 修复在
8.5版本中,子进程fork或者子线程生成后需执行refresh_memory_manager(),否则将导致程序崩溃的问题 - 修复
macOS系统中swoole_get_local_mac函数无法正常工作的问题 - 修复了在多线程环境下用户手动挂起协程时可能引发的崩溃问题
- 修复在 Alpine 系统下的编译错误
- 修复函数钩子(hook)调用失败时的内存泄漏问题
- 修复
pdo_sqlite和pdo_oci协程化过程中的线程安全问题 - 修复
sw_php_print_backtrace函数,使其输出与 PHP 内置函数的回溯信息格式保持一致 - 修复因启用 --enable-uring-socket、--enable-trace-log 和 --enable-error-log 导致的编译失败问题
- 修复因为宏定义不存在的问题,导致
pdo_firebird无法编译的问题
🛠️ 优化
- 执行
php --ri swoole会输出libpq的版本信息 - 优化文件协程化操作中的
io_uring相关逻辑 - 在添加事件失败时输出 PHP 调用堆栈信息
- 优化
swoole_get_local_ip和swoole_get_local_mac函数的实现代码 - 优化文件锁的协程化等待时间,避免指数递增的睡眠时间导致锁越来越难获取
- 提升了对
Android平台的兼容性
📢 注意
- 移除了
--enable-openssl编译选项,现在默认包含对OpenSSL的支持 --enable-uring-socket需要明确指定--enable-iouring或者--with-liburing-dir其中一个- 不再支持
PHP8.1 Swoole6.2.0RC2目前是测试版本,只能在测试环境使用,禁止在生产环境使用
🎉 元宵节祝贺
今天是中国元宵佳节,Swoole全体成员祝您:身体健康,万事如意;步步高升,前程似锦,心想事成,万事顺遂!
v6.1.7
🐛 Bug Fixed
- Fixed an issue where improper configuration of the exponential backoff algorithm caused some coroutines to be unable to acquire locks for extended periods.
- Added timeout control mechanism for the pdo_pgsql coroutine implementation to improve database operation stability.
- Fixed an issue where Domain and Path parameters were specified when clearing a cookie but were not included in the actual response, preventing the cookie from expiring properly.
🐛 Bug 修复
- 修复了因指数退避算法配置不当,导致部分协程长期无法获取锁的问题。
- 为基于 pdo_pgsql 的协程实现增加了超时控制机制,以提升数据库操作的稳定性。
- 修复了在清空 Cookie 时,虽然指定了 Domain 和 Path 参数,但实际响应中未携带这两个属性,导致 Cookie 无法正常过期的问题。
v6.2.0-rc1
✨️ New Features
- Added coroutine-based
FTPclient. By including the--enable-swoole-ftpoption during compilation, coroutine support forFTPoperations can be enabled, avoiding network blocking. - Added coroutine-based
SSHclient. By including the--enable-swoole-sshoption during compilation, coroutine support forSSHoperations can be enabled, improving concurrency efficiency. - Added support for
io_uringin theHTTPcoroutine server. TheHTTPcoroutine server can now utilize the high-performanceio_uringevent mechanism. Enable it by adding the--enable-uring_socketoption during compilation for better I/O performance. - Added the
Swoole\RemoteObject\Servermodule, providing transparent coroutine operation support forMongoDB. - Added the
Swoole\Coroutine::setTimeLimit()function to control coroutine execution timeout, preventing coroutines from occupying resources for extended periods. - Added
URLrewriting support for theHTTPstatic file server. - Added coroutine support for
pdo_firebird. - Added support for
PHP 8.5. - Added coroutine support for the
gethostbynamefunction. - Optimized the implementation of
Server::shutdown(), replacing signal communication with pipe communication inProcessmode. - In the callback functions of Swoole's HTTP servers (including Swoole\Http\Server, Swoole\Http2\Server, and Swoole\Coroutine\Http\Server), the
serverproperty of theSwoole\Http\Requestobject now includes theserver_addrfield, which identifies the server's IP address.
SSHandFTPcoroutine clients cannot coexist with PHP'sext-sshandext-ftp. To enable these features, you must disable PHP'ssshandftpextensions.
🐛 Bug Fixes
- Fixed an issue where HTTP2 server sessions were released multiple times in a multi-threaded environment.
- Fixed an issue in version
8.5whererefresh_memory_manager()must be executed after forking a child process or creating a child thread; otherwise, the program would crash. - Fixed an issue where the
swoole_get_local_macfunction could not work properly onmacOSsystems. - Fixed a crash issue that could occur when manually suspending coroutines in a multi-threaded environment.
- Fixed a compilation error on Alpine systems.
- Fixed a memory leak issue when function hooking failed.
- Fixed thread safety issues during the coroutine conversion process for
pdo_sqliteandpdo_oci. - Fixed the
sw_php_print_backtracefunction to ensure its output format matches the backtrace information of PHP's built-in functions.
🛠️ Optimizations
- Running
php --ri swoolenow outputs the version information oflibpq. - Optimized the
io_uringrelated logic in file coroutine operations. - Added PHP call stack information output when event addition fails.
- Optimized the implementation code for
swoole_get_local_ipandswoole_get_local_macfunctions. - Optimized the coroutine waiting time for file locks, avoiding exponentially increasing sleep times that made locks increasingly difficult to acquire.
- Improved compatibility with the
Androidplatform.
📢 Notes
- Removed the
--enable-opensslcompilation option; support forOpenSSLis now included by default. --enable-uring-socketrequires explicitly specifying either--enable-iouringor--with-liburing-dir.- No longer supports
PHP 8.1. Swoole 6.2.0 RC1is currently a release candidate version and can only be used in testing environments. It is prohibited to use it in production environments.
🧧 Chinese New Year greetings
Today is the first day of the Chinese New Year. At this moment of bidding farewell to the old and welcoming the new, the entire Swoole team extends our sincerest New Year blessings to you! We wish you good health, flourishing career, abundant wealth, and all your endeavors success in the new year! Thank you for your continued support and companionship. We look forward to joining hands with you to create an even more exciting future!
✨️ 新特性
- 新增协程化
FTP客户端,现通过编译时加入--enable-swoole-ftp选项,即可启用FTP操作的协程化支持,避免网络阻塞 - 新增协程化
SSH客户端,现通过编译时加入--enable-swoole-ssh选项,即可启用SSH操作的协程化支持,提升并发效率 - 新增
HTTP协程服务端支持io_uring,HTTP协程服务端现可选用高性能的io_uring事件机制。在编译时加入--enable-uring_socket选项即可启用,以获得更优的 I/O 性能 - 新增
Swoole\RemoteObject\Server模块,为MongoDB提供透明化的协程操作支持 - 新增
Swoole\Coroutine::setTimeLimit()函数,用于控制协程执行超时时间,防止协程长时间占用资源 - 为
HTTP静态文件服务器添加URL重写支持 - 新增对
pdo_firebird的协程化支持 - 支持
PHP 8.5 - 支持协程化
gethostbyname函数 - 优化
Server::shutdown()的实现,在Process模式下将信号通信替换为管道通信 - 在 Swoole 的 HTTP 服务器(包括 Swoole\Http\Server、Swoole\Http2\Server 和 Swoole\Coroutine\Http\Server)的回调函数中,Swoole\Http\Request 对象的 server 属性新增了 server_addr 字段,该字段用于标识服务端的 IP 地址
SSH、FTP协程客户端与PHP的ext-ssh、ext-ftp无法共存,若要开启此项特性,需禁用PHP的ssh和ftp扩展
🐛 Bug修复
- 修复 HTTP2 服务器会话(session)在多线程环境下发生多次释放的问题
- 修复在
8.5版本中,子进程fork或者子线程生成后需执行refresh_memory_manager(),否则将导致程序崩溃的问题 - 修复
macOS系统中swoole_get_local_mac函数无法正常工作的问题 - 修复了在多线程环境下用户手动挂起协程时可能引发的崩溃问题
- 修复在 Alpine 系统下的编译错误
- 修复函数钩子(hook)调用失败时的内存泄漏问题
- 修复
pdo_sqlite和pdo_oci协程化过程中的线程安全问题 - 修复
sw_php_print_backtrace函数,使其输出与 PHP 内置函数的回溯信息格式保持一致
🛠️ 优化
- 执行
php --ri swoole会输出libpq的版本信息 - 优化文件协程化操作中的
io_uring相关逻辑 - 在添加事件失败时输出 PHP 调用堆栈信息
- 优化
swoole_get_local_ip和swoole_get_local_mac函数的实现代码 - 优化文件锁的协程化等待时间,避免指数递增的睡眠时间导致锁越来越难获取
- 提升了对
Android平台的兼容性
📢 注意
- 移除了
--enable-openssl编译选项,现在默认包含对OpenSSL的支持 --enable-uring-socket需要明确指定--enable-iouring或者--with-liburing-dir其中一个- 不再支持
PHP8.1 Swoole6.2.0RC1目前是测试版本,只能在测试环境使用,禁止在生产环境使用
🧧 新春祝贺
今天是中国农历新年大年初一,在这辞旧迎新的美好时刻,Swoole团队全体成员向您致以最诚挚的新春祝福!愿新的一年里,您身体健康,事业蒸蒸日上,财源滚滚而来,万事顺遂,心想事成!感谢您一直以来的支持与陪伴,期待与您携手共创更加精彩的未来!
v6.1.6
🐛 Bug Fixed
- Fix the issue where the
finishattribute remainsfalsewhen receiving continuous frames inwebsocket. - Fix compilation warnings generated when using the
--enable-swoole-sqlitecompilation option. - Automatically remove HOOK_SOCKETS from the runtime hook flags when the ext-sockets extension is detected as not enabled.
🐛 Bug修复
- 修复
websocket接收连续帧时finish属性始终为false的问题。 - 修复使用
--enable-swoole-sqlite编译选项时产生的编译警告。 - 当检测到未启用 ext-sockets 扩展时,自动从运行时钩子标志中移除 HOOK_SOCKETS。
v6.1.5
🐛 Bug Fixes
- Fixed a crash issue when users manually suspend coroutines in a multithreaded environment
- Fixed the issue where the
System::socket_poll()function incorrectly closed sockets after failing to add events - Fixed decompression failure in
WebSocketwhen compressing message frames, caused by certain server environments not supportingMAX_MEM_LEVEL=9 - Fixed data reception errors in
WebSocketwhen receiving consecutive compressed data frames, caused by the buffer not being cleared in time - Fixed the
data raceissue in thepdo_ocicoroutine client when processing non-PDO_PARAM_LOBdata
⭐️ Optimizations
- In
Http Server, when developers set theContent-Encodingheader,Swoolewill no longer automatically compress the response body. Instead, developers need to implement compression logic themselves and output the corresponding content.
🗑 Removals
- Removed the
PDO::sqliteCreateAggregate(),PDO::sqliteCreateCollation(), andPDO::sqliteCreateFunction()functions in the coroutine environment. Their implementation principle involves calling PHP functions as callbacks in thesqlite3engine, which is only feasible in single-threaded synchronous blocking mode. InSwoolecoroutine mode, theCfunctions ofsqlite3need to run in asynchronousAIOthreads. In theZTSversion, this can cause null pointer reads, while in theNTSversion, it may lead todata raceissues and occasional crashes. - Removed support for the
open_basedirsetting in thepdo_sqlitecoroutine client. It is unsafe to readPG(open_basedir)in a multithreaded environment. Ensure that thesqlite3database file path is a constant or other safe path. Do not use user input parameters as part of thesqlitedatabase file path.
🐛 Bug修复
- 修复多线程环境下用户手动挂起协程的崩溃问题
- 修复
System::socket_poll()函数添加事件失败后,错误关闭套接字的问题 - 修复
WebSocket压缩消息帧时部分服务器环境不支持MAX_MEM_LEVEL=9导致解压失败的问题 - 修复
WebSocket接收解压格式连续数据帧时,因缓冲区未及时清空而导致后续数据接收错误的问题 - 修复
pdo_oci协程客户端处理非PDO_PARAM_LOB数据时的data race问题
⭐️ 优化
- 在
Http Server中,当开发者设置了Content-Encoding头部时,Swoole将不再对响应体进行自动压缩,而需要由开发者自行实现压缩逻辑并输出相应内容。
🗑 移除
- 移除协程环境下
PDO::sqliteCreateAggregate()、PDO::sqliteCreateCollation()、PDO::sqliteCreateFunction()函数,其实现原理是将PHP函数作为回调在sqlite3引擎中调用,这些特性仅在单线程同步阻塞模式中可用,而Swoole协程模式下,需要将sqlite3的C函数置于异步的AIO线程中运行。在ZTS版本中会出现读取空指针,而在NTS下则会出现data race,引起偶发崩溃的问题 - 移除
pdo_sqlite协程客户端对open_basedir设置的支持,在多线程环境中无法安全读取PG(open_basedir),请务必保证sqlite3的数据库文件路径为常量或者其他安全的路径,不可使用用户输入的参数作为sqlite数据库文件路径的一部分
v6.1.4
🐛 Bug Fixes
- Fix the memory leak issue in the curl module.
🐛 Bug 修复
- 修复curl模块内存泄漏的问题。
v6.1.3
Release Notes
🐛 Bug Fixes
HTTP/2 Server
- Fixed Safari Compatibility Issue: Resolved a flow control compatibility issue when the HTTP/2 server sends large files to Safari browsers.
- Fixed Data Race in Cached
DateResponse Header: Fixed a data race condition in the cachedDateresponse header for the HTTP/2 server in multi-threaded mode. - Fixed
package_max_lengthConfiguration Not Taking Effect:- The server now returns a
413 Payload Too Largeerror if theContent-Lengthin the receivedHEADERSframe exceeds the configured value. - The server sends an
HTTP/2 RST_STREAMframe to terminate the stream if the total length of consecutively receivedDATAframes exceeds the configured value.
- The server now returns a
- Fixed Memory Out-of-Bounds in Multi-threaded Coroutine Mode: Resolved a memory out-of-bounds issue when enabling
enable_reuse_portin the multi-threaded coroutine version of the HTTP/2 server. - Fixed TLS Variable Destruction Issue: Fixed a
double freeissue occurring during the destruction of TLS (Thread Local Storage) variables upon thread exit in the multi-threaded HTTP/2 server.
Redis Server
- Fixed packet assembly anomalies in
Redis\Server::format()when processing large strings.
WebSocket Server
- Fixed Control Frame Data Contamination: Resolved an issue where automatically replied
ping/pong/closecontrol frames from the WebSocket server carried residual data from previous text or binary frames due to uncleared buffers.
Multi-threading Related
- Fixed Data Race in
swoole_get_task_tmpdir(): Resolved a data race condition when calling this function in a multi-threaded environment. - Fixed Memory Out-of-Bounds Access in Runtime Hooks: Fixed memory out-of-bounds access triggered when setting runtime hooks in a multi-threaded environment.
⚠️ Important Change: Runtime hooks can now only be set in the main thread and must be configured before creating any child threads.
Platform Compatibility
- Fixed FreeBSD Compilation Failure: Resolved compilation failures on FreeBSD systems.
✨ Enhancements
- Added Android Platform Support: Improved compatibility with the Android platform; now supported in Termux environments.
- Synchronized Updates from PHP 8.x curl Module: Adapted relevant updates from the
curlextension in PHP versions 8.1, 8.2, and 8.3.
Note: This update includes several critical fixes for multi-threaded mode. Users utilizing multi-threaded mode are strongly advised to upgrade as soon as possible.
更新记录
🐛 Bug 修复
HTTP/2 服务器
- 修复 Safari 浏览器兼容性问题:解决 HTTP/2 服务器在向 Safari 浏览器发送大文件时的流量控制兼容性问题
- 修复 Date 响应头缓存的数据竞争:解决多线程模式下 HTTP/2 服务器的
Date响应头缓存存在的数据竞争问题 - 修复
package_max_length配置未生效:- 当接收的
Header帧中Content-Length超过配置值时,服务器将返回413 Payload Too Large错误 - 当连续接收的
Data帧总长度超过配置值时,服务器将发送HTTP/2 RST_STREAM帧终止流
- 当接收的
- 修复多线程协程模式下的内存越界:解决多线程模式协程版
HTTP/2服务器开启enable_reuse_port时发生的内存越界问题 - 修复
TLS变量销毁问题:解决多线程模式HTTP/2服务器在线程退出时TLS (Thread Local Storage)变量销毁时发生的double free问题
Redis 服务器
- 修复
Redis\Server::format()处理大字符串出现的组包异常问题
WebSocket 服务器
- 修复控制帧数据污染问题:解决
WebSocket服务端自动回复的ping/pong/close控制帧因未清空缓存,导致携带前一个文本帧或二进制帧残留数据的问题
多线程相关
- 修复
swoole_get_task_tmpdir()数据竞争:解决多线程环境下调用该函数时存在的数据竞争问题 - 修复运行时钩子的内存越界访问:解决多线程环境下设置运行时钩子时触发的内存越界访问问题
⚠️ 重要变更:运行时钩子现在仅允许在主线程中设置,且必须在创建任何子线程之前完成设置
平台兼容性
- 修复 FreeBSD 编译失败:解决在 FreeBSD 系统下的编译失败问题
✨ 功能增强
- 新增 Android 平台支持:提升在 Android 平台的兼容性,现已支持在 Termux 环境下运行
- 同步 PHP 8.x curl 模块更新:适配 PHP 8.1、8.2 及 8.3 版本中
curl扩展的相关更新
注意事项:本次更新包含多项多线程模式下的关键修复,建议使用多线程模式的用户尽快升级。
v6.1.2
- No longer throw warnings when failing to set the
socketreceive/send buffer size - Fixed an issue in
Swoole\Http\Serverwhere theonClosecallback might execute beforeonRequestwhen handlingHTTP2requests, leading to a use-after-free problem - Optimized the
getSocket()method by duplicating the file descriptor when exporting thephp socketsresource object, preventingphp socketsfrom affecting thesocketheld bySwooleupon closure - Fixed a memory leak issue in
Swoole\Async\Client - Fixed an issue where
Swoole\Coroutine\Http\ClientofIPv6type could not useSocks5proxy - Synchronized updates to adapt to relevant changes in the
CURLextension inPHP 8.4 - Added the
async.file://file protocol, which allows enabling coroutine scheduling for specific file operations even when global file coroutine support is disabled
use function Swoole\Coroutine\run;
// Disable global file coroutine support but enable coroutine operations for specific files via the `async.file://` protocol
Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE);
run(function() {
$fp = fopen("async.file:///home/test", "r");
fwrite($fp, "data");
fclose($fp);
$content = file_get_contents("async.file:///home/test.txt");
});This feature is designed for scenarios where global file system coroutine HOOK is disabled, but asynchronous read/write scheduling is required for specific file operations.
简体中文
- 设置
socket接收/发送缓冲区尺寸失败时不再抛出警告 - 修复
Swoole\Http\Server处理HTTP2请求时,onClose回调可能先于onRequest执行,导致释放后使用(use-after-free)的问题 - 优化
getSocket()方法,导出php sockets资源对象时复制文件描述符,避免php sockets关闭时影响Swoole持有的socket - 修复
Swoole\Async\Client内存泄漏问题 - 修复
IPv6类型Swoole\Coroutine\Http\Client无法使用Socks5代理的问题 - 同步适配
PHP 8.4中CURL扩展的相关更新 - 新增
async.file://文件协议,支持在未开启全局文件协程化时,对指定文件操作启用协程调度
use function Swoole\Coroutine\run;
// 禁用全局文件协程化,但可通过 `async.file://` 协议对特定文件启用协程操作
Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE);
run(function() {
$fp = fopen("async.file:///home/test", "r");
fwrite($fp, "data");
fclose($fp);
$content = file_get_contents("async.file:///home/test.txt");
});该特性用于在禁用全局文件系统协程 HOOK后,对部分文件操作进行异步读写调用的场景。
v6.1.1
- Fixed a compilation failure caused by missing
zlibdependency. - Optimized the resource management logic in the
curlmodule to prevent use-after-free risks. - Resolved the absence of
fdatasyncon macOS systems. - Improved the log output format for coroutine deadlock detection.
简体中文
- 修复因为缺少
zlib依赖导致编译失败的问题。 - 优化
curl模块的资源管理逻辑,以规避释放后再次使用的风险。 - 修复
macos系统没有fdatasync的问题。 - 优化协程死锁检测日志输出格式。