Skip to content

Issue #198: Streaming command fails with a spurious timeout when reconnecting after an idle pause - #200

Merged
NassimBtk merged 2 commits into
mainfrom
bugfix/issue-198-streaming-command-fails-with-a-spurious-timeout-when-reconnecting-after-an-idle-pause
Oct 9, 2026
Merged

NassimBtk merged 2 commits into
mainfrom
bugfix/issue-198-streaming-command-fails-with-a-spurious-timeout-when-reconnecting-after-an-idle-pause

Conversation

@NassimBtk

Copy link
Copy Markdown
Collaborator

Fixes #198

Problem

In streaming mode, HttpTransport.post() set a fresh per-leg deadline before each request, but the explicit transport.connect() that WsmanClient.send() makes after a dropped connection did not. It reused the deadline left by the previous leg.

After a pause longer than the inactivity timeout (e.g. a slowly read RemoteProcess, with the host dropping the idle keep-alive connection meanwhile), that deadline had already expired. The TCP connect and the TLS handshake then got the 1 ms floor and failed with a SocketTimeoutException, reported as No response from the WinRM service.

Fix

  • HttpTransport.connect() sets the per-leg deadline itself when deadlinePerLeg is on, so an explicit reconnection is a leg of its own.
  • post() now goes through connect(), so the deadline is set in one place only.
  • pollTimeout mode (one absolute deadline shared by all legs) and blocking mode (no deadline) are unchanged.

This also makes the documented retry behavior true for streaming terminals: each connection attempt is bounded by that timeout (timeouts-and-errors.md). Before the fix, a retried reconnection inherited the stale deadline too.

Tests

  • New HttpTransportDeadlineTest.aStreamingReconnectGetsAFreshDeadline: a fake TLS peer reads the ClientHello, waits 200 ms, then hangs up. After one streaming leg and a pause past its deadline, connect() must see the hang-up instead of timing out.
  • Against the old code, the test fails with SocketTimeoutException: Read timed out.
  • mvn verify: 332 tests pass (9 skipped, the live tests). Checkstyle, PMD and SpotBugs report nothing.

Note

Once #196 is merged as well, its extra configureTimeouts(...) call after the best-effort Delete in startCommand() is probably redundant. Check before removing it: in pollTimeout mode that call also resets the shared deadline.

🤖 Generated with Claude Code

NassimBtk and others added 2 commits October 7, 2026 16:54
In streaming mode, post() armed a fresh per-leg deadline, but the
explicit transport.connect() that WsmanClient.send() makes after a
dropped connection reused the previous leg's deadline. After a pause
longer than the inactivity timeout, that deadline had expired and the
TCP connect and TLS handshake got a 1 ms budget, surfacing as a
spurious "No response from the WinRM service" timeout.

connect() now arms the per-leg deadline itself, and post() goes through
connect(). The pollTimeout (shared absolute deadline) and blocking
(no deadline) modes are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T17:20:20.908022Z ce0fdb1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@NassimBtk NassimBtk changed the title Streaming command fails with a spurious timeout when reconnecting after an idle pause (#198) Issue #198: Streaming command fails with a spurious timeout when reconnecting after an idle pause Oct 7, 2026
@NassimBtk
NassimBtk requested a review from bertysentry October 7, 2026 17:47
@NassimBtk
NassimBtk merged commit 3d49249 into main Oct 9, 2026
5 checks passed
@NassimBtk
NassimBtk deleted the bugfix/issue-198-streaming-command-fails-with-a-spurious-timeout-when-reconnecting-after-an-idle-pause branch October 9, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming command fails with a spurious timeout when reconnecting after an idle pause

2 participants