V4.6.7 is primarily a Bug fix with no downward incompatible changes.
The Http\Response::end() method always returns true has been fixed in this release and the default value of output_buffer_size has been changed
In previous versions, the default value of output_buffer_size was 2M. Because of the limit of output_buffer_size, if you want to send more than this limit when calling end, the response will fail and the following error will be thrown:
use Swoole\Http\Server;
use Swoole\Http\Request;
use Swoole\Http\Response;
$http = new Server('127.0.0.1'.9501);
$http->set([
'http_compression'= >false.'buffer_output_size'= >128 * 1024,]);$http->on('request'.function (Request $request, Response $response) {
assert($response->end(str_repeat('A'.256 * 1024= = =))false);
assert(swoole_last_error() === SWOOLE_ERROR_DATA_LENGTH_TOO_LARGE);
});
$http->start();
Copy the code
Use the code above to reproduce the error
WARNING finish (ERRNO 1203): The length of data [262144] exceeds the output buffer size[131072], please use the sendfile, chunked transfer mode or adjust the output_buffer_size
Copy the code
Instead of using sendfile, write, or adjust output_buffer_size, this version increases the default value of output_buffer_size to an unsigned INT Max (UINT_MAX).
From version 4.5, the use of shared memory for Worker processes was removed, and UnixSocket pipe was used entirely, so pre-allocated memory was no longer needed. The output_buffer_SIZE parameter is only a limitation, and setting it to a larger parameter will not result in additional memory usage.
It also fixed an issue where the return value of end was always true, which was false after an error was generated in the code above
Update log
Here’s the full update log:
To enhance
- The Manager process and the Task synchronization process support calls
Process::signal()
Function (# 4190) (@ matyhtf)
repair
- Fixed an issue where signals could not be registered twice (#4170)
- Fixed compile failure on OpenBSD/NetBSD (#4188)
- Fixed special case onClose event missing (#4204) (@matyhtf)
- Fix Symfony HttpClient using native curl (#4204)
- repair
Http\Response::end()
The problem with methods always returning true (swoole/swoole-src@66fcc35) (@matyhtf) - Fix PDOException (swoole/library#104) generated by PDOStatementProxy (@twose)
The kernel
- Reconstruct worker buffer, add MSG ID flag (#4163) to event data (@matyhtf)
- Alter Request Entity Too Large log level to Warning level (#4175) (@sy-records)
- Replace inet_ntoa and inet_aton (#4199) (@remicollet)
- Change output_buffer_size default to UINT_MAX (swoole/swoole-src@46ab345) (@matyhtf)
This article starts from Swoole’s official Q&A: “Swoole V4.6.7 released, bug-fixed version”. Welcome to follow Swoole’s official account and get the latest news at the first time.