You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's possible to create an invalid Context that can propagate through the program and later cause a nil dereference panic when Value is called: https://play.golang.org/p/zJMpPmKL5M7
One of the trickier things about this is that the context will work as expected until you try to look up a Value that isn't in the context: https://play.golang.org/p/aLyNCZTeWN8
Because of this and the nature of the Context as a carrier of data, etc. across API boundaries, the source of the bad context and the place where the panic occurs are often in entirely unrelated pieces of code, making tracking down the bug difficult.
What did you expect to see?
WithValue should panic when passed a nil parent context.
What did you see instead?
WithValue returns a Context that can later cause a panic.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
It's possible to create an invalid Context that can propagate through the program and later cause a
nil
dereference panic whenValue
is called:https://play.golang.org/p/zJMpPmKL5M7
One of the trickier things about this is that the context will work as expected until you try to look up a
Value
that isn't in the context:https://play.golang.org/p/aLyNCZTeWN8
Because of this and the nature of the
Context
as a carrier of data, etc. across API boundaries, the source of the bad context and the place where the panic occurs are often in entirely unrelated pieces of code, making tracking down the bug difficult.What did you expect to see?
WithValue
should panic when passed anil
parent context.What did you see instead?
WithValue
returns aContext
that can later cause a panic.The text was updated successfully, but these errors were encountered: