github swoole/swoole-src v6.0.0

21 hours ago

✨ New Feature:

  • Added multi-threading support, require the ZTS version of PHP. Add --enable-swoole-thread option to the configure command to activate it.
  • Added a new thread class Swoole\Thread. @matyhtf
  • Introduced thread lock Swoole\Thread\Lock. @matyhtf
  • Added thread atomic counter Swoole\Thread\Atomic, Swoole\Thread\Atomic\Long. @matyhtf
  • Added safe concurrent containers Swoole\Thread\Map, Swoole\Thread\ArrayList, Swoole\Thread\Queue. @matyhtf
  • The file asynchronous operation supports using io_uring as the underlying engine for file asynchronous operations. When liburing is installed and Swoole is compiled with the --enable-iouring option, the asynchronous operations of functions such as file_get_contents, file_put_contents, fopen, fclose, fread, fwrite, mkdir, unlink, fsync, fdatasync, rename, fstat, lstat, and filesize will be implemented by io_uring. @matyhtf @NathanFreeman
  • Upgraded Boost Context to version 1.84. Now, Loongson CPUs can also support coroutines. @NathanFreeman
  • Added Swoole\Thread\Map::find() method. @matyhtf
  • Added Swoole\Thread\ArrayList::find() method. @matyhtf
  • Added Swoole\Thread\ArrayList::offsetUnset() method. @matyhtf
  • Added Swoole\Process::getAffinity() method. @matyhtf
  • Added Swoole\Thread::setName() method. @matyhtf
  • Added Swoole\Thread::setAffinity() method. @matyhtf
  • Added Swoole\Thread::getAffinity() method. @matyhtf
  • Added Swoole\Thread::setPriority() method. @matyhtf
  • Added Swoole\Thread::getPriority() method. @matyhtf
  • Added Swoole\Thread::gettid() method.
  • The file asynchronous engine iouring supports multi-threaded polling mode IORING_SETUP_SQPOLL. @NathanFreeman
  • Added iouring_workers to modify the number of iouring threads. @NathanFreeman
  • Added iouring_flags to support modifying the iouring working mode. @NathanFreeman
  • Added Swoole\Thread\Barrier for multi-thread synchronization barrier. @matyhtf
  • Added new function and class to set cookies. @matyhtf @NathanFreeman
  • Added non-blocking, reentrant coroutine mutex lock, which can be used between processes/threads without blocking them. @NathanFreeman
  • Swoole\Coroutine\Socket::getOption() supports the TCP_INFO option. @matyhtf
  • Swoole\Client synchronous blocking client supports http proxy. @matyhtf
  • Added asynchronous non-blocking TCP/UDP/Unix socket client Swoole\Async\Client. @matyhtf
  • Optimized the Swoole\Redis\Server::format() method to support zero-copy memory, support redis nested structure. @matyhtf
  • Supports the high-performance compression tool Zstd. You only need to add --enable-zstd when compiling Swoole, and then zstd can be used to compress or decode responses between the http client and server. @NathanFreeman

🐛 Bug Fixed:

  • Fixed the issue where installation via pecl was not possible. @remicollet
  • Fixed the bug where setting keepalive was not possible for Swoole\Coroutine\FastCGI\Client. @NathanFreeman
  • Fixed the issue where exceeding the max_input_vars would throw an error, causing the process to restart repeatedly. @NathanFreeman
  • Fixed unknown issues caused by using Swoole\Event::wait() within a coroutine. @matyhtf
  • Fixed the problem where proc_open does not support pty in coroutine mode. @matyhtf
  • Fixed segmentation fault issues with pdo_sqlite on PHP 8.3. @NathanFreeman
  • Fixed unnecessary warnings during the compilation of Swoole. @Appla @NathanFreeward
  • Fixed the error thrown by zend_fetch_resource2_ex when STDOUT/STDERR are already closed. @Appla @matyhtf
  • Fixed ineffective set_tcp_nodelay configuration. @matyhtf
  • Fixed the occasional unreachable branch issue during file upload. @NathanFreeman
  • Fixed the problem where setting dispatch_func would cause PHP's internals to throw errors. @NathanFreeman
  • Fixed the deprecation of AC_PROG_CC_C99 in autoconf >= 2.70. @petk
  • Capture exceptions when thread creation fails. @matyhtf
  • Fixed the undefined problem with _tsrm_ls_cache. @jingjingxyk
  • Fixed the fatal compile error with GCC 14. @remicollet
  • Fixed the dynamic property issue in Swoole\Http2\Request. @guandeng
  • Fixed the occasional resource unavailability issue in the pgsql coroutine client. @NathanFreeman
  • Fixed the issue of 503 errors due to not resetting related parameters during process restart. @matyhtf
  • Fixed the inconsistency between $request->server['request_method'] and $request->getMethod() when HTTP2 is enabled. @matyhtf
  • Fixed incorrect content-type when uploading files. @matyhtf
  • Fixed code errors in the http2 coroutine client. @matyhtf
  • Fixed the missing worker_id property in Swoole\Server. @cjavad
  • Fixed errors related to brotli in config.m4. @fundawang
  • Fixed the invalid Swoole\Http\Response::create under multi-threading. @matyhtf
  • Fixed compilation errors in the macos environment. @matyhtf
  • Fixed the issue of threads not being able to exit safely. @matyhtf
  • Fixed the issue where the static variable for response time returned by Swoole\Http\Response in multi-threaded mode was not generated separately for each thread. @matyhtf @NathanFreeman
  • Fixed Fatal error issue caused by PHP-8.4's timeout feature in ZTS mode. @matyhtf
  • Fixed compatibility issue with the exit() hook function for PHP-8.4. @remicollet
  • Fixed the issue where Swoole\Thread::getNativeId() did not work in cygwin. @matyhtf
  • Fixed the issue causing SIGSEGV in Swoole\Coroutine::getaddrinfo() method. @matyhtf
  • Fixed the issue where the runtime TCP module did not support dynamically enabling SSL encryption. @matyhtf
  • Fixed the issue where the HTTP client had an incorrect timeout after running for a long time. @matyhtf
  • Fixed the problem where the mutex lock of Swoole\Table could not be used before the process exited. @matyhtf
  • Fixed the failure of Swoole\Server::stop() when using named parameters. @matyhtf
  • Fixed the crash caused by Swoole\Thread\Map::toArray() not copying the key. @matyhtf
  • Fixed the issue of being unable to delete nested numeric keys in Swoole\Thread\Map. @matyhtf

⭐️ Kernel optimization:

  • Removed unnecessary checks for socket structs. @petk
  • Upgraded Swoole Library. @deminy
  • Added support for status code 451 in Swoole\Http\Response. @abnegate
  • Synchronized file operation code across different PHP versions. @NathanFreeman
  • Synchronized pdo operation code across different PHP versions. @NathanFreeman
  • Optimized the code for Socket::ssl_recv(). @matyhtf
  • Improved config.m4; some configurations can now set library locations via pkg-config. @NathanFreeman
  • Optimized the use of dynamic arrays during request header parsing. @NathanFreeman
  • Optimized file descriptor fd lifecycle issues in multi-threading mode. @matyhtf
  • Optimized some fundamental coroutine logic. @matyhtf
  • Upgraded the Oracle database version for CI testing. @gvenzl
  • Optimized the underlying logic of sendfile. @matyhtf
  • Replaced PHP_DEF_HAVE with AC_DEFINE_UNQUOTED in config.m4. @petk
  • Optimized the logic related to heartbeat, shutdown, and stop for the server in multi-threaded mode. @matyhtf
  • Optimized to avoid linking librt when glibc version is greater than 2.17. @matyhtf
  • Enhanced the HTTP client to accept duplicate request headers. @matyhtf
  • Optimized Swoole\Http\Response::write(). @matyhtf
  • Swoole\Http\Response::write() can now send HTTP/2 protocol. @matyhtf
  • Compatible with PHP 8.4. @matyhtf @NathanFreeman
  • Added the ability for asynchronous writing at the underlying socket level. @matyhtf
  • Optimized Swoole\Http\Response. @NathanFreeman
  • Improved underlying error messages. @matyhtf
  • Supported sharing PHP native sockets in multi-threaded mode. @matyhtf
  • Optimized static file service and fixed static file path error issues. @matyhtf
  • Multi-thread mode SWOOLE_THREAD supports restarting worker threads. @matyhtf
  • Multi-thread mode SWOOLE_THREAD supports starting timers in the Manager thread. @matyhtf
  • Compatible with the curl extension of PHP-8.4. @matyhtf @NathanFreeman
  • Rewrite the underlying Swoole code using iouring. @matyhtf @NathanFreeman
  • Optimized timers so that synchronous processes do not depend on signals. @matyhtf
  • Optimized the Swoole\Coroutine\System::waitSignal() method to allow listening to multiple signals simultaneously. @matyhtf

❌ Deprecated:

  • No longer supports PHP 8.0.
  • No longer supports Swoole\Coroutine\MySQL coroutine client.
  • No longer supports Swoole\Coroutine\Redis coroutine client.
  • No longer supports Swoole\Coroutine\PostgreSQL coroutine client.
  • Removed Swoole\Coroutine\System::fread(), Swoole\Coroutine\System::fwrite(), and Swoole\Coroutine\System::fgets() methods.

😊 Thank you

  • Thank you for your contribution to Swoole v6.0.0. Wish you good health, all the best, and smooth work.

✨ 新特性:

  • Swoole支持多线程模式,当phpzts模式,编译Swoole时开启--enable-swoole-thread时,就能使用多线程模式。
  • 新增创建线程类Swoole\Thread@matyhtf
  • 新增线程锁Swoole\Thread\Lock@matyhtf
  • 新增线程原子计数Swoole\Thread\AtomicSwoole\Thread\Atomic\Long@matyhtf
  • 新增安全并发容器Swoole\Thread\MapSwoole\Thread\ArrayListSwoole\Thread\Queue@matyhtf
  • 文件异步操作支持了使用iouring作为文件异步操作的底层引擎,安装了liburing和编译Swoole时开启--enable-iouringfile_get_contentsfile_put_contentsfopenfclosefreadfwritemkdirunlinkfsyncfdatasyncrenamefstatlstatfilesize这些函数的异步操作将会由iouring实现。 @matyhtf @NathanFreeman
  • 升级Boost Context版本到1.84。现在,龙芯CPU也能够支持协程了。 @NathanFreeman
  • 新增Swoole\Thread\Map::find()方法。 @matyhtf
  • 新增Swoole\Thread\ArrayList::find()方法。 @matyhtf
  • 新增Swoole\Thread\ArrayList::offsetUnset()方法。 @matyhtf
  • 新增Swoole\Process::getAffinity()方法。 @matyhtf
  • 新增Swoole\Thread::setName()方法。 @matyhtf
  • 新增Swoole\Thread::setAffinity()方法。 @matyhtf
  • 新增Swoole\Thread::getAffinity()方法。 @matyhtf
  • 新增Swoole\Thread::setPriority()方法。 @matyhtf
  • 新增Swoole\Thread::getPriority()方法。 @matyhtf
  • 新增Swoole\Thread::gettid()方法。
  • 文件异步引擎iouring支持多线程轮询模式IORING_SETUP_SQPOLL@NathanFreeman
  • 新增iouring_workers修改iouring线程数。 @NathanFreeman
  • 新增iouring_flags支持修改iouring工作模式。 @NathanFreeman
  • 增加Swoole\Thead\Barrier多线程同步屏障。@matyhtf
  • 增加新的设置cookie的函数。 @matyhtf @NathanFreeman
  • 新增`非阻塞,可重入的互斥协程锁”,该锁可以在进程间/线程间使用,且不会阻塞进程/线程。 @NathanFreeman
  • Swoole\Coroutine\Socket::getOption()支持了TCP_INFO选项。 @matyhtf
  • Swoole\Client同步阻塞客户端支持http代理。 @matyhtf
  • 新增异步非阻塞的TCP/UDP/Unixsocket 客户端Swoole\Async\Client@matyhtf
  • 优化Swoole\Redis\Server::format()方法,支持内存零拷贝,支持redis嵌套结构。 @matyhtf
  • 支持高性能压缩工具Zstd,只需要在编译Swoole时加上--enable-zstdhttp客户端和服务端之间便可使用zstd来压缩响应或者解码响应。 @NathanFreeman

🐛 Bug修复:

  • 修复无法通过pecl安装的问题。 @remicollet
  • 修复Swoole\Coroutine\FastCGI\Client客户端无法设置keepalive。 @NathanFreeman
  • 修复请求参数超过max_input_vars时会抛出错误导致进程不断重启的问题。 @NathanFreeman
  • 修复在协程中使用Swoole\Event::wait()导致的未知问题。 @matyhtf
  • 修复proc_open在协程化的时候不支持pty的问题。 @matyhtf
  • 修复pdo_sqlite在PHP8.3会出现段错误的问题。 @NathanFreeman
  • 修复编译Swoole时的无用警告。 @Appla @NathanFreeman
  • 修复如果STDOUT/STDERR已经关闭时,底层调用zend_fetch_resource2_ex会抛出错误。 @Appla @matyhtf
  • 修复无效的set_tcp_nodelay配置。 @matyhtf
  • 修复文件上传的时候偶尔会触发不可达的分支问题。 @NathanFreeman
  • 修复设置了dispatch_func,会导致php底层抛出错误的问题。 @NathanFreeman
  • 修复AC_PROG_CC_C99在autoconf >= 2.70版本中已过时。 @petk
  • 当线程创建失败时,捕获其抛出的异常。 @matyhtf
  • 修复_tsrm_ls_cache未定义问题。 @jingjingxyk
  • 修复在GCC 14编译会导致致命错误。 @remicollet
  • 修复Swoole\Http2\Request动态属性问题。 @guandeng
  • 修复pgsql协程客户端偶发资源不可用的问题。 @NathanFreeman
  • 修复进程重启,没有重置相关参数导致503错误的问题。@matyhtf
  • 修复开启HTTP2时,$request->server['request_method']$request->getMethod() 的结果不一致。 @matyhtf
  • 修复上传文件时,不正确的content-type@matyhtf
  • 修复http2协程客户端的代码错误。 @matyhtf
  • 修复Swoole\Server缺少属性worker_id的问题。 @cjavad
  • 修复config.m4有关brotli错误的问题。 @fundawang
  • 修复 多线程下Swoole\Http\Response::create无效。 @matyhtf
  • 修复macos环境下编译错误。 @matyhtf
  • 修复线程无法安全退出的问题。 @matyhtf
  • 修复多线程模式下,Swoole\Http\Response返回响应时间的静态变量没有各个线程各自生成一份的问题。 @matyhtf @NathanFreeman
  • 修复因为PHP-8.4在ZTS模式下的超时特性引起的Fatal error问题。 @matyhtf
  • 修复PHP-8.4exit()函数hook@remicollet
  • 修复Swoole\Thread::getNativeId()cygwin无法工作的问题。 @matyhtf
  • 修复Swoole\Coroutine::getaddrinfo()方法会导致SIGSEGV的问题。 @matyhtf
  • 修复runtime tcp模块不支持动态开启SSL加密的问题。 @matyhtf
  • 修复http客户端长时间运行导致超时时间不正确的问题。 @matyhtf
  • 修复进程退出之前会导致Swoole\Table的互斥锁无法使用的问题。 @matyhtf
  • 修复使用命名参数导致Swoole\Server::stop()执行失败的问题。 @matyhtf
  • 修复Swoole\Thread\Map::toArray()函数未复制key导致崩溃的问题。 @matyhtf
  • 修复Swoole\Thread\Map无法删除嵌套的数字键的问题。 @matyhtf

⭐️ 内核优化:

  • 移除对socket structs的无用检查。 @petk
  • 升级swoole Library。 @deminy
  • Swoole\Http\Response增加对451状态码的支持。 @abnegate
  • 同步PHP不同版本的文件操作代码。 @NathanFreeman
  • 同步PHP不同版本的pdo操作代码。 @NathanFreeman
  • 优化Socket::ssl_recv()的代码。 @matyhtf
  • 优化了config.m4,一些配置可以通过pkg-config设置依赖库位置。 @NathanFreeman
  • 优化解析请求头的时候使用动态数组的问题 。 @NathanFreeman
  • 优化在多线程模式下,文件描述符fd的生命周期问题。 @matyhtf
  • 优化协程一些基本逻辑。 @matyhtf
  • 升级CI测试的oracle数据库版本。 @gvenzl
  • 优化底层sendfile的相关逻辑。 @matyhtf
  • config.m4中用AC_DEFINE_UNQUOTED替换PHP_DEF_HAVE@petk
  • 优化多线程模式下,server的heartbeat,shutdownstop的相关逻辑。 @matyhtf
  • 优化glibc版本高于2.17时,不需要链接librt@matyhtf
  • 加强http客户端可以接受重复的请求头。 @matyhtf
  • 优化Swoole\Http\Response::write()@matyhtf
  • Swoole\Http\Response::write()现在可以发送http2协议。 @matyhtf
  • 兼容PHP8.4@matyhtf @NathanFreeman
  • 增加底层socket异步写入的能力。 @matyhtf
  • 优化Swoole\Http\Response@NathanFreeman
  • 多线程模式下,支持共享php原生socket@matyhtf
  • 优化静态文件服务,修复静态文件路径错误问题。 @matyhtf
  • 异步Server多线程模式支持重启工作线程。 @matyhtf
  • 异步Server多线程模式支持在Manager线程中开启定时器。 @matyhtf
  • 兼容PHP-8.4curl扩展。 @matyhtf @NathanFreeman
  • 重新封装Swoole底层使用iouring的代码。 @matyhtf @NathanFreeman
  • 优化定时器,使同步进程不依赖于信号。 @matyhtf
  • 优化Swoole\Coroutine\System::waitSignal()方法,允许同时监听多个信号。 @matyhtf

❌ 废弃:

  • 不再支持PHP 8.0
  • 不再支持Swoole\Coroutine\MySQL协程客户端。
  • 不再支持Swoole\Coroutine\Redis协程客户端。
  • 不再支持Swoole\Coroutine\PostgreSQL协程客户端。
  • 移除Swoole\Coroutine\System::fread(), Swoole\Coroutine\System::fwrite()Swoole\Coroutine\System::fgets()方法

😊 致谢

  • 感谢你们为Swoole v6.0.0做出的贡献,祝愿大家身体健康,万事如意,工作顺利。

Don't miss a new swoole-src release

NewReleases is sending notifications on new releases.