Skip to content

Accept Broken pipe in ExceptionContractFixture rejected-connection test - #737

Merged
sburmanoctopus merged 1 commit into
mainfrom
levi/accept-broken-pipe-in-exception-contract
Nov 16, 2026
Merged

sburmanoctopus merged 1 commit into
mainfrom
levi/accept-broken-pipe-in-exception-contract

Conversation

@sburmanoctopus

@sburmanoctopus sburmanoctopus commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Background

ExceptionContractFixture.WhenTheListeningRequestFailsToBeSent_AsTheServiceRejectsTheConnection_AHalibutClientExceptionShouldBeThrown fails now and then on Linux. It has failed twice so far, most recently in Linux test 25132807, and that failure blocked both the Full Chain and Nightly builds.

The test gets the expected HalibutClientException, but the message ends in Broken pipe. That message isn't in the list the test accepts.

Results

Fixes LEV-2086

When the port forwarder kills the connection, the client can write to a socket the peer has already reset. When that happens on Linux, the error is EPIPE ("Broken pipe") rather than the read/write/EOF errors the test already accepts. Halibut is behaving correctly: it throws the right exception type, marked as failing before the request could begin. Only the test needs to change.

This PR adds Broken pipe to the messages the test accepts, the same way #710 added the Windows connect-timeout message.

🤖 Generated with Claude Code

On Linux, when the port forwarder kills the connection, the client can
write to a socket the peer has already reset and get EPIPE ("Broken pipe")
instead of the read/write/EOF errors already accepted. Halibut still
throws the expected HalibutClientException before the request begins, so
accept this wording too.

Fixes LEV-2086

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sburmanoctopus
sburmanoctopus requested a review from a team as a code owner November 15, 2026 23:09

@akirayamamoto akirayamamoto left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for unblocking the builds.

One small thing for the description: "IsNetworkError still classifies it as a network error" isn't always true. If the pipe breaks during the Halibut handshake, the error gets wrapped in ConnectionInitializationFailedException, and IsNetworkError doesn't look inside it, so it returns UnknownError. I confirmed this with a quick unit test.

It doesn't look like this affects users though. Tentacle client still retries UnknownError, and Server metrics count it as a network failure. The only difference I could find is the label in a Server warning log.

Possible follow-ups, both low priority:

  1. If this keeps flaking, we could assert only the exception type and the "before the request could begin" prefix, and drop the error text after it. The test can't control exactly how the connection fails, so it probably shouldn't assert on it.
  2. If someone is in that code anyway, IsNetworkError could check what's inside ConnectionInitializationFailedException.

(Disclaimer: I found and explored this with Claude, so worth a second look.)

@sburmanoctopus
sburmanoctopus merged commit da3b8ca into main Nov 16, 2026
13 checks passed
@sburmanoctopus
sburmanoctopus deleted the levi/accept-broken-pipe-in-exception-contract branch November 16, 2026 21:33
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.

2 participants