Skip to content

Commit

Permalink
release v6.0.0 (#5623)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman authored Dec 16, 2024
1 parent 6700e99 commit 3e1a1f8
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 47 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PROJECT(libswoole)
cmake_minimum_required(VERSION 2.8.12)

ENABLE_LANGUAGE(ASM)
set(SWOOLE_VERSION 6.0.0RC1)
set(SWOOLE_VERSION 6.0.0)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")
Expand Down
108 changes: 108 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,113 @@
# Swoole Changelog

## 2024-12-16 v6.0.0
# ✨ 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.
## 2024-01-24 v5.1.2
- Added support for embed sapi @matyhtf
- Fixed compatibility with PHP 8.3 ZEND_CHECK_STACK_LIMIT @Yurunsoft
Expand Down
64 changes: 36 additions & 28 deletions ext-src/php_swoole_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/

/* $Id: 1bb86a633f720da45a4d4347f23ff7755c968221 */
/* $Id: f0118343cf7d61224924b4899d173b2877f14c91 */

#ifndef SWOOLE_LIBRARY_H
#define SWOOLE_LIBRARY_H
Expand Down Expand Up @@ -259,10 +259,19 @@ static const char* swoole_library_source_core_constant =
"\n"
" public const OPTION_AIO_MAX_IDLE_TIME = 'aio_max_idle_time';\n"
"\n"
" /**\n"
" * @since 6.0.0-beta\n"
" */\n"
" public const OPTION_IOURING_ENTRIES = 'iouring_entries';\n"
"\n"
" /**\n"
" * @since 6.0.0-rc1\n"
" */\n"
" public const OPTION_IOURING_WORKERS = 'iouring_workers';\n"
"\n"
" /**\n"
" * @since 6.0.0-rc1\n"
" */\n"
" public const OPTION_IOURING_FLAG = 'iouring_flag';\n"
"\n"
" public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
Expand Down Expand Up @@ -1420,7 +1429,7 @@ static const char* swoole_library_source_core_array_object =
" */\n"
" public function natcasesort(): self\n"
" {\n"
" if (natcasesort($this->array) !== true) {\n"
" if (natcasesort($this->array) !== true) { // @phpstan-ignore notIdentical.alwaysFalse\n"
" throw new \\RuntimeException('natcasesort() failed');\n"
" }\n"
" return $this;\n"
Expand All @@ -1431,7 +1440,7 @@ static const char* swoole_library_source_core_array_object =
" */\n"
" public function natsort(): self\n"
" {\n"
" if (natsort($this->array) !== true) {\n"
" if (natsort($this->array) !== true) { // @phpstan-ignore notIdentical.alwaysFalse\n"
" throw new \\RuntimeException('natsort() failed');\n"
" }\n"
" return $this;\n"
Expand All @@ -1442,7 +1451,7 @@ static const char* swoole_library_source_core_array_object =
" */\n"
" public function rsort(int $sort_flags = SORT_REGULAR): self\n"
" {\n"
" if (rsort($this->array, $sort_flags) !== true) {\n"
" if (rsort($this->array, $sort_flags) !== true) { // @phpstan-ignore notIdentical.alwaysFalse\n"
" throw new \\RuntimeException('rsort() failed');\n"
" }\n"
" return $this;\n"
Expand Down Expand Up @@ -1754,11 +1763,11 @@ static const char* swoole_library_source_core_coroutine_server =
" return false;\n"
" }\n"
"\n"
" while ($this->running) {\n"
" /** @var Socket $conn */\n"
" while ($this->running) { // @phpstan-ignore while.alwaysTrue\n"
" $conn = null;\n"
" /** @var Socket $conn */\n"
" $conn = $socket->accept();\n"
" if ($conn) {\n"
" if ($conn) { // @phpstan-ignore if.alwaysTrue\n"
" $conn->setProtocol($this->setting);\n"
" if (!empty($this->setting[Constant::OPTION_OPEN_SSL])) {\n"
" $fn = static function ($fn, $connection) {\n"
Expand Down Expand Up @@ -1793,7 +1802,7 @@ static const char* swoole_library_source_core_coroutine_server =
" }\n"
" }\n"
"\n"
" return true;\n"
" return true; // @phpstan-ignore deadCode.unreachable\n"
" }\n"
"}\n";

Expand Down Expand Up @@ -1891,7 +1900,7 @@ static const char* swoole_library_source_core_coroutine_barrier =
" }\n"
"\n"
" /**\n"
" * @throws Exception\n"
" * @param-out null $barrier\n"
" */\n"
" public static function wait(Barrier &$barrier, float $timeout = -1): void\n"
" {\n"
Expand Down Expand Up @@ -4162,7 +4171,7 @@ static const char* swoole_library_source_core_curl_handler =
" $resolve = substr($resolve, 1);\n"
" }\n"
" $tmpResolve = explode(':', $resolve, 3);\n"
" $host = $tmpResolve[0] ?? '';\n"
" $host = $tmpResolve[0];\n"
" $port = $tmpResolve[1] ?? 0;\n"
" $ip = $tmpResolve[2] ?? '';\n"
" if ($flag === '-') {\n"
Expand Down Expand Up @@ -4192,10 +4201,6 @@ static const char* swoole_library_source_core_curl_handler =
" case CURLOPT_SSLVERSION:\n"
" case CURLOPT_NOSIGNAL:\n"
" case CURLOPT_FRESH_CONNECT:\n"
" /*\n"
" * From PHP 5.1.3, this option has no effect: the raw output will always be returned when CURLOPT_RETURNTRANSFER is used.\n"
" */\n"
" case CURLOPT_BINARYTRANSFER: /* TODO */\n"
" case CURLOPT_DNS_USE_GLOBAL_CACHE:\n"
" case CURLOPT_DNS_CACHE_TIMEOUT:\n"
" case CURLOPT_STDERR:\n"
Expand Down Expand Up @@ -4618,7 +4623,7 @@ static const char* swoole_library_source_core_curl_handler =
" }\n"
" }\n"
"\n"
" if ($this->cookieJar && $this->cookieJar !== '') {\n"
" if (!empty($this->cookieJar)) {\n"
" if ($this->cookieJar === '-') {\n"
" foreach ((array) $client->set_cookie_headers as $cookie) {\n"
" echo $cookie . PHP_EOL;\n"
Expand Down Expand Up @@ -5077,9 +5082,9 @@ static const char* swoole_library_source_core_fast_cgi_record_params =
" * {@inheritdoc}\n"
" * @param static $self\n"
" */\n"
" protected static function unpackPayload($self, string $binaryData): void\n"
" protected static function unpackPayload(Record $self, string $binaryData): void\n"
" {\n"
" assert($self instanceof self);\n"
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
" $currentOffset = 0;\n"
" do {\n"
" /** @phpstan-var false|array{nameLengthHigh: int} */\n"
Expand Down Expand Up @@ -5288,9 +5293,9 @@ static const char* swoole_library_source_core_fast_cgi_record_begin_request =
" * {@inheritdoc}\n"
" * @param static $self\n"
" */\n"
" protected static function unpackPayload($self, string $binaryData): void\n"
" protected static function unpackPayload(Record $self, string $binaryData): void\n"
" {\n"
" assert($self instanceof self);\n"
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
"\n"
" /** @phpstan-var false|array{role: int, flags: int, reserved: string} */\n"
" $payload = unpack('nrole/Cflags/a5reserved', $binaryData);\n"
Expand Down Expand Up @@ -5436,9 +5441,9 @@ static const char* swoole_library_source_core_fast_cgi_record_end_request =
" * {@inheritdoc}\n"
" * @param static $self\n"
" */\n"
" protected static function unpackPayload($self, string $binaryData): void\n"
" protected static function unpackPayload(Record $self, string $binaryData): void\n"
" {\n"
" assert($self instanceof self);\n"
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
"\n"
" /** @phpstan-var false|array{appStatus: int, protocolStatus: int, reserved: string} */\n"
" $payload = unpack('NappStatus/CprotocolStatus/a3reserved', $binaryData);\n"
Expand Down Expand Up @@ -5716,9 +5721,9 @@ static const char* swoole_library_source_core_fast_cgi_record_unknown_type =
" * {@inheritdoc}\n"
" * @param static $self\n"
" */\n"
" public static function unpackPayload($self, string $binaryData): void\n"
" public static function unpackPayload(Record $self, string $binaryData): void\n"
" {\n"
" assert($self instanceof self);\n"
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
"\n"
" /** @phpstan-var false|array{type: int, reserved: string} */\n"
" $payload = unpack('Ctype/a7reserved', $binaryData);\n"
Expand Down Expand Up @@ -7899,9 +7904,6 @@ static const char* swoole_library_source_core_server_admin =
" }\n"
"\n"
" if ($param->isOptional() && !$param->isVariadic()) {\n"
" if (!$result['user_defined'] && PHP_VERSION_ID < 80000) {\n"
" continue;\n"
" }\n"
" $optional = '?';\n"
" if ($param->isDefaultValueAvailable()) {\n"
" $value = $param->getDefaultValue();\n"
Expand Down Expand Up @@ -9173,6 +9175,9 @@ static const char* swoole_library_source_core_thread_pool =
"use PhpParser\\ParserFactory;\n"
"use Swoole\\Thread;\n"
"\n"
"/**\n"
" * @since 6.0.0-beta\n"
" */\n"
"class Pool\n"
"{\n"
" private array $threads = [];\n"
Expand Down Expand Up @@ -9374,6 +9379,9 @@ static const char* swoole_library_source_core_thread_runnable =
"\n"
"namespace Swoole\\Thread;\n"
"\n"
"/**\n"
" * @since 6.0.0-beta\n"
" */\n"
"abstract class Runnable\n"
"{\n"
" protected Atomic $running;\n"
Expand Down Expand Up @@ -9875,8 +9883,8 @@ static const char* swoole_library_source_functions =
"\n"
"declare(strict_types=1);\n"
"\n"
"if (PHP_VERSION_ID < 70200) {\n"
" throw new RuntimeException('require PHP version 7.2 or later');\n"
"if (PHP_VERSION_ID < 80100) { // @phpstan-ignore smaller.alwaysFalse\n"
" throw new RuntimeException('require PHP version 8.1 or later');\n"
"}\n"
"\n"
"if (SWOOLE_USE_SHORTNAME) { // @phpstan-ignore if.alwaysTrue\n"
Expand Down
2 changes: 1 addition & 1 deletion include/swoole_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define SWOOLE_MINOR_VERSION 0
#define SWOOLE_RELEASE_VERSION 0
#define SWOOLE_EXTRA_VERSION ""
#define SWOOLE_VERSION "6.0.0RC1"
#define SWOOLE_VERSION "6.0.0"
#define SWOOLE_VERSION_ID 60000
#define SWOOLE_API_VERSION_ID 0x202208a

Expand Down
Loading

0 comments on commit 3e1a1f8

Please sign in to comment.