Skip to content

Race conditions in message sending #7

@technosophos

Description

@technosophos

Running a Go app with go run -race is showing me a few race conditions when sending messages.

==================
WARNING: DATA RACE
Write by goroutine 14:
  github.com/pubnub/go/messaging.func·001()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:1978 +0x36e
  net/http.(*Transport).dial()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:442 +0xcc
  net/http.(*Transport).dialConn()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:496 +0xab
  net/http.func·018()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:472 +0x8c

Previous write by goroutine 17:
  github.com/pubnub/go/messaging.func·001()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:1978 +0x36e
  net/http.(*Transport).dial()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:442 +0xcc
  net/http.(*Transport).dialConn()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:496 +0xab
  net/http.func·018()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:472 +0x8c

Goroutine 14 (running) created at:
  net/http.(*Transport).getConn()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:474 +0x347
  net/http.(*Transport).RoundTrip()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:201 +0x584
  net/http.send()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:195 +0x62d
  net/http.(*Client).send()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:118 +0x200
  net/http.(*Client).doFollowingRedirects()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:343 +0xd31
  net/http.(*Client).Do()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:150 +0xc2
  github.com/pubnub/go/messaging.connect()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:2056 +0x154
  github.com/pubnub/go/messaging.(*Pubnub).httpRequest()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:1936 +0xe7
  github.com/pubnub/go/messaging.(*Pubnub).sendPublishRequest()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:590 +0x430
  github.com/pubnub/go/messaging.(*Pubnub).Publish()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:733 +0xddc

Goroutine 17 (running) created at:
  net/http.(*Transport).getConn()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:474 +0x347
  net/http.(*Transport).RoundTrip()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/transport.go:201 +0x584
  net/http.send()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:195 +0x62d
  net/http.(*Client).send()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:118 +0x200
  net/http.(*Client).doFollowingRedirects()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:343 +0xd31
  net/http.(*Client).Do()
      /usr/local/Cellar/go/1.3/libexec/src/pkg/net/http/client.go:150 +0xc2
  github.com/pubnub/go/messaging.connect()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:2056 +0x154
  github.com/pubnub/go/messaging.(*Pubnub).httpRequest()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:1936 +0xe7
  github.com/pubnub/go/messaging.(*Pubnub).sendPublishRequest()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:590 +0x430
  github.com/pubnub/go/messaging.(*Pubnub).Publish()
      /Users/mbutcher/Code/sugarmill/.godeps/src/github.com/pubnub/go/messaging/pubnub.go:733 +0xddc
==================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions