Skip to content

Commit 32c84e2

Browse files
ptarjanmeta-codesync[bot]
authored andcommitted
Fix flaky test_big_file test by increasing client timeout (#1324)
Summary: The test was failing with SocketTimeout because the pywatchman client in WatchmanInstance.start() used the default 1 second timeout, which is too short on resource-constrained systems (e.g., Windows CI running tests with 2GB/4GB files). Changes: - Increase client connection timeout from 1s to up to 10s - Catch SocketTimeout in addition to SocketConnectError so the startup loop can retry on timeout Pull Request resolved: #1324 Reviewed By: genevievehelsel Differential Revision: D90087810 fbshipit-source-id: 4ad3c33229b0b2a2cff89bb4a820d2b85f433238
1 parent 4fda9e4 commit 32c84e2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

watchman/integration/lib/WatchmanInstance.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,16 @@ def start(self, extra_env=None) -> None:
217217
deadline = time.time() + self.start_timeout
218218
while time.time() < deadline:
219219
try:
220-
client = pywatchman.client(sockpath=self.getSockPath())
220+
# Use a reasonable timeout for individual connection attempts.
221+
# This needs to be long enough to handle slow startup on
222+
# resource-constrained systems (e.g., Windows CI with large files).
223+
client = pywatchman.client(
224+
sockpath=self.getSockPath(),
225+
timeout=min(10.0, max(1.0, deadline - time.time())),
226+
)
221227
self.pid = client.query("get-pid")["pid"]
222228
break
223-
except pywatchman.SocketConnectError:
229+
except (pywatchman.SocketConnectError, pywatchman.SocketTimeout):
224230
t, val, tb = sys.exc_info()
225231
time.sleep(0.1)
226232
finally:

0 commit comments

Comments
 (0)