Skip to content

net/http: go1.6beta1, nil pointer in http.Client #13839

Closed
@karmeye

Description

@karmeye
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x58d4e8]

goroutine 39320 [running]:
net/http.(*persistConn).closeLocked(0xc8646c8840)
    /usr/local/go/src/net/http/transport.go:1451 +0x48
net/http.(*persistConn).close(0xc8646c8840)
    /usr/local/go/src/net/http/transport.go:1445 +0x7a
net/http.(*Transport).putIdleConn(0xc820386bb0, 0xc8646c8840, 0xc84fc4d788)
    /usr/local/go/src/net/http/transport.go:500 +0x434
net/http.(*Transport).getConn.func2.1(0xc841323aa0, 0xc820386bb0, 0x9db1c8)
    /usr/local/go/src/net/http/transport.go:629 +0x7f
created by net/http.(*Transport).getConn.func2
    /usr/local/go/src/net/http/transport.go:632 +0x70

Occurs sometimes under the following conditions

  • Using TLS and HTTP/2
  • Stress testing server with 500 http.Clients running in the same process.

Clients are running on OS X 10.11.2
Server is running on Linux

Looking at the source, it seems to be than conn is nil:

func (pc *persistConn) closeLocked() {
    pc.broken = true
    if !pc.closed {
        pc.conn.Close()    <---- conn nil?
        pc.closed = true
        close(pc.closech)
    }
    pc.mutateHeaderFunc = nil
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions