-
Notifications
You must be signed in to change notification settings - Fork 18k
context: panic: interface conversion: interface {} is bool, not chan struct {} // #51789
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
Comments
is there a full stacktrace? |
Yes
|
@gq0 have you tried reproducing with |
No, not yet. It takes some time to occur and not on all systems. But we give it a try. I think Regarding the type cancelCtx struct {
Context // 32 bit, is this right on armv7?
mu sync.Mutex // 64 bit
--> done atomic.Value // not 64 bit aligned?
....
} |
It's OK if What is not OK is using |
@ianlancetaylor, thanks for the clarification 👍🏻 |
It was an issue related to the passing of the context to a goroutine and wrapping of it later, similar buildkite/agent#1606 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It was not tested with 1.18 yet.
What operating system and processor architecture are you using (
go env
)?Linux 4.14.114 armv7l
What did you do?
We use the context to signal when to stop the goroutine in various places like shown below.
For a couple of months we randomly get on some of our IoT gateway in the field:
panic: interface conversion: interface {} is bool, not chan struct {}
At the point
<-ctx.Done()
Sometimes, it is not a boolean but rather a value attached to the context. But we couldn't identify a pattern yet.
What did you expect to see?
No panic, instead signaling on the done channel.
Hint
I am not 100% but could it be that the
done
atomic.Value
is not 64bit aligned? At least then, we might have issues with our 32bit arm architecture.https://go-review.googlesource.com/c/go/+/288193/4/src/context/context.go#342
The text was updated successfully, but these errors were encountered: