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

fix(libp2p): Updating nim-libp2p to fix the wss connectivity issue #1848

Merged

Conversation

Ivansete-status
Copy link
Collaborator

Description

  • The nim-libp2p adds many changes although we are actually interested in the latest commit:

wstransport.nim: avoid re-raising 'TransportOsError' to avoid stopping
switch.accept (#929)

  • The nim-stew bump is needed so that the nim-libp2p can compile.

  • The changes in waku_node.nim are needed due to the changes in nim-stew.

Issue

closes #1831

* The `nim-libp2p` adds many changes although we are actually interested
in the latest commit:

> wstransport.nim: avoid re-raising 'TransportOsError' to avoid stopping
`switch.accept` (#929)

* The `nim-stew` bump is needed so that the `nim-libp2p` can compile.

* The changes in `waku_node.nim` are needed due to the changes in
`nim-stew`.
@Ivansete-status
Copy link
Collaborator Author

Please don't check it just yet. I'll add reviewers once I confirm CI passes

@Ivansete-status Ivansete-status force-pushed the fix-1831-avoid-node-stop-attending-wss-requests branch from fa05e4d to aa9e56e Compare July 12, 2023 22:51
…Handler'

This is aimed to avoid the next exception happening in the wakunode:

```
Unhandled defect: Async procedure (service.nim(74)    callHandler)
yielded `nil`, are you await'ing a `nil` Future? [AssertionDefect]
```
@Ivansete-status
Copy link
Collaborator Author

Thanks so much indeed @rymnc for shedding a lot of light on a bug that I had! I'm super happy about it!

@Ivansete-status Ivansete-status marked this pull request as ready for review July 13, 2023 12:12
@rymnc
Copy link
Contributor

rymnc commented Jul 13, 2023

NICE! that bug was very cryptic!

@SionoiS
Copy link
Contributor

SionoiS commented Jul 13, 2023

I don't understand the fix. Do you have to yield back control to the async runtime because it block something else?

Comment on lines 122 to 131
proc statusAndConfidenceHandler(networkReachability: NetworkReachability,
confidence: Opt[float]):
Future[void] {.gcsafe, raises: [].} =
if confidence.isSome():
info "Peer reachability status", networkReachability=networkReachability, confidence=confidence.get()

let retFut = newFuture[void]()
retFut.complete()
return retFut

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
proc statusAndConfidenceHandler(networkReachability: NetworkReachability,
confidence: Opt[float]):
Future[void] {.gcsafe, raises: [].} =
if confidence.isSome():
info "Peer reachability status", networkReachability=networkReachability, confidence=confidence.get()
let retFut = newFuture[void]()
retFut.complete()
return retFut
proc statusAndConfidenceHandler(networkReachability: NetworkReachability,
confidence: Opt[float]):
Future[void] {.gcsafe, async.} =
if confidence.isSome():
info "Peer reachability status", networkReachability=networkReachability, confidence=confidence.get()

Sorry if I wasn't clear on discord, that is what I meant when I said "Some of the failures are because you removed the async from statusAndConfidenceHandler"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the comment @Menduist ! It is much better that way!

@Ivansete-status Ivansete-status force-pushed the fix-1831-avoid-node-stop-attending-wss-requests branch from b869d18 to 93281f9 Compare July 13, 2023 13:24
@Ivansete-status
Copy link
Collaborator Author

I don't understand the fix. Do you have to yield back control to the async runtime because it block something else?

Hey @SionoiS ! Kindly review the comments in the next issue: #1831
If they are not enough to get the picture I'll elaborate more on it.
Thanks!

@SionoiS
Copy link
Contributor

SionoiS commented Jul 13, 2023

I got confused by

let retFut = newFuture[void]()
    retFut.complete()
    return retFut

I get it now!

@Ivansete-status Ivansete-status merged commit 1d3410c into master Jul 13, 2023
15 checks passed
@Ivansete-status Ivansete-status deleted the fix-1831-avoid-node-stop-attending-wss-requests branch July 13, 2023 16:00
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.

bug: nodes don't respond after a while
4 participants