http-client icon indicating copy to clipboard operation
http-client copied to clipboard

Connection closed

Open blackcatt opened this issue 9 months ago • 0 comments

I decided use http client in my worker. Server part works on workerman Worker with one thread ( $worker->count = 1; ) Business logic requires it.

Part of http client here :

$http = new Workerman\Http\Client(
['max_conn_per_addr' => 128,
  'keepalive_timeout' => 15,
   'connect_timeout'   => 30,
   'timeout'           => 30,
]);
$t=microtime(1);
$http->post('http://127.0.0.1:8080', ['command'=>'ping'], 
function ($response) { echo "ok\n"; }, 
function ($exception) use($t){ echo ' exception ['.substr($exception,0,57).']</b> diff:'.(microtime(1)-$t).s"\n"; }
);

So, when i post queries sequentially all work fine and quick. But if i send multiple quries - http client very quickly (0.1sec) recieve exception "Connection closed". I was expect that it will wait answer from server up to 30 seconds, but not. If I use another asynchronous method of client operation via curl_multi I don’t observe such server behavior. May be i need some tune of psr7 ? Or do you have any smart thoughts on this topic?

Thank you for your product and attention to it.

blackcatt avatar Sep 09 '23 14:09 blackcatt