waku-org / nwaku

Waku node and protocol.
Other
183 stars 46 forks source link

fix: wakuy/factory/internal_config.nim: refactor enrConfiguration to avoid crash #2659

Closed Ivansete-status closed 2 weeks ago

Ivansete-status commented 2 weeks ago

Description

It happened a crash when running wakunode2 with the following params: ./build/wakunode2 --config-file=cfg_node_a.txt

And using the following config file: cfg_node_a.txt

The node crashed with the following because it was trying to log an error-result which actually was an ok(none(...)):

INF 2024-05-02 13:14:57.405+02:00 Running nwaku node                         topics="wakunode main" tid=351868 file=wakunode2.nim:122 version=v0.27.0-rc.0-38-g404810
INF 2024-05-02 13:14:57.406+02:00 Configuration: Enabled protocols           topics="wakunode main" tid=351868 file=wakunode2.nim:30 relay=true rlnRelay=false store=false filter=true lightpush=true peerExchange=false
INF 2024-05-02 13:14:57.406+02:00 Configuration. Network                     topics="wakunode main" tid=351868 file=wakunode2.nim:38 cluster=0 maxPeers=none(int)
INF 2024-05-02 13:14:57.406+02:00 Configuration. Shards                      topics="wakunode main" tid=351868 file=wakunode2.nim:41 shard=/waku/2/default-waku/proto
NTC 2024-05-02 13:14:57.406+02:00 REST service started                       tid=351868 file=server.nim:189 address=127.0.0.1:8646
INF 2024-05-02 13:14:57.406+02:00 Starting REST HTTP server                  tid=351868 file=builder.nim:109 url=http://127.0.0.1:8646/
DBG 2024-05-02 13:14:57.406+02:00 Retrieve dynamic bootstrap nodes           topics="wakunode main" tid=351868 file=app.nim:90
DBG 2024-05-02 13:14:57.406+02:00 No method for retrieving dynamic bootstrap nodes specified. topics="waku dnsdisc" tid=351868 file=waku_dnsdisc.nim:131
/home/ivansete/workspace/status/nwaku/apps/wakunode2/wakunode2.nim(138) wakunode2
/home/ivansete/workspace/status/nwaku/waku/factory/app.nim(101) init
/home/ivansete/workspace/status/nwaku/waku/factory/node_factory.nim(406) setupNode
/home/ivansete/workspace/status/nwaku/vendor/nim-chronicles/chronicles.nim(170) enrConfiguration
/home/ivansete/workspace/status/nwaku/vendor/nim-results/results.nim(906) error
/home/ivansete/workspace/status/nwaku/vendor/nim-results/results.nim(376) raiseResultDefect
Error: unhandled exception: Trying to access error when value is set: none(RelayShards) [ResultDefect]
github-actions[bot] commented 2 weeks ago

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2659-rln-v1

Built from 7f1e9e040ce9254bae9b2e5dc5bb3040bb0be10d

github-actions[bot] commented 2 weeks ago

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2659-rln-v2

Built from 7f1e9e040ce9254bae9b2e5dc5bb3040bb0be10d

Ivansete-status commented 2 weeks ago

I'm closing that one without merging it as we already fixed it today :partying_face: Thanks for the review guys!