From dd271adcf5a66011c74d1fb243700e5b4fc7394a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 12 Mar 2024 12:29:57 -0400 Subject: [PATCH] RequestServer: Do not defer establishing a TCP/TLS connection The underlying issue here isn't quite understood yet, but for some reason, when we defer this connection, we ultimately end up blocking indefinitely on macOS when a subsequent StartRequest message tries to send its request FD over IPC. We should continue investigating that issue, but for now, this lets us use RequestServer more reliably on macOS. --- Userland/Services/RequestServer/HttpCommon.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Userland/Services/RequestServer/HttpCommon.h b/Userland/Services/RequestServer/HttpCommon.h index 15b7b85d14..77bed46dea 100644 --- a/Userland/Services/RequestServer/HttpCommon.h +++ b/Userland/Services/RequestServer/HttpCommon.h @@ -102,12 +102,10 @@ OwnPtr start_request(TBadgedProtocol&& protocol, i32 request_id, Connec auto protocol_request = TRequest::create_with_job(forward(protocol), client, (TJob&)*job, move(output_stream), request_id); protocol_request->set_request_fd(pipe_result.value().read_fd); - Core::EventLoop::current().deferred_invoke([=] { - if constexpr (IsSame) - ConnectionCache::get_or_create_connection(ConnectionCache::g_tls_connection_cache, url, job, proxy_data); - else - ConnectionCache::get_or_create_connection(ConnectionCache::g_tcp_connection_cache, url, job, proxy_data); - }); + if constexpr (IsSame) + ConnectionCache::get_or_create_connection(ConnectionCache::g_tls_connection_cache, url, job, proxy_data); + else + ConnectionCache::get_or_create_connection(ConnectionCache::g_tcp_connection_cache, url, job, proxy_data); return protocol_request; }