Stefan =?utf-8?q?Gränitz?= <[email protected]>,Nerixyz <[email protected]>,Nerixyz <[email protected]> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/192061 >From ac490ab27484b3d91622d6425c8091c96a3b6dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <[email protected]> Date: Tue, 14 Apr 2026 15:06:04 +0200 Subject: [PATCH 1/4] [lldb] Make timeout for HTTP send/receive in SymbolLocatorSymStore configurable --- .../SymStore/SymbolLocatorSymStore.cpp | 10 +++-- .../SymbolLocatorSymStoreProperties.td | 8 ++-- lldb/test/API/symstore/TestSymStore.py | 38 +++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp b/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp index fac00c1a12db2..4560fc3ae54b3 100644 --- a/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp +++ b/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp @@ -68,6 +68,11 @@ class PluginProperties : public Properties { return SymbolLocatorSymStore::GetSystemDefaultCachePath(); } + uint64_t GetTimeout() const { + const uint32_t idx = ePropertyTimeout; + return GetPropertyAtIndexAs<uint64_t>( + idx, g_symbollocatorsymstore_properties[idx].default_uint_value); + std::optional<std::string> GetTLSCertFingerprint() const { OptionValueString *s = m_collection_sp->GetPropertyAtIndexAsOptionValueString( @@ -272,9 +277,8 @@ RequestFileFromSymStoreServerHTTP(llvm::StringRef base_url, llvm::StringRef key, } llvm::HTTPClient client; - // TODO: Since PDBs can be huge, we should distinguish between resolve, - // connect, send and receive. - client.setTimeout(std::chrono::seconds(60)); + client.setTimeout( + std::chrono::seconds(GetGlobalPluginProperties().GetTimeout())); llvm::StreamedHTTPResponseHandler Handler( [dest = tmp_file.str().str()]() diff --git a/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStoreProperties.td b/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStoreProperties.td index da24201c66b18..84e0278709e08 100644 --- a/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStoreProperties.td +++ b/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStoreProperties.td @@ -2,12 +2,14 @@ include "../../../../include/lldb/Core/PropertiesBase.td" let Definition = "symbollocatorsymstore", Path = "plugin.symbol-locator.symstore" in { def SymStoreURLs : Property<"urls", "Array">, - ElementType<"String">, - Desc<"List of local symstore directories to query after " - "_NT_SYMBOL_PATH">; + ElementType<"String">, + Desc<"List of local symstore directories to query after _NT_SYMBOL_PATH">; def CachePath : Property<"cache", "String">, DefaultStringValue<"">, Desc<"Default cache directory for downloaded symbol files. Used when no cache is specified in _NT_SYMBOL_PATH.">; + def Timeout : Property<"timeout", "UInt64">, + DefaultUnsignedValue<60>, + Desc<"Timeout in seconds for send/receive in HTTP connections to symbol servers.">; def TLSCertFingerprint : Property<"tls-cert-fingerprint", "String">, DefaultStringValue<"">, Desc<"SHA-256 fingerprint (lowercase hex, no separators) of the symbol server's TLS certificate. When set, LLDB will accept an HTTPS server that presents this self-signed certificate even if it is not trusted by the system certificate store (Windows only).">; diff --git a/lldb/test/API/symstore/TestSymStore.py b/lldb/test/API/symstore/TestSymStore.py index 83a3b71b0adfb..ccd21d2660132 100644 --- a/lldb/test/API/symstore/TestSymStore.py +++ b/lldb/test/API/symstore/TestSymStore.py @@ -7,6 +7,7 @@ import ssl import sys import threading +import time from functools import partial import lldb @@ -233,6 +234,23 @@ def do_GET(self): super().do_GET() +class SlowHTTPHandler(http.server.BaseHTTPRequestHandler): + """HTTP request handler that delays responses to simulate a slow server.""" + + delay = 2 # seconds to sleep before responding; set per test + + def do_GET(self): + try: + time.sleep(self.delay) + self.send_response(200) + self.end_headers() + except (BrokenPipeError, ConnectionResetError): + pass # client disconnected after timeout, as expected + + def log_message(self, *args): + pass # suppress server-side output + + class SymStoreTests(TestBase): TEST_WITH_PDB_DEBUG_INFO = True @@ -426,6 +444,26 @@ def test_lookup_order(self): self.try_breakpoint(exe, should_have_loc=True) self.assertEqual(RequestCounter.requests, 0) + def test_http_timeout(self): + """ + Check that a warning is emitted and no symbol is found when the server + takes longer to respond than the configured timeout. + """ + exe, sym = self.build_inferior() + with MockedSymStore(self, exe, sym) as dir: + SlowHTTPHandler.delay = 3 # seconds; exceeds the 1s timeout below + self.runCmd("settings set plugin.symbol-locator.symstore.timeout 1") + with HTTPServer(dir, SlowHTTPHandler) as url: + self.runCmd(f"settings set plugin.symbol-locator.symstore.urls {url}") + warnings = "" + with open(self.getBuildArtifact("stderr.txt"), "w+b") as err_file: + self.dbg.SetErrorFileHandle(err_file, False) + self.try_breakpoint(exe, should_have_loc=False) + self.dbg.SetErrorFileHandle(sys.stderr, False) + err_file.seek(0) + warnings = err_file.read().decode() + self.assertIn("failed to download", warnings) + @skipUnlessPackageAvailable("cryptography") def test_https(self): """ >From 1eb698b9ff9d2a43956c2aa8440c6b486a357e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <[email protected]> Date: Thu, 9 Jul 2026 12:53:36 +0200 Subject: [PATCH 2/4] Add missing brace after conflict resolution --- .../Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp b/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp index 4560fc3ae54b3..eab334e0b8e7a 100644 --- a/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp +++ b/lldb/source/Plugins/SymbolLocator/SymStore/SymbolLocatorSymStore.cpp @@ -72,6 +72,7 @@ class PluginProperties : public Properties { const uint32_t idx = ePropertyTimeout; return GetPropertyAtIndexAs<uint64_t>( idx, g_symbollocatorsymstore_properties[idx].default_uint_value); + } std::optional<std::string> GetTLSCertFingerprint() const { OptionValueString *s = >From 37983f7b7213160be17983025878dad8ac69bda3 Mon Sep 17 00:00:00 2001 From: Nerixyz <[email protected]> Date: Sun, 12 Jul 2026 20:03:31 +0200 Subject: [PATCH 3/4] fix: increase timeout --- lldb/test/API/symstore/TestSymStore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/symstore/TestSymStore.py b/lldb/test/API/symstore/TestSymStore.py index ccd21d2660132..d174edb28ba22 100644 --- a/lldb/test/API/symstore/TestSymStore.py +++ b/lldb/test/API/symstore/TestSymStore.py @@ -451,7 +451,7 @@ def test_http_timeout(self): """ exe, sym = self.build_inferior() with MockedSymStore(self, exe, sym) as dir: - SlowHTTPHandler.delay = 3 # seconds; exceeds the 1s timeout below + SlowHTTPHandler.delay = 4 # seconds; exceeds the 1s timeout below self.runCmd("settings set plugin.symbol-locator.symstore.timeout 1") with HTTPServer(dir, SlowHTTPHandler) as url: self.runCmd(f"settings set plugin.symbol-locator.symstore.urls {url}") >From 214c1ed71521b45c740f3b29b94c5c164b996580 Mon Sep 17 00:00:00 2001 From: Nerixyz <[email protected]> Date: Sun, 12 Jul 2026 21:15:54 +0200 Subject: [PATCH 4/4] fix: use 5s timeout --- lldb/test/API/symstore/TestSymStore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/symstore/TestSymStore.py b/lldb/test/API/symstore/TestSymStore.py index d174edb28ba22..4c668134447d1 100644 --- a/lldb/test/API/symstore/TestSymStore.py +++ b/lldb/test/API/symstore/TestSymStore.py @@ -451,7 +451,7 @@ def test_http_timeout(self): """ exe, sym = self.build_inferior() with MockedSymStore(self, exe, sym) as dir: - SlowHTTPHandler.delay = 4 # seconds; exceeds the 1s timeout below + SlowHTTPHandler.delay = 5 # seconds; exceeds the 1s timeout below self.runCmd("settings set plugin.symbol-locator.symstore.timeout 1") with HTTPServer(dir, SlowHTTPHandler) as url: self.runCmd(f"settings set plugin.symbol-locator.symstore.urls {url}") _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
