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

Graceful shutdown process reported as error in logs. #1007

Open
cheatfate opened this issue Jan 9, 2024 · 4 comments · May be fixed by #1065
Open

Graceful shutdown process reported as error in logs. #1007

cheatfate opened this issue Jan 9, 2024 · 4 comments · May be fixed by #1065
Assignees

Comments

@cheatfate
Copy link
Contributor

This error statement has been shown on normal shutdown process:

ERR 2024-01-08 18:13:22.437+00:00 Exception in accept loop, exiting topics="libp2p switch" exc="Transport closed, no more connections!"

It happens because of this handler https://github.com/status-im/nim-libp2p/blob/e3c967ad1939fb33b8e13759037d193734acd202/libp2p/switch.nim#L276 which do not knows anything about TransportUseClosedError which can be raised https://github.com/status-im/nim-libp2p/blob/unstable/libp2p/transports/tcptransport.nim#L247-L249 and https://github.com/status-im/nim-libp2p/blob/unstable/libp2p/transports/wstransport.nim#L283-L285

@AlejandroCabeza
Copy link
Collaborator

@cheatfate I don't think I follow what you meant. The links you sent don't match with what you mention (I believe). There is a TransportUseClosedError handled (and re-reased) nearby, but none of those links points to it.

One of them points to this piece of code in the same function as the aforementioned except TransportUseClosedError:

  except HttpError as exc:
    debug "Http Error", exc = exc.msg
  except AsyncStreamError as exc:

And the other points to the parameters of the next function, which seems to be unrelated to any TransportUseClosedError:

  hostname: string,
  address: MultiAddress,
  peerId: Opt[PeerId] = Opt.none(PeerId)): Future[Connection] {.async.} =

Do you mean that the "normal shutdown process" somehow triggers the except CatchableError line in the accept proc in switch.nim?

@cheatfate
Copy link
Contributor Author

cheatfate commented Mar 11, 2024

Everything what falls into

error "Exception in accept loop, exiting", exc = exc.msg

looks like serious error, and nimbus consumers actually asking what the error is. But this error happens when TransportUseClosedError happens and got catched by this handler. This specific exception MUST not be reported as error type of logs.

@diegomrsantos
Copy link
Contributor

diegomrsantos commented Mar 15, 2024

Please, next time it'd be great to have what the expected behavior should be when describing the issue.

@diegomrsantos
Copy link
Contributor

@cheatfate do you have more logs related to it? The error msg "Transport closed, no more connections!" is created by

proc newTransportClosedError*(parent: ref Exception = nil): ref LPError =
and can also happen at
raise newTransportClosedError()
.

Was there a log "Server was closed" before the one you reported? If it was indeed caused by TransportUseClosedError, there should be one

debug "Server was closed", exc = exc.msg
.

@kaiserd kaiserd moved this to new in nim-libp2p May 2, 2024
@kaiserd kaiserd moved this from new to In Progress in nim-libp2p May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pipeline
Development

Successfully merging a pull request may close this issue.

3 participants