-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix listener problems #540
Conversation
This should handle early breakages, where a failing connection would take out the listener entirely. There are probably other errors we should be handling here, like secure connection failures.
Instead of erroring out, which would break the listener, we instead log a message and continue. This is not an error, the internet is a place with lots of probing + connection failures.
peerstream would hang when it got many temporary errors. temp errors should not count as an error. Now, it will only exit when an error is not temporary. I kept the acceptErr channel because it will no longer cause a bad hang. The goroutine is exiting, so if it blocks until acceptErr is read, it's fine. If users launch tons of listers and see goroutines building up, they know they should be reading + logging those.
|
||
for { | ||
conn, err := listener.Accept() | ||
if err != nil && c.IsTemporary(c) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like were throwing errors away here that we may want to at least note somehow... maybe it should also take a func(err error)
so we can log those errors if we want?
It's a bit inconvenient to do meaningful CR on a PR when most of the new code exists in other repos. (It's less of an issue when the outside libraries are mature. However, when vendored code is new, we should expect one or two bugs to exist.) (Would be less of a concern if outside libraries are on a GitHub org with the same ACLs as this repo and we were to get into the practice of doing code reviews on the libraries on an individual basis.) |
Would it help if i linked to the relevant commit diffs?
this is feasible for some things, like peerstream. this is not feasible for everything, i will make tons of small, modular packages that transcend belonging to an org. I think we see things very differently on when to modularize. to help align our perspectives, here's some stuff that helps express how i approach this:
my thoughts are not the exact same substack's, but we align very well. We should identify which steps of modularizing things can be automated and which costs can be decreased. I actually timed myself modularizing
The total cost of modularizing it was a bit more than writing it in the first place, but i found an error while writing tests that probably saved us many hours down the road. The major costs for me were not actually vendoring, as i expected, but the rote work of godoc + package setup + tests. there may be a script that could automate this dramatically.
On the CR costs, perhaps what can help is:
As mentioned above, a github org will not work for everything and it will not work with other contributors, so we should not rely on it as a pre-requisite for modularity. |
Our listeners used to hang on accept errors, becuase:
This PR fixes all that and adds some tests.
thanks so much for finding these @whyrusleeping