HTTP/2 connection closed via amphp/http-tunnel
xpader opened this issue · comments
192.168.1.187:8888 is a http proxy provide by tinyproxy, I use amphp/http-tunnel to use http proxy, often see this error:
[2023-01-04 00:01:24 715] Amp\Http\Client\Connection\Http2ConnectionException: The HTTP/2 connection from '192.168.1.60:48006' to '192.168.1.187:8888' closed in /home/web/apps/t-task-wind/releases/96/vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php:1281
Stack trace:
#0 [internal function]: Amp\Http\Client\Connection\Internal\Http2ConnectionProcessor->run()
#1 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Coroutine.php(118): Generator->send()
#2 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Internal/Placeholder.php(149): Amp\Coroutine->Amp\{closure}()
#3 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Deferred.php(53): Amp\Promise@anonymous->resolve()
#4 /home/web/apps/t-task-wind/releases/96/vendor/amphp/byte-stream/lib/ResourceInputStream.php(101): Amp\Deferred->resolve()
#5 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Loop/EvDriver.php(59): Amp\ByteStream\ResourceInputStream::Amp\ByteStream\{closure}()
#6 [internal function]: Amp\Loop\EvDriver->Amp\Loop\{closure}()
#7 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Loop/EvDriver.php(234): EvLoop->run()
#8 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\EvDriver->dispatch()
#9 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#10 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Loop/EvDriver.php(186): Amp\Loop\Driver->run()
#11 /home/web/apps/t-task-wind/releases/96/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\EvDriver->run()
...
And this is the log of tinyproxy at 00:01:24:
INFO Jan 04 00:01:11 [2273380]: Closed connection between local client (fd:7) and remote client (fd:8)
CONNECT Jan 04 00:01:24 [2291398]: Connect (file descriptor 7): 192.168.1.60 [192.168.1.60] at [192.168.1.187]
CONNECT Jan 04 00:01:24 [2291398]: Request (file descriptor 7): CONNECT example.com:443 HTTP/1.1
INFO Jan 04 00:01:24 [2291398]: No upstream proxy for example.com
INFO Jan 04 00:01:24 [2291398]: opensock: opening connection to example.com:443
INFO Jan 04 00:01:24 [2291398]: opensock: getaddrinfo returned for example.com:443
CONNECT Jan 04 00:01:24 [2291398]: Established connection to host "example.com" using file descriptor 8.
INFO Jan 04 00:01:24 [2291398]: Not sending client headers to remote machine
CONNECT Jan 04 00:01:24 [2291819]: Connect (file descriptor 7): 192.168.1.60 [192.168.1.60] at [192.168.1.187]
CONNECT Jan 04 00:01:24 [2291819]: Request (file descriptor 7): CONNECT login.example.com:443 HTTP/1.1
INFO Jan 04 00:01:24 [2291819]: No upstream proxy for login.example.com
INFO Jan 04 00:01:24 [2291819]: opensock: opening connection to login.example.com:443
INFO Jan 04 00:01:24 [2291819]: opensock: getaddrinfo returned for login.example.com:443
CONNECT Jan 04 00:01:24 [2291819]: Established connection to host "login.example.com" using file descriptor 8.
INFO Jan 04 00:01:24 [2291819]: Not sending client headers to remote machine
INFO Jan 04 00:01:24 [2291819]: Closed connection between local client (fd:7) and remote client (fd:8)
CONNECT Jan 04 00:01:24 [2304987]: Connect (file descriptor 7): 192.168.1.60 [192.168.1.60] at [192.168.1.187]
CONNECT Jan 04 00:01:24 [2304987]: Request (file descriptor 7): CONNECT login.example.com:443 HTTP/1.1
INFO Jan 04 00:01:24 [2304987]: No upstream proxy for login.example.com
INFO Jan 04 00:01:24 [2304987]: opensock: opening connection to login.example.com:443
INFO Jan 04 00:01:24 [2304987]: opensock: getaddrinfo returned for login.example.com:443
CONNECT Jan 04 00:01:24 [2304987]: Established connection to host "login.example.com" using file descriptor 8.
INFO Jan 04 00:01:24 [2304987]: Not sending client headers to remote machine
INFO Jan 04 00:01:24 [2304987]: Closed connection between local client (fd:7) and remote client (fd:8)
CONNECT Jan 04 00:01:24 [2297292]: Connect (file descriptor 7): 192.168.1.60 [192.168.1.60] at [192.168.1.187]
CONNECT Jan 04 00:01:24 [2297292]: Request (file descriptor 7): CONNECT login.example.com:443 HTTP/1.1
INFO Jan 04 00:01:24 [2297292]: No upstream proxy for login.example.com
INFO Jan 04 00:01:24 [2297292]: opensock: opening connection to login.example.com:443
INFO Jan 04 00:01:24 [2297292]: opensock: getaddrinfo returned for login.example.com:443
CONNECT Jan 04 00:01:24 [2297292]: Established connection to host "login.example.com" using file descriptor 8.
INFO Jan 04 00:01:24 [2297292]: Not sending client headers to remote machine
INFO Jan 04 00:01:24 [2297292]: Closed connection between local client (fd:7) and remote client (fd:8)
CONNECT Jan 04 00:01:27 [2283968]: Connect (file descriptor 7): 192.168.1.60 [192.168.1.60] at [192.168.1.188]
I have try to change proxy to socks5 by microsocks, and use this example https://github.com/amphp/http-client/blob/master/examples/proxy/socks5.php to use socks5 proxy, the error still happend sometimes.
I guess the question is what the reason behind "Not sending client headers to remote machine" is. Is that a decision by the proxy which then closes the connection, or is it the result of the client connection closing?
I'll try to find som law of this problem, and record more detail for it.