Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle socket failures #2939

Closed
PaulOlteanu opened this issue Nov 15, 2024 · 0 comments · Fixed by #2946
Closed

Handle socket failures #2939

PaulOlteanu opened this issue Nov 15, 2024 · 0 comments · Fixed by #2946
Assignees
Milestone

Comments

@PaulOlteanu
Copy link
Contributor

related: quinn-rs/quinn#2011

If the underlying socket for an Endpoint fails, the Endpoint doesn't recover, with errors including:
probe failed: Failed to send STUN request: StunIpv4: Broken pipe (os error 32)

tick: probes timed out

no successful probes in ProbeSet

sendmsg error: Os { code: 32, kind: BrokenPipe, message: \"Broken pipe\" }, Transmit: { destination: 155.47.212.61:52827, src_ip: None, ecn: None, len: 124, segment_size: None }

This was reproducible on iOS by suspending and resuming the app after creating an Endpoint

@dignifiedquire dignifiedquire added this to the v0.29.0 milestone Nov 18, 2024
@dignifiedquire dignifiedquire self-assigned this Nov 19, 2024
@ramfox ramfox moved this to 📋 Backlog in iroh Nov 25, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 26, 2024
## Description

In order to handle supsension and exits on mobile. we need to rebind our
UDP sockets when they break.

This PR adds the ability to rebind the socket on errors, and does so
automatically on known suspension errors for iOS.

When reviewing this, please specifically look at the duration of lock
holding, as this is the most sensitive part in this code.


Some references for these errors

- libevent/libevent#1031
- #2939

### TODOs

- [x] code cleanup
- [x] testing on actual ios apps, to see if this actually fixes the
issues
- [ ] potentially handle port still being in use? this needs some more
thoughts

Closes #2939

## Breaking Changes

The overall API for `netmon::UdpSocket` has changed entirely, everything
else is the same.

## Notes & open questions

- I have tried putting this logic higher in the stack, but unfortunately
that did not work out.
- We might not want to infinitely rebind a socket if the same error
happens over and over again, unclear how to handle this.


## Change checklist

- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.

---------

Co-authored-by: Philipp Krüger <[email protected]>
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in iroh Nov 26, 2024
dignifiedquire added a commit to n0-computer/net-tools that referenced this issue Dec 2, 2024
## Description

In order to handle supsension and exits on mobile. we need to rebind our
UDP sockets when they break.

This PR adds the ability to rebind the socket on errors, and does so
automatically on known suspension errors for iOS.

When reviewing this, please specifically look at the duration of lock
holding, as this is the most sensitive part in this code.


Some references for these errors

- libevent/libevent#1031
- n0-computer/iroh#2939

### TODOs

- [x] code cleanup
- [x] testing on actual ios apps, to see if this actually fixes the
issues
- [ ] potentially handle port still being in use? this needs some more
thoughts

Closes #2939

## Breaking Changes

The overall API for `netmon::UdpSocket` has changed entirely, everything
else is the same.

## Notes & open questions

- I have tried putting this logic higher in the stack, but unfortunately
that did not work out.
- We might not want to infinitely rebind a socket if the same error
happens over and over again, unclear how to handle this.


## Change checklist

- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.

---------

Co-authored-by: Philipp Krüger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants