Skip to content

Commit 3e1a1f8

Browse files
release v6.0.0 (#5623)
1 parent 6700e99 commit 3e1a1f8

File tree

5 files changed

+247
-47
lines changed

5 files changed

+247
-47
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PROJECT(libswoole)
22
cmake_minimum_required(VERSION 2.8.12)
33

44
ENABLE_LANGUAGE(ASM)
5-
set(SWOOLE_VERSION 6.0.0RC1)
5+
set(SWOOLE_VERSION 6.0.0)
66

77
set(CMAKE_CXX_STANDARD 11)
88
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")

docs/CHANGELOG.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,113 @@
11
# Swoole Changelog
22

3+
## 2024-12-16 v6.0.0
4+
# ✨ New Feature:
5+
- Added multi-threading support, require the ZTS version of PHP. Add `--enable-swoole-thread` option to the configure command to activate it.
6+
- Added a new thread class `Swoole\Thread`. @matyhtf
7+
- Introduced thread lock `Swoole\Thread\Lock`. @matyhtf
8+
- Added thread atomic counter `Swoole\Thread\Atomic`, `Swoole\Thread\Atomic\Long`. @matyhtf
9+
- Added safe concurrent containers `Swoole\Thread\Map`, `Swoole\Thread\ArrayList`, `Swoole\Thread\Queue`. @matyhtf
10+
- 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
11+
- Upgraded `Boost Context` to version 1.84. Now, Loongson CPUs can also support coroutines. @NathanFreeman
12+
- Added `Swoole\Thread\Map::find()` method. @matyhtf
13+
- Added `Swoole\Thread\ArrayList::find()` method. @matyhtf
14+
- Added `Swoole\Thread\ArrayList::offsetUnset()` method. @matyhtf
15+
- Added `Swoole\Process::getAffinity()` method. @matyhtf
16+
- Added `Swoole\Thread::setName()` method. @matyhtf
17+
- Added `Swoole\Thread::setAffinity()` method. @matyhtf
18+
- Added `Swoole\Thread::getAffinity()` method. @matyhtf
19+
- Added `Swoole\Thread::setPriority()` method. @matyhtf
20+
- Added `Swoole\Thread::getPriority()` method. @matyhtf
21+
- Added `Swoole\Thread::gettid()` method.
22+
- The file asynchronous engine `iouring` supports multi-threaded polling mode `IORING_SETUP_SQPOLL`. @NathanFreeman
23+
- Added `iouring_workers` to modify the number of `iouring` threads. @NathanFreeman
24+
- Added `iouring_flags` to support modifying the `iouring` working mode. @NathanFreeman
25+
- Added `Swoole\Thread\Barrier` for multi-thread synchronization barrier. @matyhtf
26+
- Added new function and class to set cookies. @matyhtf @NathanFreeman
27+
- Added `non-blocking, reentrant coroutine mutex lock`, which can be used between processes/threads without blocking them. @NathanFreeman
28+
- `Swoole\Coroutine\Socket::getOption()` supports the `TCP_INFO` option. @matyhtf
29+
- `Swoole\Client` synchronous blocking client supports `http` proxy. @matyhtf
30+
- Added asynchronous non-blocking `TCP/UDP/Unix socket` client `Swoole\Async\Client`. @matyhtf
31+
- Optimized the `Swoole\Redis\Server::format()` method to support zero-copy memory, support `redis` nested structure. @matyhtf
32+
- 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
33+
34+
# 🐛 Bug Fixed:
35+
- Fixed the issue where installation via `pecl` was not possible. @remicollet
36+
- Fixed the bug where setting `keepalive` was not possible for `Swoole\Coroutine\FastCGI\Client`. @NathanFreeman
37+
- Fixed the issue where exceeding the `max_input_vars` would throw an error, causing the process to restart repeatedly. @NathanFreeman
38+
- Fixed unknown issues caused by using `Swoole\Event::wait()` within a coroutine. @matyhtf
39+
- Fixed the problem where `proc_open` does not support pty in coroutine mode. @matyhtf
40+
- Fixed segmentation fault issues with `pdo_sqlite` on PHP 8.3. @NathanFreeman
41+
- Fixed unnecessary warnings during the compilation of `Swoole`. @Appla @NathanFreeward
42+
- Fixed the error thrown by zend_fetch_resource2_ex when `STDOUT/STDERR` are already closed. @Appla @matyhtf
43+
- Fixed ineffective `set_tcp_nodelay` configuration. @matyhtf
44+
- Fixed the occasional unreachable branch issue during file upload. @NathanFreeman
45+
- Fixed the problem where setting `dispatch_func` would cause PHP's internals to throw errors. @NathanFreeman
46+
- Fixed the deprecation of AC_PROG_CC_C99 in autoconf >= 2.70. @petk
47+
- Capture exceptions when thread creation fails. @matyhtf
48+
- Fixed the undefined problem with `_tsrm_ls_cache`. @jingjingxyk
49+
- Fixed the fatal compile error with `GCC 14`. @remicollet
50+
- Fixed the dynamic property issue in `Swoole\Http2\Request`. @guandeng
51+
- Fixed the occasional resource unavailability issue in the `pgsql` coroutine client. @NathanFreeman
52+
- Fixed the issue of 503 errors due to not resetting related parameters during process restart. @matyhtf
53+
- Fixed the inconsistency between `$request->server['request_method']` and `$request->getMethod()` when `HTTP2` is enabled. @matyhtf
54+
- Fixed incorrect `content-type` when uploading files. @matyhtf
55+
- Fixed code errors in the `http2` coroutine client. @matyhtf
56+
- Fixed the missing `worker_id` property in `Swoole\Server`. @cjavad
57+
- Fixed errors related to `brotli` in `config.m4`. @fundawang
58+
- Fixed the invalid `Swoole\Http\Response::create` under multi-threading. @matyhtf
59+
- Fixed compilation errors in the `macos` environment. @matyhtf
60+
- Fixed the issue of threads not being able to exit safely. @matyhtf
61+
- 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
62+
- Fixed `Fatal error` issue caused by `PHP-8.4`'s `timeout` feature in ZTS mode. @matyhtf
63+
- Fixed compatibility issue with the `exit()` `hook` function for `PHP-8.4`. @remicollet
64+
- Fixed the issue where `Swoole\Thread::getNativeId()` did not work in `cygwin`. @matyhtf
65+
- Fixed the issue causing `SIGSEGV` in `Swoole\Coroutine::getaddrinfo()` method. @matyhtf
66+
- Fixed the issue where the runtime TCP module did not support dynamically enabling SSL encryption. @matyhtf
67+
- Fixed the issue where the HTTP client had an incorrect timeout after running for a long time. @matyhtf
68+
- Fixed the problem where the mutex lock of `Swoole\Table` could not be used before the process exited. @matyhtf
69+
- Fixed the failure of `Swoole\Server::stop()` when using named parameters. @matyhtf
70+
- Fixed the crash caused by `Swoole\Thread\Map::toArray()` not copying the key. @matyhtf
71+
- Fixed the issue of being unable to delete nested numeric keys in `Swoole\Thread\Map`. @matyhtf
72+
73+
# ⭐️ Kernel optimization:
74+
- Removed unnecessary checks for `socket structs`. @petk
75+
- Upgraded Swoole Library. @deminy
76+
- Added support for status code 451 in `Swoole\Http\Response`. @abnegate
77+
- Synchronized `file` operation code across different PHP versions. @NathanFreeman
78+
- Synchronized `pdo` operation code across different PHP versions. @NathanFreeman
79+
- Optimized the code for `Socket::ssl_recv()`. @matyhtf
80+
- Improved config.m4; some configurations can now set library locations via `pkg-config`. @NathanFreeman
81+
- Optimized the use of dynamic arrays during `request header parsing`. @NathanFreeman
82+
- Optimized file descriptor `fd` lifecycle issues in multi-threading mode. @matyhtf
83+
- Optimized some fundamental coroutine logic. @matyhtf
84+
- Upgraded the Oracle database version for CI testing. @gvenzl
85+
- Optimized the underlying logic of `sendfile`. @matyhtf
86+
- Replaced `PHP_DEF_HAVE` with `AC_DEFINE_UNQUOTED` in `config.m4`. @petk
87+
- Optimized the logic related to `heartbeat`, `shutdown`, and `stop` for the server in multi-threaded mode. @matyhtf
88+
- Optimized to avoid linking `librt` when `glibc` version is greater than 2.17. @matyhtf
89+
- Enhanced the HTTP client to accept duplicate request headers. @matyhtf
90+
- Optimized `Swoole\Http\Response::write()`. @matyhtf
91+
- `Swoole\Http\Response::write()` can now send HTTP/2 protocol. @matyhtf
92+
- Compatible with `PHP 8.4`. @matyhtf @NathanFreeman
93+
- Added the ability for asynchronous writing at the underlying socket level. @matyhtf
94+
- Optimized `Swoole\Http\Response`. @NathanFreeman
95+
- Improved underlying error messages. @matyhtf
96+
- Supported sharing PHP native sockets in multi-threaded mode. @matyhtf
97+
- Optimized static file service and fixed static file path error issues. @matyhtf
98+
- Multi-thread mode `SWOOLE_THREAD` supports restarting worker threads. @matyhtf
99+
- Multi-thread mode `SWOOLE_THREAD` supports starting timers in the `Manager` thread. @matyhtf
100+
- Compatible with the `curl` extension of `PHP-8.4`. @matyhtf @NathanFreeman
101+
- Rewrite the underlying `Swoole` code using `iouring`. @matyhtf @NathanFreeman
102+
- Optimized timers so that synchronous processes do not depend on signals. @matyhtf
103+
- Optimized the `Swoole\Coroutine\System::waitSignal()` method to allow listening to multiple signals simultaneously. @matyhtf
104+
105+
# ❌ Deprecated:
106+
- No longer supports `PHP 8.0`.
107+
- No longer supports `Swoole\Coroutine\MySQL` coroutine client.
108+
- No longer supports `Swoole\Coroutine\Redis` coroutine client.
109+
- No longer supports `Swoole\Coroutine\PostgreSQL` coroutine client.
110+
- Removed `Swoole\Coroutine\System::fread()`, `Swoole\Coroutine\System::fwrite()`, and `Swoole\Coroutine\System::fgets()` methods.
3111
## 2024-01-24 v5.1.2
4112
- Added support for embed sapi @matyhtf
5113
- Fixed compatibility with PHP 8.3 ZEND_CHECK_STACK_LIMIT @Yurunsoft

ext-src/php_swoole_library.h

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
+----------------------------------------------------------------------+
1515
*/
1616

17-
/* $Id: 1bb86a633f720da45a4d4347f23ff7755c968221 */
17+
/* $Id: f0118343cf7d61224924b4899d173b2877f14c91 */
1818

1919
#ifndef SWOOLE_LIBRARY_H
2020
#define SWOOLE_LIBRARY_H
@@ -259,10 +259,19 @@ static const char* swoole_library_source_core_constant =
259259
"\n"
260260
" public const OPTION_AIO_MAX_IDLE_TIME = 'aio_max_idle_time';\n"
261261
"\n"
262+
" /**\n"
263+
" * @since 6.0.0-beta\n"
264+
" */\n"
262265
" public const OPTION_IOURING_ENTRIES = 'iouring_entries';\n"
263266
"\n"
267+
" /**\n"
268+
" * @since 6.0.0-rc1\n"
269+
" */\n"
264270
" public const OPTION_IOURING_WORKERS = 'iouring_workers';\n"
265271
"\n"
272+
" /**\n"
273+
" * @since 6.0.0-rc1\n"
274+
" */\n"
266275
" public const OPTION_IOURING_FLAG = 'iouring_flag';\n"
267276
"\n"
268277
" public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
@@ -1420,7 +1429,7 @@ static const char* swoole_library_source_core_array_object =
14201429
" */\n"
14211430
" public function natcasesort(): self\n"
14221431
" {\n"
1423-
" if (natcasesort($this->array) !== true) {\n"
1432+
" if (natcasesort($this->array) !== true) { // @phpstan-ignore notIdentical.alwaysFalse\n"
14241433
" throw new \\RuntimeException('natcasesort() failed');\n"
14251434
" }\n"
14261435
" return $this;\n"
@@ -1431,7 +1440,7 @@ static const char* swoole_library_source_core_array_object =
14311440
" */\n"
14321441
" public function natsort(): self\n"
14331442
" {\n"
1434-
" if (natsort($this->array) !== true) {\n"
1443+
" if (natsort($this->array) !== true) { // @phpstan-ignore notIdentical.alwaysFalse\n"
14351444
" throw new \\RuntimeException('natsort() failed');\n"
14361445
" }\n"
14371446
" return $this;\n"
@@ -1442,7 +1451,7 @@ static const char* swoole_library_source_core_array_object =
14421451
" */\n"
14431452
" public function rsort(int $sort_flags = SORT_REGULAR): self\n"
14441453
" {\n"
1445-
" if (rsort($this->array, $sort_flags) !== true) {\n"
1454+
" if (rsort($this->array, $sort_flags) !== true) { // @phpstan-ignore notIdentical.alwaysFalse\n"
14461455
" throw new \\RuntimeException('rsort() failed');\n"
14471456
" }\n"
14481457
" return $this;\n"
@@ -1754,11 +1763,11 @@ static const char* swoole_library_source_core_coroutine_server =
17541763
" return false;\n"
17551764
" }\n"
17561765
"\n"
1757-
" while ($this->running) {\n"
1758-
" /** @var Socket $conn */\n"
1766+
" while ($this->running) { // @phpstan-ignore while.alwaysTrue\n"
17591767
" $conn = null;\n"
1768+
" /** @var Socket $conn */\n"
17601769
" $conn = $socket->accept();\n"
1761-
" if ($conn) {\n"
1770+
" if ($conn) { // @phpstan-ignore if.alwaysTrue\n"
17621771
" $conn->setProtocol($this->setting);\n"
17631772
" if (!empty($this->setting[Constant::OPTION_OPEN_SSL])) {\n"
17641773
" $fn = static function ($fn, $connection) {\n"
@@ -1793,7 +1802,7 @@ static const char* swoole_library_source_core_coroutine_server =
17931802
" }\n"
17941803
" }\n"
17951804
"\n"
1796-
" return true;\n"
1805+
" return true; // @phpstan-ignore deadCode.unreachable\n"
17971806
" }\n"
17981807
"}\n";
17991808

@@ -1891,7 +1900,7 @@ static const char* swoole_library_source_core_coroutine_barrier =
18911900
" }\n"
18921901
"\n"
18931902
" /**\n"
1894-
" * @throws Exception\n"
1903+
" * @param-out null $barrier\n"
18951904
" */\n"
18961905
" public static function wait(Barrier &$barrier, float $timeout = -1): void\n"
18971906
" {\n"
@@ -4162,7 +4171,7 @@ static const char* swoole_library_source_core_curl_handler =
41624171
" $resolve = substr($resolve, 1);\n"
41634172
" }\n"
41644173
" $tmpResolve = explode(':', $resolve, 3);\n"
4165-
" $host = $tmpResolve[0] ?? '';\n"
4174+
" $host = $tmpResolve[0];\n"
41664175
" $port = $tmpResolve[1] ?? 0;\n"
41674176
" $ip = $tmpResolve[2] ?? '';\n"
41684177
" if ($flag === '-') {\n"
@@ -4192,10 +4201,6 @@ static const char* swoole_library_source_core_curl_handler =
41924201
" case CURLOPT_SSLVERSION:\n"
41934202
" case CURLOPT_NOSIGNAL:\n"
41944203
" case CURLOPT_FRESH_CONNECT:\n"
4195-
" /*\n"
4196-
" * From PHP 5.1.3, this option has no effect: the raw output will always be returned when CURLOPT_RETURNTRANSFER is used.\n"
4197-
" */\n"
4198-
" case CURLOPT_BINARYTRANSFER: /* TODO */\n"
41994204
" case CURLOPT_DNS_USE_GLOBAL_CACHE:\n"
42004205
" case CURLOPT_DNS_CACHE_TIMEOUT:\n"
42014206
" case CURLOPT_STDERR:\n"
@@ -4618,7 +4623,7 @@ static const char* swoole_library_source_core_curl_handler =
46184623
" }\n"
46194624
" }\n"
46204625
"\n"
4621-
" if ($this->cookieJar && $this->cookieJar !== '') {\n"
4626+
" if (!empty($this->cookieJar)) {\n"
46224627
" if ($this->cookieJar === '-') {\n"
46234628
" foreach ((array) $client->set_cookie_headers as $cookie) {\n"
46244629
" echo $cookie . PHP_EOL;\n"
@@ -5077,9 +5082,9 @@ static const char* swoole_library_source_core_fast_cgi_record_params =
50775082
" * {@inheritdoc}\n"
50785083
" * @param static $self\n"
50795084
" */\n"
5080-
" protected static function unpackPayload($self, string $binaryData): void\n"
5085+
" protected static function unpackPayload(Record $self, string $binaryData): void\n"
50815086
" {\n"
5082-
" assert($self instanceof self);\n"
5087+
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
50835088
" $currentOffset = 0;\n"
50845089
" do {\n"
50855090
" /** @phpstan-var false|array{nameLengthHigh: int} */\n"
@@ -5288,9 +5293,9 @@ static const char* swoole_library_source_core_fast_cgi_record_begin_request =
52885293
" * {@inheritdoc}\n"
52895294
" * @param static $self\n"
52905295
" */\n"
5291-
" protected static function unpackPayload($self, string $binaryData): void\n"
5296+
" protected static function unpackPayload(Record $self, string $binaryData): void\n"
52925297
" {\n"
5293-
" assert($self instanceof self);\n"
5298+
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
52945299
"\n"
52955300
" /** @phpstan-var false|array{role: int, flags: int, reserved: string} */\n"
52965301
" $payload = unpack('nrole/Cflags/a5reserved', $binaryData);\n"
@@ -5436,9 +5441,9 @@ static const char* swoole_library_source_core_fast_cgi_record_end_request =
54365441
" * {@inheritdoc}\n"
54375442
" * @param static $self\n"
54385443
" */\n"
5439-
" protected static function unpackPayload($self, string $binaryData): void\n"
5444+
" protected static function unpackPayload(Record $self, string $binaryData): void\n"
54405445
" {\n"
5441-
" assert($self instanceof self);\n"
5446+
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
54425447
"\n"
54435448
" /** @phpstan-var false|array{appStatus: int, protocolStatus: int, reserved: string} */\n"
54445449
" $payload = unpack('NappStatus/CprotocolStatus/a3reserved', $binaryData);\n"
@@ -5716,9 +5721,9 @@ static const char* swoole_library_source_core_fast_cgi_record_unknown_type =
57165721
" * {@inheritdoc}\n"
57175722
" * @param static $self\n"
57185723
" */\n"
5719-
" public static function unpackPayload($self, string $binaryData): void\n"
5724+
" public static function unpackPayload(Record $self, string $binaryData): void\n"
57205725
" {\n"
5721-
" assert($self instanceof self);\n"
5726+
" assert($self instanceof self); // @phpstan-ignore function.alreadyNarrowedType,instanceof.alwaysTrue\n"
57225727
"\n"
57235728
" /** @phpstan-var false|array{type: int, reserved: string} */\n"
57245729
" $payload = unpack('Ctype/a7reserved', $binaryData);\n"
@@ -7899,9 +7904,6 @@ static const char* swoole_library_source_core_server_admin =
78997904
" }\n"
79007905
"\n"
79017906
" if ($param->isOptional() && !$param->isVariadic()) {\n"
7902-
" if (!$result['user_defined'] && PHP_VERSION_ID < 80000) {\n"
7903-
" continue;\n"
7904-
" }\n"
79057907
" $optional = '?';\n"
79067908
" if ($param->isDefaultValueAvailable()) {\n"
79077909
" $value = $param->getDefaultValue();\n"
@@ -9173,6 +9175,9 @@ static const char* swoole_library_source_core_thread_pool =
91739175
"use PhpParser\\ParserFactory;\n"
91749176
"use Swoole\\Thread;\n"
91759177
"\n"
9178+
"/**\n"
9179+
" * @since 6.0.0-beta\n"
9180+
" */\n"
91769181
"class Pool\n"
91779182
"{\n"
91789183
" private array $threads = [];\n"
@@ -9374,6 +9379,9 @@ static const char* swoole_library_source_core_thread_runnable =
93749379
"\n"
93759380
"namespace Swoole\\Thread;\n"
93769381
"\n"
9382+
"/**\n"
9383+
" * @since 6.0.0-beta\n"
9384+
" */\n"
93779385
"abstract class Runnable\n"
93789386
"{\n"
93799387
" protected Atomic $running;\n"
@@ -9875,8 +9883,8 @@ static const char* swoole_library_source_functions =
98759883
"\n"
98769884
"declare(strict_types=1);\n"
98779885
"\n"
9878-
"if (PHP_VERSION_ID < 70200) {\n"
9879-
" throw new RuntimeException('require PHP version 7.2 or later');\n"
9886+
"if (PHP_VERSION_ID < 80100) { // @phpstan-ignore smaller.alwaysFalse\n"
9887+
" throw new RuntimeException('require PHP version 8.1 or later');\n"
98809888
"}\n"
98819889
"\n"
98829890
"if (SWOOLE_USE_SHORTNAME) { // @phpstan-ignore if.alwaysTrue\n"

include/swoole_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define SWOOLE_MINOR_VERSION 0
2323
#define SWOOLE_RELEASE_VERSION 0
2424
#define SWOOLE_EXTRA_VERSION ""
25-
#define SWOOLE_VERSION "6.0.0RC1"
25+
#define SWOOLE_VERSION "6.0.0"
2626
#define SWOOLE_VERSION_ID 60000
2727
#define SWOOLE_API_VERSION_ID 0x202208a
2828

0 commit comments

Comments
 (0)