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: panic due to closed channel #1115

Merged
merged 7 commits into from
Jun 7, 2024
Merged

Conversation

chaitanyaprem
Copy link
Collaborator

@chaitanyaprem chaitanyaprem commented May 29, 2024

Description

Noticed while dogfooding status-desktop with new filter-mgmt changes that sometimes shutdown/cleanup is causing a panic due to double close on channel. Below is backtrace.

Modified strategy to not close closing channel rather use a bool channel so that even parallel close doesn't cause panic.

panic: close of closed channel

goroutine 21041 [running]:
github.com/waku-org/go-waku/waku/v2/protocol/filter.(*WakuFilterLightNode).PingPeer(0x14000152a10, {0x14000887ef0, 0x27})
	/Users/prem/Code/status-desktop/vendor/status-go/vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/filter_health_check.go:31 +0x278
created by github.com/waku-org/go-waku/waku/v2/protocol/filter.(*WakuFilterLightNode).PingPeers
	/Users/prem/Code/status-desktop/vendor/status-go/vendor/github.com/waku-org/go-waku/waku/v2/protocol/filter/filter_health_check.go:15 +0x38

@status-im-auto
Copy link

status-im-auto commented May 29, 2024

Jenkins Builds

Click to see older builds (5)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ bb3fff3 #1 2024-05-29 09:06:42 ~2 min nix-flake 📄log
✔️ 57378a5 #2 2024-05-29 10:52:05 ~1 min nix-flake 📄log
✔️ 6d7f8f8 #3 2024-06-03 09:58:39 ~2 min nix-flake 📄log
✔️ c5f46b6 #4 2024-06-05 10:49:55 ~1 min nix-flake 📄log
✔️ 234ab6a #5 2024-06-05 16:16:34 ~1 min nix-flake 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a5271d0 #6 2024-06-05 16:18:29 ~1 min nix-flake 📄log
✔️ df3a725 #7 2024-06-07 07:13:27 ~1 min nix-flake 📄log

@chaitanyaprem chaitanyaprem changed the title fix: avoid closing channel during cleanup in order to avoid panic fix: modify channel from using close to a bool channel in order to avoid panic Jun 3, 2024
@chaitanyaprem chaitanyaprem changed the title fix: modify channel from using close to a bool channel in order to avoid panic fix: panic due to closed channel Jun 3, 2024
Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

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

Not sure why the change from chan struct{} to chan bool but other than that, LGTM!

@chaitanyaprem
Copy link
Collaborator Author

Not sure why the change from chan struct{} to chan bool but other than that, LGTM!

Hmm, i think i can revert back now since i had moved to a method with a lock.
Will do it little later after dealing with other issues.

@chaitanyaprem chaitanyaprem merged commit 389b359 into master Jun 7, 2024
12 checks passed
@chaitanyaprem chaitanyaprem deleted the fix/filter-cleanup-race branch June 7, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants