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

fix: keep channels open #1183

Merged
merged 2 commits into from
Aug 6, 2024
Merged

fix: keep channels open #1183

merged 2 commits into from
Aug 6, 2024

Conversation

richard-ramos
Copy link
Member

@igor-sirotin reported the following error:

panic: send on closed channel

goroutine 228896 [running]:
github.com/waku-org/go-waku/waku/v2/api/publish.(*MessageQueue).Push(...)
        /Users/igorsirotin/Repositories/Status/status-go/vendor/github.com/waku-org/go-waku/waku/v2/api/publish/message_queue.go:131
github.com/status-im/status-go/wakuv2.(*Waku).Send(0x14002e9cf00, {0x14000bb8400?, 0xa?}, 0x1400347a000?, 0x107a22d50)
        /Users/igorsirotin/Repositories/Status/status-go/wakuv2/message_publishing.go:56 +0x140
github.com/status-im/status-go/wakuv2.(*PublicWakuAPI).Post(0x14006e4a3f0, {0x14001258f00?, 0x84?}, {{0x14001259100, 0x40}, {0x0, 0x0, 0x0}, {0x14001258f00, 0x40}, ...})
        /Users/igorsirotin/Repositories/Status/status-go/wakuv2/api.go:259 +0x568

Since this is happening because the channel is closed when the context is done, and the publish function is still being executed, attempting to add a message to the queue. To avoid this error, i just remove the need to close this channel, since it will be garbage collected eventually, since it will determine the channel to be unreachable will have its resources reclaimed whether or not it is closed, and also made Push and Pop functions cancelable by passing a context

Required to fix status-im/status-go#5661

Copy link
Collaborator

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@richard-ramos richard-ramos merged commit 4f1d692 into master Aug 6, 2024
12 checks passed
@richard-ramos richard-ramos deleted the fix/api-publishn branch August 6, 2024 20:06
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 this pull request may close these issues.

Panic on MessageQueue.Push in status-go tests
2 participants