✨️ 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全体成员祝您:身体健康,万事如意;步步高升,前程似锦,心想事成,万事顺遂!