Swoole-src: Swoolew HTTP Server rejects Requests larger than over 2MB

Created on 21 Feb 2020  ·  1Comment  ·  Source: swoole/swoole-src

I created a simple setup to measure swooles I/O capacities: https://github.com/tux-rampage/swoole-io-test

During the tests I found out Swoole is always rejecting Requests larger than 2MB with the status code 413.

I guess this is related to #2373 (Which was a case I wanted to test in terms of memory consumption).

  1. What did you do? If possible, provide a simple script for reproducing the error.

    • Sending a request with 1GB of data to a swoole webserver
  2. What did you expect to see?

    • A 204 Response as defined in the handler
  3. What did you see instead?

    • HTTP response 413 Request entity too large
  4. What version of Swoole are you using (show your php --ri swoole)?

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.4.16
Built => Feb 21 2020 09:46:05
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1d  10 Sep 2019
http2 => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
  1. What is your machine environment used (including version of kernel & php & gcc) ?

    • Ubuntu 18.04
question

Most helpful comment

You can set the package_max_length option to increase the maximum length limit. But this takes more memory, because Swoole-HTTP-Server keeps all requested data in memory, not disk.

$http = new Swoole\Http\Server("127.0.0.1", 9501);
$http->set([
    'package_max_length' => 16 * 1024 * 1024,
])

>All comments

You can set the package_max_length option to increase the maximum length limit. But this takes more memory, because Swoole-HTTP-Server keeps all requested data in memory, not disk.

$http = new Swoole\Http\Server("127.0.0.1", 9501);
$http->set([
    'package_max_length' => 16 * 1024 * 1024,
])
Was this page helpful?
0 / 5 - 0 ratings