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

[protocols/mdns] Remove Async<UdpSocket> and set the sockets as nonblocking #2738

Closed
wants to merge 1 commit into from

Conversation

gallegogt
Copy link
Contributor

Description

In the previous version of the code the readable and writable functions were running constantly causing high CPU consumption constantly when using tokio as runtime.

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

In the previous version of the code the readable and writable functions were running constantly causing high CPU consumption constantly when using tokio as runtime.

Fix libp2p#2591
Fix libp2p#2675
@gallegogt gallegogt changed the title Remove Async<UdpSocket> and set the sockets as nonblocking [protocols/mdns] Remove Async<UdpSocket> and set the sockets as nonblocking Jun 29, 2022
@mxinden
Copy link
Member

mxinden commented Jun 29, 2022

Thanks for the report. I was operating under the impression that async-io is compatible with tokio. Is that not the case?

I don't think the patch proposed here is a valid solution. E.g. using a plain std UdpSocket does not give us wake-ups whenever the socket is ready to send or receive.

See also #2591 //CC @rkuhn.

@gallegogt
Copy link
Contributor Author

Hi, thanks for you feedback, I'm going to close the PR, I still think it's a poor solution, I keep turning the problem around to find a better solution to the excessive CPU consumption that this module has.

I also think that using async-io when Tokyo is active is not a efficient solution since you are using two different reactors

@gallegogt gallegogt closed this Jun 30, 2022
@gallegogt gallegogt deleted the fix-mdns-high-cpu branch June 30, 2022 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants