Ouh, I bet I know what's happening: You are using a concrete Context
implementation that defines its methods on a value receiver, but pass it in
as a nil-pointer: https://go.dev/play/p/JH9MxwvmTw7
That way, the panic happens in autogenerated code (the implicit promoted
method from the value-type to the pointer-type) which then panics due to a
nil-pointer dereference. The panic message should then actually tell you
exactly that, though.

On Fri, May 12, 2023 at 9:32 AM Axel Wagner <axel.wagner...@googlemail.com>
wrote:

> What does the panic say? If it says "stack overflow", then yes, that's
> likely an infinite recursion. If not, then, no. My guess is, that it says
> "nil-pointer dereference".
>
> The `<autogenerated>` part probably means this is due to embedding. That
> is, the `Err` method on `valueCtx` is promoted from an embedded Context:
> https://cs.opensource.google/go/go/+/refs/tags/go1.20.4:src/context/context.go;l=599
> If that context was `nil` or otherwise invalid, that would explain why the
> panic happens. Though I'm not sure how that would happen, unless you use
> `unsafe` somewhere.
>
> On Fri, May 12, 2023 at 5:03 AM Andrew Athan <andrew...@gmail.com> wrote:
>
>> goroutine 1299607 [runnable]:
>> context.(*valueCtx).Err(0xc00a52c3c0?)
>> <autogenerated>:1 +0x3e
>> context.(*valueCtx).Err(0x48860a?)
>> <autogenerated>:1 +0x2a
>> ... repeats many many many times ...
>> ...additional frames elided...
>> created by
>> ....one_of_my_functions()
>> somefile.go:2092 +0x4a5
>>
>>
>> What is going on here? is this likely to be an infinite recursion or
>> similar within the context implementation or is this a normal thing to see?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/095c81e9-15c2-4c27-b913-f85a16ee4968n%40googlegroups.com
>> <https://groups.google.com/d/msgid/golang-nuts/095c81e9-15c2-4c27-b913-f85a16ee4968n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfF%2B3s-A78%3D2a0BWGgds5gSqRQLbTdKwx069Eag%2B1TXr5g%40mail.gmail.com.

Reply via email to