Skip to content

Commit dda4042

Browse files
authored
tests: set a socket timeout on replicator tests (#14457)
These nightly tests sometimes hang and are killed by timeout, instead of passing or failing. Upon inspection of one of the failures, the hung thread is stuck in `SocketDispatcher.read0()` native code, presumably waiting for bytes that will never appear. Instead, set a socket timeout for these tests, so that infinite hangs (of this sort) will no longer happen: they may become failures instead. Failures are better than hangs for many reasons. Relates: #14454
1 parent 9b31ce3 commit dda4042

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Connection.java

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Connection implements Closeable {
4141
public Connection(int tcpPort) throws IOException {
4242
this.destTCPPort = tcpPort;
4343
this.s = new Socket(InetAddress.getLoopbackAddress(), tcpPort);
44+
this.s.setSoTimeout(30000);
4445
this.sockIn = s.getInputStream();
4546
this.in = new InputStreamDataInput(sockIn);
4647
this.bos = new BufferedOutputStream(s.getOutputStream());

0 commit comments

Comments
 (0)