Skip to content

Conversation

@jollyjinx
Copy link

fixes #5285
I tried to write a test case, but it's a hard to reproduce error as it will not happen when just closing the connection from the server side. But as it happens in the wild and crashes it should behave correctly with this fix.

@lxbndr
Copy link
Contributor

lxbndr commented Nov 20, 2025

I can confirm this really happens. We had to patch it in our fork almost same way. We're using NSURLErrorUnknown code, but I think your guess is better, and NSURLErrorNetworkConnectionLost fits well for this state. And yes, we also have no idea how could this be triggered manually. So we have no tests, and did no attempt merging the patch to upstream. Would be really nice if this become accepted and landed.

Just nitpicking here, @jollyjinx, would you mind adjusting indentation? Alignment by first argument, like in similar error below your lines.

@jollyjinx jollyjinx changed the title fixed fatalError when connection was lost immediately after sending r… fixed #5285 fatalError when connection was lost immediately after sending r… Nov 23, 2025
@compnerd
Copy link
Member

@swift-ci please test

@parkera parkera requested a review from guoye-zhang November 24, 2025 21:15
@parkera
Copy link
Contributor

parkera commented Nov 24, 2025

@guoye-zhang please review

Copy link
Contributor

@guoye-zhang guoye-zhang left a comment

Choose a reason for hiding this comment

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

The change looks fine, but would be good to figure out how to reproduce this since there might be an underlying bug of the response getting lost

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.

Crash in FoundationNetworking/NativeProtocol.swift:240: Fatal error: Transfer completed, but there's no response

5 participants