> What you really want is the stack trace for the goroutine that created 
the leaking goroutine, at the time that the leak was created.

GODEBUG=tracebackancestors=1 ought to show that. tracebackancestors is new 
in Go 1.11 IIRC.

https://golang.org/pkg/runtime/#hdr-Environment_Variables



On Thursday, November 8, 2018 at 9:51:12 AM UTC-8, Jake Montgomery wrote:
>
> I would point out that this *is *the whole stack trace *of the goroutine*. 
> In fact, the actual stack trace is just the first line, since the goroutine 
> in question is only one function deep. If you are breaking into your 
> program after the leaking has started, then the function that created the 
> goroutine has long since exited, and its stack no longer exists. 
>
> What you really want is the stack trace for the goroutine that created the 
> leaking goroutine, at the time that the leak was created. I suggest you put 
> a break point on (*Transport).dialConn, or 
> /usr/local/go/src/net/http/transport.go:1117 and run your program to see 
> where these are being created. You might also be able to figure it out by 
> looking at the go library source code and tracing back from 
> (*Transport).dialConn. In any case, that should give you a place to start.
>
> Good Luck. 
>
> On Tuesday, November 6, 2018 at 10:55:24 PM UTC-5, rickyu...@gmail.com 
> wrote:
>>
>> I have a lot of leaking goroutines in my code over a span of time. I am 
>> trying to debug it but I can't seem to figure out from where these are 
>> occuring from.
>> Any help in finding the source is helpful.
>>
>>
>> goroutine 2329 [select, 1281 minutes]:
>> net/http.(*persistConn).readLoop(0xc420a80120)
>>      /usr/local/go/src/net/http/transport.go:1599 +0x9ec
>> created by net/http.(*Transport).dialConn
>>      /usr/local/go/src/net/http/transport.go:1117 +0xa35
>>
>>
>> Thanks,
>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to