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

bug: metadata might not always be available #1055

Closed
romanzac opened this issue Mar 15, 2024 · 0 comments · Fixed by #1056
Closed

bug: metadata might not always be available #1055

romanzac opened this issue Mar 15, 2024 · 0 comments · Fixed by #1056
Assignees
Labels
bug Something isn't working

Comments

@romanzac
Copy link
Collaborator

romanzac commented Mar 15, 2024

Describe the bug
During TestHandlePeerTopicEvent() execution nil pointer error occurred. Problem is with newly added Waku metadata check in handlerPeerTopicEvent(). This check pm.metadata.RelayShard() assumes metadata are always set.

To Reproduce

  1. Checkout f8a67f8 from chore: peermanager tests coverage improvement #1035
  2. Run go test

Expected behavior
Please add nil metadata situation handling or ensure metadata are never nil with example how to instantiate when no cluster/sharding has been created.

Test run log

2024-03-15T10:08:35.464+0800	INFO	gowaku.relay	relay/waku_relay.go:247	gossipsub subscription	{"pubsubTopic": "/waku/2/go/pm/test"}
2024-03-15T10:08:35.466+0800	INFO	gowaku.peer-manager	peermanager/topic_event_handler.go:25	handleNewRelayTopicSubscription	{"pubSubTopic": "/waku/2/go/pm/test"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x101377e58]

goroutine 2424 [running]:
github.com/waku-org/go-waku/waku/v2/protocol/metadata.(*WakuMetadata).RelayShard(0x5?)
	/Users/roman/sources/waku-org/go-waku/waku/v2/protocol/metadata/waku_metadata.go:82 +0x18
github.com/waku-org/go-waku/waku/v2/peermanager.(*PeerManager).handlerPeerTopicEvent(0x1400038fad0, {{0x1017c17b6, 0x12}, {0x14001d67560, 0x22}, 0x0})
	/Users/roman/sources/waku-org/go-waku/waku/v2/peermanager/topic_event_handler.go:124 +0x42c
github.com/waku-org/go-waku/waku/v2/peermanager.(*PeerManager).peerEventLoop(0x1400038fad0, {0x101d54bf8, 0x1400011e018})
	/Users/roman/sources/waku-org/go-waku/waku/v2/peermanager/topic_event_handler.go:174 +0x1e0
created by github.com/waku-org/go-waku/waku/v2/peermanager.TestHandlePeerTopicEvent
	/Users/roman/sources/waku-org/go-waku/waku/v2/peermanager/topic_event_handler_test.go:182 +0x5c8
exit status 2
FAIL	github.com/waku-org/go-waku/waku/v2/peermanager	8.491s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants