mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
4f2a0e8eeb
The problem here is that retries (in SecureSocketImpl.cpp::mustRetry()) relies on non-zero socket timeout, but MySQL handler does not set timeouts for the socket (like other does), and this leads to a problem when OpenSSL returns SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE, the connection will be simply terminated. I've played with this patch, by hacking the openssl sources: diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c index 82f7be85ae..a399291ff4 100644 --- a/crypto/bio/bss_sock.c +++ b/crypto/bio/bss_sock.c @@ -124,7 +125,18 @@ static int sock_read(BIO *b, char *out, int outl) ret = ktls_read_record(b->num, out, outl); else # endif - ret = readsocket(b->num, out, outl); + { + /* pthread_kill(pthread_self(), SIGUSR1); */ + static int i = 0; + if (!(++i % 2)) + { + fprintf(stderr, "sock_read: inject EAGAIN\n"); + ret = -1; + errno = EAGAIN; + } + else + ret = readsocket(b->num, out, outl); + } BIO_clear_retry_flags(b); if (ret <= 0) { if (BIO_sock_should_retry(ret)) And after this patch this succeed without errors: ch benchmark -c10 -q "SELECT * FROM mysql('127.0.0.1:9004', system, one, 'default', '', SETTINGS connection_pool_size=1, connect_timeout = 100, connection_wait_timeout = 100)" Note, that this also fixes the timeouts for plain (non-TLS) connections Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com> |
||
---|---|---|
.. | ||
grpc_protos | ||
HTTP | ||
CertificateReloader.cpp | ||
CertificateReloader.h | ||
CloudPlacementInfo.cpp | ||
CloudPlacementInfo.h | ||
CMakeLists.txt | ||
GRPCServer.cpp | ||
GRPCServer.h | ||
HTTPHandler.cpp | ||
HTTPHandler.h | ||
HTTPHandlerFactory.cpp | ||
HTTPHandlerFactory.h | ||
HTTPHandlerRequestFilter.h | ||
HTTPPathHints.cpp | ||
HTTPPathHints.h | ||
HTTPRequestHandlerFactoryMain.cpp | ||
HTTPRequestHandlerFactoryMain.h | ||
HTTPResponseHeaderWriter.cpp | ||
HTTPResponseHeaderWriter.h | ||
InterserverIOHTTPHandler.cpp | ||
InterserverIOHTTPHandler.h | ||
IServer.h | ||
KeeperReadinessHandler.cpp | ||
KeeperReadinessHandler.h | ||
KeeperTCPHandler.cpp | ||
KeeperTCPHandler.h | ||
KeeperTCPHandlerFactory.h | ||
MySQLHandler.cpp | ||
MySQLHandler.h | ||
MySQLHandlerFactory.cpp | ||
MySQLHandlerFactory.h | ||
NotFoundHandler.cpp | ||
NotFoundHandler.h | ||
PostgreSQLHandler.cpp | ||
PostgreSQLHandler.h | ||
PostgreSQLHandlerFactory.cpp | ||
PostgreSQLHandlerFactory.h | ||
PrometheusMetricsWriter.cpp | ||
PrometheusMetricsWriter.h | ||
PrometheusRequestHandler.cpp | ||
PrometheusRequestHandler.h | ||
ProtocolServerAdapter.cpp | ||
ProtocolServerAdapter.h | ||
ProxyV1Handler.cpp | ||
ProxyV1Handler.h | ||
ProxyV1HandlerFactory.h | ||
ReplicasStatusHandler.cpp | ||
ReplicasStatusHandler.h | ||
ServerType.cpp | ||
ServerType.h | ||
StaticRequestHandler.cpp | ||
StaticRequestHandler.h | ||
TCPHandler.cpp | ||
TCPHandler.h | ||
TCPHandlerFactory.h | ||
TCPProtocolStackData.h | ||
TCPProtocolStackFactory.h | ||
TCPProtocolStackHandler.h | ||
TCPServer.cpp | ||
TCPServer.h | ||
TCPServerConnectionFactory.h | ||
TLSHandler.cpp | ||
TLSHandler.h | ||
TLSHandlerFactory.h | ||
waitServersToFinish.cpp | ||
waitServersToFinish.h | ||
WebUIRequestHandler.cpp | ||
WebUIRequestHandler.h |