Nimsuggest crash on libp2p example
Nim Version
Nim Compiler Version 2.2.4 [Linux: amd64] Compiled at 2025-04-22 Copyright (c) 2006-2025 by Andreas Rumpf
git hash: f7145dd26efeeeb6eeae6fff649db244d81b212d active boot switches: -d:release
Description
nimsuggest is crashing when trying to analyze this example file from the libp2p repository:
import chronos
import libp2p
import libp2p/protocols/ping
proc createSwitch(ma: MultiAddress, rng: ref HmacDrbgContext): Switch =
var switch = SwitchBuilder
.new()
.withRng(rng)
.withAddress(ma)
.withTcpTransport()
.withMplex()
.withNoise()
.build()
return switch
proc main() {.async.} =
let
rng = newRng()
localAddress = MultiAddress.init("/ip4/0.0.0.0/tcp/0").tryGet()
pingProtocol = Ping.new(rng = rng)
let
switch1 = createSwitch(localAddress, rng)
switch2 = createSwitch(localAddress, rng)
switch1.mount(pingProtocol)
await switch1.start()
await switch2.start()
let conn =
await switch2.dial(switch1.peerInfo.peerId, switch1.peerInfo.addrs, PingCodec)
echo "ping: ", await pingProtocol.ping(conn)
await conn.close()
await allFutures(switch1.stop(), switch2.stop())
waitFor(main())
Current Output
When trying to do a suggestion from a randomly selected line it prints a list of errors long enough that my terminal can't print them all. If there is a way to save that output to a log file I can include that.
Expected Output
Known Workarounds
No response
Additional Information
I originally noticed this issue when using nimlangserver on NeoVim. When opening the file nimlangserver proceeded to eat up all my system resources until my windows manager crashed.
Is this also reproducible with nim check?
If I nim check ./src/main.nim it gives this hint
152384 lines; 5.529s; 666.516MiB peakmem; proj: /home/emmanuel/projects/blockchain/src/main.nim; out: unknownOutput [SuccessX]
Ok, so it really is nimsuggest specific then.