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

Remove unnecessary tokio::spawn #2407

Merged
merged 2 commits into from May 6, 2024
Merged

Remove unnecessary tokio::spawn #2407

merged 2 commits into from May 6, 2024

Conversation

viquezclaudio
Copy link
Contributor

@viquezclaudio viquezclaudio commented Apr 26, 2024

  • Unnecessary tokio spawn
  • This is not compatible with web clients (WASM)

This could explain the failure mentioned in #2404

Before this change regular nodes didn't try to connect to web clients, because they were filtered: web clients do not provide any service to regular nodes. This can be observed in this code.

This means that before, web clients were not responding to any of the consensus handlers.

However, after the handle incompatible peers commit, regular nodes can now perform head requests to web clients, which causes web clients to execute a tokio::spawn, which is not allowed (a special task executor is necessary in web environments).

This tokio::spawn seems unnecessary or superfluous (at least) according to the logic around it.

This fixes #2404 .

Pull request checklist

  • All tests pass. The project builds and runs.
  • I have resolved any merge conflicts.
  • I have resolved all clippy and rustfmt warnings.

Copy link
Member

@sisou sisou left a comment

Choose a reason for hiding this comment

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

Works! It might even have fixed the "closure invoked recursively or after being dropped" problem with libp2p's websocket-websys transport 😲

Copy link
Contributor

@hrxi hrxi left a comment

Choose a reason for hiding this comment

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

This tokio::spawn seems unnecessary or superfluous (at least) according to the logic around it.

It doesn't seem entirely superfluous, it makes sure that each request cannot block the rest of the requests. If that's still wanted, then this change is incorrect.

network-interface/src/request/mod.rs Outdated Show resolved Hide resolved
@jsdanielh jsdanielh force-pushed the viquezcl/remove_spawn branch 2 times, most recently from 8fe2a69 to 220d10b Compare May 6, 2024 16:06
- Unnecessary tokio spawn
- This is not compatible with web clients (WASM)
@jsdanielh
Copy link
Contributor

This tokio::spawn seems unnecessary or superfluous (at least) according to the logic around it.

It doesn't seem entirely superfluous, it makes sure that each request cannot block the rest of the requests. If that's still wanted, then this change is incorrect.

We will address this in a separate issue (#2434).

@jsdanielh jsdanielh added this to the Nimiq PoS Mainnet milestone May 6, 2024
@jsdanielh jsdanielh merged commit 41a666c into albatross May 6, 2024
6 checks passed
@jsdanielh jsdanielh deleted the viquezcl/remove_spawn branch May 6, 2024 16:48
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.

Browser light client cannot maintain connections
5 participants