#736

Bound synchronous socket reads by totalTimeout

Opendajiaohuangwants to merge intofrom

Summary

Enforce a synchronous command's absolute totalTimeout deadline across the complete socket read, not only between retries. Before each readFully read, cap SO_TIMEOUT to the smaller of the remaining command deadline and configured socket idle timeout; restore the connection's original timeout afterward so timeout-delay recovery and pooled connections retain their existing behavior. Bind the deadline when Node checks out a connection and clear it when the connection returns to the pool. The behavior covers normal synchronous commands and streamed multi-command responses; totalTimeout = 0 remains unbounded.

This is independent of #680 / #681: those concern synchronous batch executor waiting; this change addresses the underlying per-read timeout gap reported in #682.

Test plan

  • Added a loopback-only slow-drip ServerSocket regression test with an 800 ms command deadline and 5 s socket timeout; it confirms partial bytes arrive and readFully times out before the socket idle timeout.
  • Registered the test in SuiteSync for normal suite execution; the targeted test selector remains server-independent.
  • mvn -f repo/pom.xml -pl test -am test -DskipTests=false -DrunSuite='**/ConnectionReadDeadlineTest.class' — 1 test passed, 0 failures/errors/skips (Temurin JDK 26, release target 21). This targeted run preceded the final SuiteSync registration-only edit; no Maven rerun was performed after that edit under the external toolchain-incident boundary.
  • git diff --check passed after the final source edits.

Prepared with AI assistance.