-
Notifications
You must be signed in to change notification settings - Fork 957
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
protocols/mdns: Allow users to choose between async-io and tokio runtime #2748
Conversation
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.
Thanks!
I think the feature itself is worthwhile having but we need to implement it slightly different. Commands like cargo build --all-features
should continue to work across the workspace.
Hi @thomaseizinge, thanks for the feedback, I will check it |
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.
Thanks!
I gave this a more in-depth read, please see the inline comments :)
Related issue on //CC @dignifiedquire |
Thanks @gallegogt for the thorough patch and thanks @thomaseizinger for the detailed reviews! |
@gallegogt let us know once this is ready for another review. |
Hi @mxinden it's ready for review |
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.
Thanks!
This looks really good now, I've left a couple more comments :)
Hi @mxinden @thomaseizinger it's ready for review |
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.
Thank you for incorporating the feedback :)
I think this is close to being mergeable. I made a few comments where we don't seem to be doing quite the same as previously. Please comment if that is on purpose, otherwise I'd prefer to stick to the previous logic.
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.
This looks good to me. Deferring final review to @thomaseizinger.
Thanks @gallegogt and @thomaseizinger for the solid work here!
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.
Thanks!
I've found too more misalignments with the previous version. Thanks for sticking to this :)
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.
Thanks for implementing all the feedback!
This is ready now :)
The |
I'll check it, but in my test environments work, I will try in other PC. |
It also fails on my local computer. I am running Manjaro Linux. |
@thomaseizinger , @mxinden
rustc 1.62.0 (a8314ef7d 2022-06-27) |
Failing on my machine as well:
|
Very rare situation, I guess tokio (explicitly non_blocking) takes longer to find the peers than AsynIO. If so, I increase the expiration time and query request a little |
That would be surprising to me, given that the timeout is on the order of seconds, still something worth trying @gallegogt. |
2c55c71
to
5c44f8a
Compare
Hi @mxinden and @thomaseizinger can you check if the error persist please ? |
Yep, CI is still failing. |
I can't reproduce it locally anymore :/ |
5b838e0
to
25d9b19
Compare
@thomaseizinger done with last comments. |
Thanks! Just one note for future PRs, we tend to not force-push on this repository because PRs will be squash-merged in the end so regular merge commits of e.g. |
I've kicked CI again and will merge once it passes! |
Given the latest release, this patch now targets `libp2p-mdns` `v0.40.0` and not `v0.39.0`.
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.
🙏 Thanks @gallegogt and @thomaseizinger!
I've just discovered this PR. Did we ever find out what causes this? If not, it seems to me that this PR was done to bypass the issue, not fix it. |
See #2591 for my investigation into this: the short story is that |
Problem
When use the Tokio library with mdns module, it is polling every time the UDP socket; causing hight CPU usage.
Solution
When using Tokio library, use the UppSocket provided by the Tokio library instead of the Async-io wrapper.
Breaking Change
After this fix exist two features
async-io
,tokio
for this module, for the general module must be use the featuresmdns-async-io
ormdns-tokio
for async-io or tokio librariesLinks to any relevant issues
Change checklist