Re: [go-nuts] interpreting runtime.Stack()

2023-05-12 Thread Andrew Athan
This stack trace was indeed a contexts with very deep parenthood.

On Friday, May 12, 2023 at 8:34:40 AM UTC-7 Andrew Athan wrote:

> Alex:
>
> I’ll see how/if this can happen. Among other strangeness in this stack is 
> that Err() doesn’t take a param but I guess it may be displaying the 
> implicit “this”?
>
> btw this is not from a panic, but from a call to runtime.Stack(). The 
> program experiences unbounded growth in cpu  utilization as it runs so 
> either these stacks are a recursion bc there is a context “pointing” to 
> itself as parent or a very deep reference stack.
>
> I’m going to guess there is a captured continuation variable somewhere 
> that is incorrectly updated to a new value ctx with each new connection 
> made or inside some loop instead of using the oroginal basr ctx.
>
> I looked for that originally but didn’t find it, but I’ll look again. I’m 
> concerned that net.Conn’s or tls.Conn’s setRead/WriteDeadline() calls are 
> at fault somehow.
>
> A.
>
>
>
> On May 12, 2023, at 12:38 AM, Axel Wagner  
> wrote:
>
> 
>
> 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  
> 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 `` 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  wrote:
>>
>>> goroutine 1299607 [runnable]:
>>> context.(*valueCtx).Err(0xc00a52c3c0?)
>>> :1 +0x3e
>>> context.(*valueCtx).Err(0x48860a?)
>>> :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...@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
>>>  
>>> 
>>> .
>>>
>>

-- 
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/20f8fdd6-d42b-4ab8-8024-61f9c7471b46n%40googlegroups.com.


Re: [go-nuts] interpreting runtime.Stack()

2023-05-12 Thread Andrew Athan
Alex:I’ll see how/if this can happen. Among other strangeness in this stack is that Err() doesn’t take a param but I guess it may be displaying the implicit “this”?btw this is not from a panic, but from a call to runtime.Stack(). The program experiences unbounded growth in cpu  utilization as it runs so either these stacks are a recursion bc there is a context “pointing” to itself as parent or a very deep reference stack.I’m going to guess there is a captured continuation variable somewhere that is incorrectly updated to a new value ctx with each new connection made or inside some loop instead of using the oroginal basr ctx.I looked for that originally but didn’t find it, but I’ll look again. I’m concerned that net.Conn’s or tls.Conn’s setRead/WriteDeadline() calls are at fault somehow.A.On May 12, 2023, at 12:38 AM, Axel Wagner  wrote: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/JH9MxwvmTw7That 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  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 `` 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=599If 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  wrote:goroutine 1299607 [runnable]:context.(*valueCtx).Err(0xc00a52c3c0?)	:1 +0x3econtext.(*valueCtx).Err(0x48860a?)	:1 +0x2a... repeats many many many times ..additional frames elided...created byone_of_my_functions()	somefile.go:2092 +0x4a5What 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.






-- 
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/BBBF1FFC-FFCF-4FA7-B636-BC8B5B4911C1%40gmail.com.


Re: [go-nuts] interpreting runtime.Stack()

2023-05-12 Thread 'Axel Wagner' via golang-nuts
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 
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 `` 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  wrote:
>
>> goroutine 1299607 [runnable]:
>> context.(*valueCtx).Err(0xc00a52c3c0?)
>> :1 +0x3e
>> context.(*valueCtx).Err(0x48860a?)
>> :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
>> 
>> .
>>
>

-- 
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.


Re: [go-nuts] interpreting runtime.Stack()

2023-05-12 Thread 'Axel Wagner' via golang-nuts
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 `` 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  wrote:

> goroutine 1299607 [runnable]:
> context.(*valueCtx).Err(0xc00a52c3c0?)
> :1 +0x3e
> context.(*valueCtx).Err(0x48860a?)
> :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
> 
> .
>

-- 
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/CAEkBMfHzNN8ROimg7MmotjBDj_ZJcEWoQcLq8xQkaDnc7BPWLg%40mail.gmail.com.