Write deadlock fixes and overall reliability improvements#30
Open
requilence wants to merge 7 commits intolibp2p:masterfrom
Open
Write deadlock fixes and overall reliability improvements#30requilence wants to merge 7 commits intolibp2p:masterfrom
requilence wants to merge 7 commits intolibp2p:masterfrom
Conversation
|
Do these issues also show up in the https://github.com/grandcat/zeroconf library that this fork is based on? If so I think it work benefit more folks to open the PR there. |
|
Also, could it be possible to add some tests here as well? |
|
friendly ping @requilence |
Member
|
Hi @requilence , go-libp2p maintainers are not prioritizing reviewing this atm. It would be great if you can split this PR into two: one for bugfixes and one for the reliability improvements. We can prioritize looking at the bugfix |
NetInterface: atomic set/has flag operations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have noticed that in some scenarios socket write(like here) can hang for indefinite time.
At least it reproducible in the latest MacOS release(13.2) when writing on some standard network interfaces.
In this case it blocks all the further writes to other interface and deadlock Shutdown
This PR introduce
WriteTimeoutandClientWriteTimeoutoption with default of 10 sec. It seems to be much more than ok. In my case it either writes under 10ms or hangs indefinitelyOverall if it will be timeout'ed we still have 3 tries in the probe
NetInterfacethat alongside the net.Interface stores the bitmask flagsMulticastJoinedandMessageSentseparately for IPv6 and IPv4.The reason behind this is that multicastResponse call without interface specified works in a way it iterates through all interface to send the message. This makes unregister tries to connect to interfaces that can be failed to join multicast group or send the announce - which is make no sense
On macOS I faced situations where some interface can join IPv6 multicast but can't join IPv4 multicast, or can announce on IPv6 but always hang(timeout) during announceText.
So
multicastResponsenow has an optional arguments to pass required flagsServerSelectIPTrafficoption similar to client'sSelectIPTrafficoption to disable IPv6 or IPv4 multicast.This seems pretty useful to have, because you have no other way to control it, and IPv6 multicast may be more tricky to support