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

Panic: Close of closed channel #3013

Open
ukane-philemon opened this issue Oct 10, 2024 · 1 comment
Open

Panic: Close of closed channel #3013

ukane-philemon opened this issue Oct 10, 2024 · 1 comment

Comments

@ukane-philemon
Copy link
Contributor


panic: close of closed channel

goroutine 3300 [running]:
github.com/dcrlabs/ltcwallet/spv.(*delayedCloser).closeNow.func1()
        /{redacted}/go/pkg/mod/github.com/dcrlabs/ltcwallet@v0.0.0-20240823165752-3e026e8da010/spv/query.go:1181 +0x1a
sync.(*Once).doSlow(0xc006464740?, 0x101f5f68d?)
        /usr/local/Cellar/go/1.22.4/libexec/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        /usr/local/Cellar/go/1.22.4/libexec/src/sync/once.go:65
github.com/dcrlabs/ltcwallet/spv.(*delayedCloser).closeNow(0xc008625500?)
        /redacted}/go/pkg/mod/github.com/dcrlabs/ltcwallet@v0.0.0-20240823165752-3e026e8da010/spv/query.go:1180 +0x3c
github.com/dcrlabs/ltcwallet/spv.(*delayedCloser).closeEventually.func1()
        /redacted}/go/pkg/mod/github.com/dcrlabs/ltcwallet@v0.0.0-20240823165752-3e026e8da010/spv/query.go:1174 +0xaa
created by github.com/dcrlabs/ltcwallet/spv.(*delayedCloser).closeEventually in goroutine 2262
        /redacted}/go/pkg/mod/github.com/dcrlabs/ltcwallet@v0.0.0-20240823165752-3e026e8da010/spv/query.go:1167 +0x67
        
@ukane-philemon
Copy link
Contributor Author

github.com/dcrlabs/ltcwallet@v0.0.0-20240823165752-3e026e8da010/spv/query.go:1181

// closeNow immediately closes the subject channel. This can safely be called
// multiple times as it will only attempt to close the channel at most once.
func (t *delayedCloser) closeNow() {
	t.once.Do(func() {
		close(t.subject) // This is where the panic came from, It would have been safer to check if the channel is closed before attempting.
	})
}

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

No branches or pull requests

1 participant