Skip to content

Commit 163f173

Browse files
update swoole library (#6061)
1 parent 7b406ed commit 163f173

3 files changed

Lines changed: 44 additions & 10 deletions

File tree

ext-src/php_swoole_library.h

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

17-
/* $Id: 54ad6d15fb4330384673e6d6a8317c46d0ca78a3 */
17+
/* $Id: 0d7c0a67a111d8e3b94cc9c03fa89a649100c326 */
1818

1919
#ifndef SWOOLE_LIBRARY_H
2020
#define SWOOLE_LIBRARY_H
@@ -2800,6 +2800,7 @@ static const char* swoole_library_source_core_database_detects_lost_connections
28002800
" */\n"
28012801
" private const ERROR_MESSAGES = [\n"
28022802
" 'server has gone away',\n"
2803+
" 'Server has gone away',\n"
28032804
" 'no connection to the server',\n"
28042805
" 'Lost connection',\n"
28052806
" 'is dead or not enabled',\n"
@@ -2829,6 +2830,9 @@ static const char* swoole_library_source_core_database_detects_lost_connections
28292830
" 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known',\n"
28302831
" 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for',\n"
28312832
" 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected',\n"
2833+
" 'SSL error: unexpected eof',\n"
2834+
" 'SQLSTATE[HY000] [2002] Connection timed out',\n"
2835+
" 'SSL: Connection timed out',\n"
28322836
" 'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',\n"
28332837
" 'Temporary failure in name resolution',\n"
28342838
" 'SQLSTATE[08S01]: Communication link failure',\n"
@@ -2838,12 +2842,35 @@ static const char* swoole_library_source_core_database_detects_lost_connections
28382842
" 'SQLSTATE[08006] [7] could not translate host name',\n"
28392843
" 'TCP Provider: Error code 0x274C',\n"
28402844
" 'SQLSTATE[HY000] [2002] No such file or directory',\n"
2845+
" 'SSL: Operation timed out',\n"
28412846
" 'Reason: Server is in script upgrade mode. Only administrator can connect at this time.',\n"
28422847
" 'Unknown $curl_error_code: 77',\n"
2848+
" 'SSL: Handshake timed out',\n"
28432849
" 'SQLSTATE[08006] [7] SSL error: sslv3 alert unexpected message',\n"
28442850
" 'SQLSTATE[08006] [7] unrecognized SSL error code:',\n"
2851+
" 'SQLSTATE[HY000] [1045] Access denied for user',\n"
28452852
" 'SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it',\n"
2853+
" 'SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',\n"
2854+
" 'SQLSTATE[HY000] [2002] Network is unreachable',\n"
2855+
" 'SQLSTATE[HY000] [2002] The requested address is not valid in its context',\n"
2856+
" 'SQLSTATE[HY000] [2002] A socket operation was attempted to an unreachable network',\n"
2857+
" 'SQLSTATE[HY000] [2002] Operation now in progress',\n"
2858+
" 'SQLSTATE[HY000] [2002] Operation in progress',\n"
2859+
" 'SQLSTATE[HY000]: General error: 3989',\n"
2860+
" 'went away',\n"
2861+
" 'No such file or directory',\n"
2862+
" 'server is shutting down',\n"
2863+
" 'failed to connect to',\n"
2864+
" 'Channel connection is closed',\n"
2865+
" 'Connection lost',\n"
28462866
" 'Broken pipe',\n"
2867+
" 'SQLSTATE[25006]: Read only sql transaction: 7',\n"
2868+
" 'vtgate connection error: no healthy endpoints',\n"
2869+
" 'primary is not serving, there may be a reparent operation in progress',\n"
2870+
" 'current keyspace is being resharded',\n"
2871+
" 'no healthy tablet available',\n"
2872+
" 'transaction pool connection limit exceeded',\n"
2873+
" 'SSL operation failed with code 5',\n"
28472874
" // PDO::prepare(): Send of 77 bytes failed with errno=110 Operation timed out\n"
28482875
" // SSL: Handshake timed out\n"
28492876
" // SSL: Operation timed out\n"
@@ -11231,11 +11258,17 @@ static const char* swoole_library_source_functions =
1123111258
" if ($proc === false) {\n"
1123211259
" throw new RuntimeException('failed to start remote object server');\n"
1123311260
" }\n"
11234-
" $rc = proc_close($proc);\n"
11235-
" if ($rc !== 0) {\n"
11261+
" $status = proc_get_status($proc);\n"
11262+
" if (!$status['running'] or !$status['pid']) {\n"
11263+
" throw new RuntimeException('failed to start remote object server');\n"
11264+
" }\n"
11265+
"\n"
11266+
" $exitStatus = Swoole\\Coroutine\\System::waitpid($status['pid']);\n"
11267+
" if ($exitStatus['code'] !== 0) {\n"
1123611268
" $output = stream_get_contents($pipes[1]) . stream_get_contents($pipes[2]);\n"
11237-
" throw new RuntimeException(\"failed to start remote object server: exit code {$rc}, output: \" . $output);\n"
11269+
" throw new RuntimeException(\"failed to start remote object server: exit code {$exitStatus['code']}, output: \" . $output);\n"
1123811270
" }\n"
11271+
" proc_close($proc);\n"
1123911272
"\n"
1124011273
" $wait_ready_fn();\n"
1124111274
" flock($lock_handle, LOCK_UN);\n"

package.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<active>yes</active>
5151
</developer>
5252
<date>2026-05-14</date>
53-
<time>21:00:00</time>
53+
<time>22:00:00</time>
5454
<version>
5555
<release>6.2.1</release>
5656
<api>6.0</api>
@@ -61,17 +61,18 @@
6161
</stability>
6262
<license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache2.0</license>
6363
<notes>
64-
- Fix timeout configuration error: Resolved an issue where the write timeout incorrectly used the read timeout when `max_idle_time` was set.
64+
- Fix timeout configuration error: Fixed an issue where the write timeout incorrectly reused the read timeout when `max_idle_time` was set.
6565
- Fix async reload warning: Eliminated invalid warnings triggered by the exit of old processes during asynchronous reloads.
6666
- Refactor process management: Refactored the server process management logic.
67-
- Optimize fork failure handling: Improved the handling mechanism after child process `fork` failures. Added a retry logic that waits 1 second before each retry to avoid excessive error logs.
68-
- Fix data race issue: Changed the `closed` field in the underlying `Connection` struct to an atomic operation, resolving a potential data race risk.
67+
- Optimize fork failure handling: Improved the handling mechanism after child process `fork` failures. Added retry logic that waits 1 second before each retry to avoid generating excessive error logs.
68+
- Fix data race issue: Changed the `closed` field in the underlying `Connection` struct to an atomic operation, eliminating a potential data race risk.
6969
- Fix integer overflow: Fixed an integer overflow issue in the Redis server.
7070
- Replace communication mechanism: Replaced the communication method between child threads and the main thread in the thread pool from `Pipe` to `UnixSocket`.
7171
- Support curl coroutine mode: In `curl` coroutine scenarios, file upload and download operations have been replaced with coroutine implementations.
7272
- Optimize blocking function detection: Enhanced the `tracker observer`'s ability to detect blocking functions.
73-
- Adapt unit tests: Updated IP address lookup functionality in unit tests for different operating system families.
73+
- Adapt unit tests: Updated the IP address lookup functionality in unit tests for different operating system families.
7474
- Add PDO asynchronous method: Added the asynchronous method `PQsendClosePrepared` for `pdo_pgsql` to close existing prepared statements.
75+
- Database connection pool optimization: Added recognition and handling for various error messages indicating that database connections have been disconnected and require reconnection.
7576
</notes>
7677
<contents>
7778
<dir name="/">

tests/init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ if ($load_firebird) {
6363
}
6464

6565
swoole_library_set_option('default_remote_object_server_worker_num', 8);
66-
swoole_init_default_remote_object_server();
6766

6867
Swoole\Coroutine\run(function () use ($load_mysql, $load_firebird, $load_odbc_mysql) {
68+
swoole_init_default_remote_object_server();
6969
echo "[SSH2-init] Setting up SSH2 test environment...\n";
7070

7171
$ssh_user = TEST_SSH2_USER ;

0 commit comments

Comments
 (0)