You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2025/04/10 12:17:04 UTC

(lucene) branch main updated: tests: set a socket timeout on replicator tests (#14457)

This is an automated email from the ASF dual-hosted git repository.

rmuir pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new dda4042b8ba tests: set a socket timeout on replicator tests (#14457)
dda4042b8ba is described below

commit dda4042b8bac42465feb870ca6623a5ae9798da7
Author: Robert Muir <rm...@apache.org>
AuthorDate: Thu Apr 10 08:16:58 2025 -0400

    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
---
 .../replicator/src/test/org/apache/lucene/replicator/nrt/Connection.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Connection.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Connection.java
index 2dbcff3b3b5..79df4b9c994 100644
--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Connection.java
+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Connection.java
@@ -41,6 +41,7 @@ class Connection implements Closeable {
   public Connection(int tcpPort) throws IOException {
     this.destTCPPort = tcpPort;
     this.s = new Socket(InetAddress.getLoopbackAddress(), tcpPort);
+    this.s.setSoTimeout(30000);
     this.sockIn = s.getInputStream();
     this.in = new InputStreamDataInput(sockIn);
     this.bos = new BufferedOutputStream(s.getOutputStream());