Skip to content

crypto/tls: data race on error var #3862

Description

@dvyukov
ThreadSanitizer says:

WARNING: DATA RACE at 0x0000401042d0
Read by goroutine 155:
  crypto/tls.(*Conn).error()
      src/pkg/crypto/tls/conn.go:73 +0x7e
  crypto/tls.(*Conn).Handshake()
      src/pkg/crypto/tls/conn.go:801 +0x6f
  crypto/tls.(*Conn).Read()
      src/pkg/crypto/tls/conn.go:754 +0x55
  bufio.(*Reader).fill()
      src/pkg/bufio/bufio.go:77 +0x187
  bufio.(*Reader).Peek()
      src/pkg/bufio/bufio.go:102 +0x118
  net/http.(*persistConn).readLoop()
      src/pkg/net/http/transport.go:539 +0x106
Previous write by goroutine 156:
  crypto/tls.(*Conn).Write()
      src/pkg/crypto/tls/conn.go:735 +0xdb
  bufio.(*Writer).Flush()
      src/pkg/bufio/bufio.go:418 +0x111
  net/http.(*Request).write()
      src/pkg/net/http/request.go:376 +0xbd4
  net/http.(*persistConn).writeLoop()
      src/pkg/net/http/transport.go:641 +0x1e4
Goroutine 155 (running) created at:
  net/http.(*Transport).getConn()
      src/pkg/net/http/transport.go:390 +0x7be
  net/http.(*Transport).RoundTrip()
      src/pkg/net/http/transport.go:156 +0x31e
  net/http.send()
      src/pkg/net/http/client.go:141 +0x47c
  net/http.(*Client).doFollowingRedirects()
      src/pkg/net/http/client.go:254 +0x941
  net/http.(*Client).Get()
      src/pkg/net/http/client.go:201 +0xc1
  net/http_test.func·044()
      src/pkg/net/http/serve_test.go:607 +0x26d
  net/http_test.func·065()
      src/pkg/net/http/serve_test.go:1201 +0x41
Goroutine 156 (running) created at:
  net/http.(*Transport).getConn()
      src/pkg/net/http/transport.go:391 +0x7d5
  net/http.(*Transport).RoundTrip()
      src/pkg/net/http/transport.go:156 +0x31e
  net/http.send()
      src/pkg/net/http/client.go:141 +0x47c
  net/http.(*Client).doFollowingRedirects()
      src/pkg/net/http/client.go:254 +0x941
  net/http.(*Client).Get()
      src/pkg/net/http/client.go:201 +0xc1
  net/http_test.func·044()
      src/pkg/net/http/serve_test.go:607 +0x26d
  net/http_test.func·065()
      src/pkg/net/http/serve_test.go:1201 +0x41

Races on interface values are harmful.

13810:c793f0042883 (Jul 24 tip)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions