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

evdns: recreate ns socket after ENOTCONN #1031

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

okhowang
Copy link
Contributor

@okhowang okhowang commented May 28, 2020

with ghazel's patch.

Closes: #265

@okhowang
Copy link
Contributor Author

there is no other change except evdns.c.
failed tests is likely to be not robust?

@azat
Copy link
Member

azat commented Jun 1, 2020

failed tests is likely to be not robust?

yes, you can safely ignore them

evdns.c Outdated Show resolved Hide resolved
Copy link
Member

@azat azat left a comment

Choose a reason for hiding this comment

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

Can you provide system calls trace for this problem? (with evdns logging enabled)

@azat azat changed the title recreate socket when udp failed evdns: recreate ns socket after ENOTCONN Jun 1, 2020
@okhowang
Copy link
Contributor Author

okhowang commented Jun 8, 2020

Can you provide system calls trace for this problem? (with evdns logging enabled)

I'm sorry, I can't reproduce the error in my device.
but it appear in our users's device which can't enable evdns log.

evdns.c Show resolved Hide resolved
@azat
Copy link
Member

azat commented Jun 8, 2020

I'm sorry, I can't reproduce the error in my device.

Ok, this doesn't look hurmful, so this can be merged
But this doesn't have a reproducer, I wish we could at it..

evdns.c Outdated Show resolved Hide resolved
evdns.c Outdated Show resolved Hide resolved
evdns.c Outdated Show resolved Hide resolved
@azat azat merged commit efbe563 into libevent:master Jun 9, 2020
@okhowang okhowang deleted the evdns/ENOTCONN branch June 11, 2020 02:09
github-merge-queue bot pushed a commit to n0-computer/iroh that referenced this pull request 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

evdns loops forever if UDP socket gets ENOTCONN
2 participants