swoole-src icon indicating copy to clipboard operation
swoole-src copied to clipboard

swoole_server receive event stops on disabled logging and big data

Open NordFox7 opened this issue 7 years ago • 6 comments

Hi, i trying to receive big data > 256K but i get different results when i change the log_level.

Working Example:

class TestServer extends Server {

	public function __construct(string $host, int $port) {
		parent::__construct($host, $port, SWOOLE_PROCESS, SWOOLE_SOCK_TCP);
		$this->on("receive", \Closure::fromCallable([$this, "onReceive"]));
	}

	private $i = 1;

	protected function onReceive(Server $server, int $fd, int $reactor_id, string $data) : void {
		echo "onReceive: ".($this->i++)." (".strlen($data)." B) ".substr(StringUtils::ToHex($data), 0, 100)." ...\n";
	}

}

Results: got 262144 of 262144 Bytes (Correct):

[2018-06-13 15:35:43 @2248.0]   TRACE   Create swoole_server host=127.0.0.1, port=1234, mode=3, type=1
[2018-06-13 15:35:45 #2248.8]   TRACE   [Master] Accept new connection. maxfd=4|reactor_id=8|conn=31
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 1 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 2 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 3 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
onReceive: 4 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 5 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
onReceive: 6 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 7 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 8 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 9 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 10 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 11 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
onReceive: 12 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 13 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
onReceive: 14 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 15 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 16 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 17 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 18 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 19 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 20 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 21 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 22 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 23 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=8180 bytes.
onReceive: 24 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=8180

onReceive: 25 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   send string package, size=384 bytes.
onReceive: 26 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 #2248.7]   TRACE   dispatch, type=10|len=384

onReceive: 27 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 28 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 29 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 30 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 31 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 32 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 33 (384 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
[2018-06-13 15:35:45 *2265.7]   TRACE   [Worker] send: sendn=12|type=4|content=(null)
[2018-06-13 15:35:45 #2248.7]   TRACE   Close Event.fd=31|from=7
[2018-06-13 15:35:45 #2248.7]   TRACE   set_maxfd=30|close_fd=31

Same example with log_level -1 (Not working):

class TestServer extends Server {

	public function __construct(string $host, int $port) {
		parent::__construct($host, $port, SWOOLE_PROCESS, SWOOLE_SOCK_TCP);

		$this->set([
			"log_level" => -1
		]);

		$this->on("receive", \Closure::fromCallable([$this, "onReceive"]));
	}

	private $i = 1;

	protected function onReceive(Server $server, int $fd, int $reactor_id, string $data) : void {
		echo "onReceive: ".($this->i++)." (".strlen($data)." B) ".substr(StringUtils::ToHex($data), 0, 100)." ...\n";
	}

}

Results: got only 171780 of 262144 Bytes (Incorrect):

onReceive: 1 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 2 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 3 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 4 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 5 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 6 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 7 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 8 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 9 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 10 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 11 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 12 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 13 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 14 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 15 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 16 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 17 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 18 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 19 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 20 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...
onReceive: 21 (8180 B) 2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a ...

onReceive always stops at ~171780 Bytes.

  1. What version of Swoole are you using (php --ri swoole)?
swoole

swoole support => enabled
Version => 2.2.0
Author => tianfeng.han[email: [email protected]]
coroutine => enabled
epoll => enabled
eventfd => enabled
timerfd => enabled
signalfd => enabled
cpu affinity => enabled
spinlock => enabled
rwlock => enabled
async http/websocket client => enabled
sockets => enabled
openssl => enabled
Linux Native AIO => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
debug => enabled

Directive => Local Value => Master Value
swoole.aio_thread_num => 2 => 2
swoole.display_errors => On => On
swoole.use_namespace => On => On
swoole.use_shortname => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
  1. What is your machine environment used (including version of kernel & php & gcc) ? PHP 7.2.6

  2. If you are using ssl, what is your openssl version? No SSL

NordFox7 avatar Jun 13 '18 13:06 NordFox7

I can't get recurrence on my mac, can you provide a recipe for reproducing the error? (log_level is an unsigned int, value -1 will make it become a big value to disable all of the logs)

twose avatar Jun 14 '18 05:06 twose

What is the proper way of disabling the logging? (I'm using 6 for now because its not defined as an log_level).

Edit: Seems that with SWOOLE_BASE it works, but not with SWOOLE_PROCESS...

I made some "recipe" for you:

Server:

<?php
declare(strict_types=1);

class TestServer extends swoole_server {

	private $receivedCount = 0;

	public function __construct(string $host, int $port, bool $disable_logging) {
		parent::__construct($host, $port, SWOOLE_PROCESS, SWOOLE_SOCK_TCP);
		$this->on("connect", \Closure::fromCallable([$this, "onConnect"]));
		$this->on("close", \Closure::fromCallable([$this, "onClose"]));
		$this->on("receive", \Closure::fromCallable([$this, "onReceive"]));

		$this->set([
			"log_level" => $disable_logging ? 6 : 0
		]);

		if($disable_logging)
			echo "LOGGING DISABLED\n";
	}

	protected function onConnect(swoole_server $server, int $fd, int $from_id) : void {
		echo "#$fd Connected\n";
	}

	protected function onClose(swoole_server $server, int $fd, int $reactorId) : void {
		echo "#$fd Closed\n";
	}

	protected function onReceive(swoole_server $server, int $fd, int $reactor_id, string $data) : void {
		echo "#$fd Received: ".(++$this->receivedCount)." (".strlen($data)." B) ".substr($data, 0, 10)." ...\n";
		$server->send($fd, $data);
	}

}

$ts = new TestServer(
	"127.0.0.1",
	9001,
	$argc > 1 && $argv[1] == "disable_logging"
);

$ts->start();

Client:

<?php
declare(strict_types=1);

class TestClient extends swoole_client {

	const BYTE_SIZES = [
		"64K" => 64 * 2**10,
		"256K" => 256 * 2**10,
		"1M" => 1 * 2**20,
		"4M" => 4 * 2**20,
		"8M" => 8 * 2**20,
		"16M" => 16 * 2**20
	];

	private $sendSize;
	private $sendData;

	private $receivedCount = 0;
	private $receivedBytes = 0;

	public function __construct($byteSize) {
		parent::__construct(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC);
		$this->on("connect", \Closure::fromCallable([$this, "onConnect"]));
		$this->on("close", \Closure::fromCallable([$this, "onClose"]));
		$this->on("error", \Closure::fromCallable([$this, "onError"]));
		$this->on("receive", \Closure::fromCallable([$this, "onReceive"]));

		if(!array_key_exists($byteSize, self::BYTE_SIZES))
			exit("invalid byte size\n");

		$this->sendSize = self::BYTE_SIZES[$byteSize];
		$this->sendData = str_repeat("*", $this->sendSize);
	}

	protected function onConnect(swoole_client $cli) : void {
		echo "Connected\n";
		$cli->send($this->sendData);
	}

	protected function onClose(swoole_client $cli) : void {
		echo "Closed\n";
		echo $this->receivedBytes === $this->sendSize ? "PASS" : "FAILED";
		echo " ($this->receivedBytes of $this->sendSize Bytes)\n";
	}

	protected function onError(swoole_client $cli) : void {
		echo "Error\n";
	}

	protected function onReceive(swoole_client $cli, $data) : void {
		$this->receivedBytes += strlen($data);
		echo "Received: ".(++$this->receivedCount)." (".$this->receivedBytes." B) ".substr($data, 0, 10)." ...\n";
		if($this->receivedBytes === $this->sendSize)
			$cli->close();
	}

}

if($argc < 1)
	exit("missing byte size\n");

$tc = new TestClient($argv[1]);
$tc->connect("127.0.0.1", 9001);

Run Server with php ServerTest.php and/or php ServerTest.php disable_logging

Run Client with php ClientTest.php byteSize byteSize can be chossen by the clients BYTE_SIZES array.

My results with php ServerTest.php disable_logging and php ClientTest.php 64K:

Client:

Connected
Sending 65536 Bytes ...
Received: 1 (8180 B) ********** ...
Received: 2 (16360 B) ********** ...
Received: 3 (24540 B) ********** ...
Received: 4 (32720 B) ********** ...
Received: 5 (40900 B) ********** ...
Received: 6 (49080 B) ********** ...
Received: 7 (57260 B) ********** ...
Received: 8 (65440 B) ********** ...
Received: 9 (65536 B) ********** ...
Closed
PASS (65536 of 65536 Bytes)

Server:

LOGGING DISABLED
#1 Connected
#1 Received: 1 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 2 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 3 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 4 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 5 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 6 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 7 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 8 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 9 (96 B) ********** ...
#1 Sending 96 Bytes ...
#1 Closed
^C

My results with php ServerTest.php disable_logging and php ClientTest.php 256K:

Client:

Connected
Sending 262144 Bytes ...
Received: 1 (16360 B) ********** ...
Received: 2 (24540 B) ********** ...
Received: 3 (32720 B) ********** ...
Received: 4 (40900 B) ********** ...
Received: 5 (49080 B) ********** ...
Received: 6 (57260 B) ********** ...
Received: 7 (65440 B) ********** ...
Received: 8 (73620 B) ********** ...
Received: 9 (81800 B) ********** ...
Received: 10 (89980 B) ********** ...
Received: 11 (98160 B) ********** ...
Received: 12 (106340 B) ********** ...
Received: 13 (114520 B) ********** ...
Received: 14 (122700 B) ********** ...
Received: 15 (130880 B) ********** ...
Received: 16 (139060 B) ********** ...
Received: 17 (147240 B) ********** ...
Received: 18 (155420 B) ********** ...
Received: 19 (163600 B) ********** ...
Received: 20 (171780 B) ********** ...
Received: 21 (179960 B) ********** ...
Received: 22 (188140 B) ********** ...
Received: 23 (196320 B) ********** ...
Closed
FAILED (196320 of 262144 Bytes)

Server:

LOGGING DISABLED
#1 Connected
#1 Received: 1 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 2 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 3 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 4 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 5 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 6 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 7 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 8 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 9 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 10 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 11 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 12 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 13 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 14 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 15 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 16 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 17 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 18 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 19 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 20 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 21 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 22 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 23 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
#1 Received: 24 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
*** Server stops receiving. I waited 5 secs, then aborted with CTRL+C ***
^C

My Results with php ServerTest.php and php ClientTest.php 256K: Client:

Connected
Sending 262144 Bytes ...
Received: 1 (8180 B) ********** ...
Received: 2 (16360 B) ********** ...
Received: 3 (24540 B) ********** ...
Received: 4 (32720 B) ********** ...
Received: 5 (40900 B) ********** ...
Received: 6 (49080 B) ********** ...
Received: 7 (57260 B) ********** ...
Received: 8 (65440 B) ********** ...
Received: 9 (73620 B) ********** ...
Received: 10 (81800 B) ********** ...
Received: 11 (89980 B) ********** ...
Received: 12 (98160 B) ********** ...
Received: 13 (106340 B) ********** ...
Received: 14 (114520 B) ********** ...
Received: 15 (122700 B) ********** ...
Received: 16 (130880 B) ********** ...
Received: 17 (139060 B) ********** ...
Received: 18 (147240 B) ********** ...
Received: 19 (155420 B) ********** ...
Received: 20 (163600 B) ********** ...
Received: 21 (171780 B) ********** ...
Received: 22 (179960 B) ********** ...
Received: 23 (188140 B) ********** ...
Received: 24 (196320 B) ********** ...
Received: 25 (204500 B) ********** ...
Received: 26 (212680 B) ********** ...
Received: 27 (220860 B) ********** ...
Received: 28 (229040 B) ********** ...
Received: 29 (237220 B) ********** ...
Received: 30 (245400 B) ********** ...
Received: 31 (253580 B) ********** ...
Received: 32 (261760 B) ********** ...
Received: 33 (262144 B) ********** ...
Closed
PASS (262144 of 262144 Bytes)

Server:

[2018-06-14 11:48:25 @797.0]    TRACE   Create swoole_server host=127.0.0.1, port=9001, mode=3, type=1
[2018-06-14 11:48:25 #797.8]    TRACE   [Master] Accept new connection. maxfd=4|reactor_id=8|conn=31
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Connected
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Received: 1 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 2 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 3 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 4 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 5 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 6 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 7 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 8 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 9 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 10 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 11 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 12 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 13 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 14 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 15 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 16 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 17 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 18 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 19 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 20 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=8180 bytes.
#1 Received: 21 (8180 B) ********** ...
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=8180

#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 #797.7]    TRACE   send string package, size=384 bytes.
[2018-06-14 11:48:25 #797.7]    TRACE   dispatch, type=10|len=384

[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 22 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 23 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 24 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 25 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 26 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 27 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 28 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 29 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 30 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 31 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 32 (8180 B) ********** ...
#1 Sending 8180 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] big response, length=8180|worker_id=7
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=20|type=0|content=****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Received: 33 (384 B) ********** ...
#1 Sending 384 Bytes ...
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=396|type=0|content=************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
#1 Closed
[2018-06-14 11:48:25 *814.7]    TRACE   [Worker] send: sendn=12|type=4|content=(null)
[2018-06-14 11:48:25 #797.7]    TRACE   Close Event.fd=31|from=7
[2018-06-14 11:48:25 #797.7]    TRACE   set_maxfd=30|close_fd=31

^C

NordFox7 avatar Jun 14 '18 09:06 NordFox7

@FoxLess I have tried it just now but I got the success result...

With your code:

php server.php disable_logging
php client.php 16M

Result

PASS (16777216 of 16777216 Bytes)

if you want to send data more than 1M, you should set this:

 $this->set([
    'socket_buffer_size' => self::BYTE_SIZES['16M']
 ]);

and some other const vars

const SWOOLE_LOG_DEBUG = 0;
const SWOOLE_LOG_TRACE;
const SWOOLE_LOG_INFO; // it's normal
const SWOOLE_LOG_NOTICE;
const SWOOLE_LOG_WARNING;
const SWOOLE_LOG_ERROR;

twose avatar Jun 16 '18 07:06 twose

I suggest you to try to use Swoole 4.0, it's the best version.

twose avatar Jun 16 '18 08:06 twose

I updated to 4.0 but its still the same on my local machine. I'm using the windows subsystem for linux and installed ubuntu on there, that's probably the problem.

I tried on a real ubuntu server and there it works.

It could be nice when it also would work on a virtual linux.

NordFox7 avatar Jun 18 '18 15:06 NordFox7

@FoxLess I have the same problem. I try to fwrite a data about 361kb with the socket client and the it return 361000 . But it have nothing in swoole server and it can't receive anything anymore.

I'm using wsl too.

Hanson avatar Feb 29 '20 13:02 Hanson