http.client.Do(request) panics in highly concurrent apps (Go 1.14.1)

379 views
Skip to first unread message

hamid....@rvu.co.uk

unread,
Apr 2, 2020, 12:38:37 PM4/2/20
to golang-nuts
Hi folks,

An issue with the latest version of Go (1.14.1). My application panics when making concurrent http GET requests to another API.

Unfortunately it's not possible to post the code here but it should be pretty straightforward to reproduce this.

My application makes concurrent GET requests to another Go API at around 280 req/sec using goroutines. This application is supposed to make about 3 million requests to that API every day. We use the latest version of Go in our deployments (1.14.1 in this case), however this application panics after 10-120 minutes of running and unfortunately the running time is not quite deterministic. Rolling back to Go 1.13.5 fixes this issue.

I have seen other github threads that refer to the same issue in older versions of Go, however this seems to have re-appeared again in 1.14.1.


panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x451cad]

goroutine 646692 [running]:
time.stopTimer(0xc00035fa48, 0x0)
/usr/local/go/src/runtime/time.go:224 +0x2b
time.(*Timer).Stop(...)
/usr/local/go/src/time/sleep.go:78
net/http.(*http2ClientConn).roundTrip(0xc001e68780, 0xc001e8c900, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/h2_bundle.go:7480 +0x9f
net/http.(*http2Transport).RoundTripOpt(0xc0001965a0, 0xc001e8c900, 0x9b3800, 0xc0001af080, 0xc000809770, 0x5)
/usr/local/go/src/net/http/h2_bundle.go:6948 +0x16f
net/http.(*http2Transport).RoundTrip(...)
/usr/local/go/src/net/http/h2_bundle.go:6909
net/http.http2noDialH2RoundTripper.RoundTrip(0xc0001965a0, 0xc001e8c900, 0xb53460, 0xc0001965a0, 0x0)
/usr/local/go/src/net/http/h2_bundle.go:9103 +0x3e
net/http.(*Transport).roundTrip(0xf4e580, 0xc001e8c900, 0xc002c91e60, 0xc001080840, 0x40c7f8)
/usr/local/go/src/net/http/transport.go:515 +0xd94
net/http.(*Transport).RoundTrip(0xf4e580, 0xc001e8c900, 0xf4e580, 0x0, 0x0)
/usr/local/go/src/net/http/roundtrip.go:17 +0x35
net/http.send(0xc001e8c900, 0xb52420, 0xf4e580, 0x0, 0x0, 0x0, 0xc00073c2f8, 0xc00002a015, 0x1, 0x0)
/usr/local/go/src/net/http/client.go:252 +0x43e
net/http.(*Client).send(0xf58ba0, 0xc001e8c900, 0x0, 0x0, 0x0, 0xc00073c2f8, 0x0, 0x1, 0xc001e8c900)
/usr/local/go/src/net/http/client.go:176 +0xfa
net/http.(*Client).do(0xf58ba0, 0xc001e8c900, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/client.go:699 +0x44a
net/http.(*Client).Do(...)
/usr/local/go/src/net/http/client.go:567

Robert Engels

unread,
Apr 2, 2020, 5:23:02 PM4/2/20
to hamid....@rvu.co.uk, golang-nuts
Does your code use any unsafe or cgo?

On Apr 2, 2020, at 11:38 AM, 'hamid....@live.com' via golang-nuts <golan...@googlegroups.com> wrote:


--
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/91bf3382-8c71-481a-98e5-c9020dbd66b9%40googlegroups.com.

Pierre Durand

unread,
Apr 3, 2020, 1:20:02 AM4/3/20
to golang-nuts
The stack trace is identical to https://github.com/golang/go/issues/37777


Le jeudi 2 avril 2020 23:23:02 UTC+2, Robert Engels a écrit :
Does your code use any unsafe or cgo?
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.

Robert Engels

unread,
Apr 3, 2020, 7:12:37 AM4/3/20
to Pierre Durand, golang-nuts
so I would comment/reopen that issue as it appears either the fix was not correct (unlikely since it works in 1.14) or that it wasn’t merged correctly into 1.15 (likely). 

On Apr 3, 2020, at 12:20 AM, Pierre Durand <pierre...@gmail.com> wrote:


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/b0969c35-f531-4172-9dbc-35b40d7b7de2%40googlegroups.com.

Robert Engels

unread,
Apr 3, 2020, 7:30:41 AM4/3/20
to Pierre Durand, golang-nuts
Sorry, got the versions wrong. Looks like the fix in 1.14.1 might need fixing. 

On Apr 3, 2020, at 6:12 AM, Robert Engels <ren...@ix.netcom.com> wrote:



Ian Lance Taylor

unread,
Apr 3, 2020, 3:32:05 PM4/3/20
to Robert Engels, Pierre Durand, golang-nuts
On Fri, Apr 3, 2020 at 4:30 AM Robert Engels <ren...@ix.netcom.com> wrote:
>
> Sorry, got the versions wrong. Looks like the fix in 1.14.1 might need fixing.

See https://golang.org/issue/38023 and https://golang.org/issue/38070.

Ian
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/F00C41F9-5B90-4F32-AC60-DED826CA9DB5%40ix.netcom.com.
Reply all
Reply to author
Forward
0 new messages