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

invalid memory address or nil pointer dereference in go-libp2p/p2p/transport/websocket #1769

Closed
JamesHertz opened this issue Sep 20, 2022 · 6 comments · Fixed by #1770
Closed
Assignees

Comments

@JamesHertz
Copy link

After a bit of pain, I was finally able to compile ipfs using the most up-to-date version of go-libp2p. I literally cloned this repository and redirected the ipfs github.com/libp2p to it.
I had all this work just to add a new protocol to libp2p and run it on ipfs. But after a few times running ipfs I got this. I don't believe the protocol I added made this bug so I'm reporting it. I hope you fix it as soon as possible :)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x1805475]

goroutine 1287614 [running]:
github.com/libp2p/go-libp2p/p2p/transport/websocket.(*WebsocketTransport).maDial(0xc001938540, {0x2a442c8, 0xc012642420}, {0x2a58cc0, 0xc00de0c720})
github.com/libp2p/[email protected]/p2p/transport/websocket/websocket.go:186 +0x155
github.com/libp2p/go-libp2p/p2p/transport/websocket.(*WebsocketTransport).Dial(0xc001938540, {0x2a442c8, 0xc012642420}, {0x2a58cc0, 0xc00de0c720}, {0xc00c4e61e0, 0x26})
github.com/libp2p/[email protected]/p2p/transport/websocket/websocket.go:162 +0xc5
github.com/libp2p/go-libp2p/p2p/net/swarm.(*Swarm).dialAddr(0xc000c31ba0, {0x2a442c8, 0xc012642420}, {0xc00c4e61e0, 0x26}, {0x2a58cc0?, 0xc00de0c720})
github.com/libp2p/[email protected]/p2p/net/swarm/swarm_dial.go:483 +0x1f1
github.com/libp2p/go-libp2p/p2p/net/swarm.(*dialLimiter).executeDial(0xc000c1d590, 0xc012d74740)
github.com/libp2p/[email protected]/p2p/net/swarm/limiter.go:219 +0xf0
created by github.com/libp2p/go-libp2p/p2p/net/swarm.(*dialLimiter).addCheckFdLimit
github.com/libp2p/[email protected]/p2p/net/swarm/limiter.go:169 +0x4aa

@MarcoPolo MarcoPolo self-assigned this Sep 20, 2022
@MarcoPolo
Copy link
Collaborator

Thanks for the bug report. This is my fault. I didn't expect the websocket client to have a nil tls client config. Fix coming right up!

@JamesHertz
Copy link
Author

It happened again. I don't know why but it mostly happens when my ipfs node connects to over 900 peers.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x180b035]

goroutine 220345 [running]:
github.com/libp2p/go-libp2p/p2p/transport/websocket.(*WebsocketTransport).maDial(0xc000a774d0, {0x2a4c448, 0xc00ba94fc0}, {0x2a60e80, 0xc00c22fdb8})
github.com/libp2p/[email protected]/p2p/transport/websocket/websocket.go:186 +0x155
github.com/libp2p/go-libp2p/p2p/transport/websocket.(*WebsocketTransport).Dial(0xc000a774d0, {0x2a4c448, 0xc00ba94fc0}, {0x2a60e80, 0xc00c22fdb8}, {0xc007e96c00, 0x26})
github.com/libp2p/[email protected]/p2p/transport/websocket/websocket.go:162 +0xc5
github.com/libp2p/go-libp2p/p2p/net/swarm.(*Swarm).dialAddr(0xc000c64b60, {0x2a4c448, 0xc00ba94fc0}, {0xc007e96c00, 0x26}, {0x2a60e80?, 0xc00c22fdb8})
github.com/libp2p/[email protected]/p2p/net/swarm/swarm_dial.go:483 +0x1f1
github.com/libp2p/go-libp2p/p2p/net/swarm.(*dialLimiter).executeDial(0xc000c5c5f0, 0xc00d305700)
github.com/libp2p/[email protected]/p2p/net/swarm/limiter.go:219 +0xf0
created by github.com/libp2p/go-libp2p/p2p/net/swarm.(*dialLimiter).addCheckFdLimit
github.com/libp2p/[email protected]/p2p/net/swarm/limiter.go:169 +0x4aa

@MarcoPolo
Copy link
Collaborator

Yeah, this will happen whenever you dial to a node that advertises a websocket address. You could try using the branch with the fix in it marco/fix-nil-pointer and that should fix this for you until we merge that and release

@JamesHertz
Copy link
Author

Sorry, I thought you guys had already merged it.
I ran it again and it didn't crash even with more than 900 peers.
Thank you for fixing it!!!

@MarcoPolo
Copy link
Collaborator

No problem! I’ll leave this open until we actually merge it :)

@MarcoPolo MarcoPolo reopened this Sep 21, 2022
@JamesHertz
Copy link
Author

okok

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 a pull request may close this issue.

2 participants