Skip to content

Data race while reconnecting #703

@NiklasCi

Description

@NiklasCi

One of our test fails with a data race if we test our logic we implemented if the client reconnects.
It seems that there is a DATA RACE in the client itself. At least the trace does not show any of our go files/packages.

Trace:

WARNING: DATA RACE
Write at 0x00c00047e441 by goroutine 147:
  github.com/eclipse/paho%2emqtt%2egolang.(*client).resume()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:1090 +0x13de
  github.com/eclipse/paho%2emqtt%2egolang.(*client).reconnect()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:341 +0x973
  github.com/eclipse/paho%2emqtt%2egolang.(*client).internalConnLost.func1.gowrap1()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:562 +0x44

Previous read at 0x00c00047e441 by goroutine 167:
  github.com/eclipse/paho.mqtt.golang/packets.(*FixedHeader).pack()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/packets/packets.go:267 +0x71
  github.com/eclipse/paho.mqtt.golang/packets.(*PublishPacket).Write()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/packets/publish.go:47 +0x2dd
  github.com/eclipse/paho%2emqtt%2egolang.startOutgoingComms.func1()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/net.go:293 +0xd5e

Goroutine 147 (running) created at:
  github.com/eclipse/paho%2emqtt%2egolang.(*client).internalConnLost.func1()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:562 +0x60a

Goroutine 167 (running) created at:
  github.com/eclipse/paho%2emqtt%2egolang.startOutgoingComms()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/net.go:264 +0x3a4
  github.com/eclipse/paho%2emqtt%2egolang.startComms()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/net.go:394 +0x104
  github.com/eclipse/paho%2emqtt%2egolang.(*client).startCommsWorkers()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:655 +0xc5e
  github.com/eclipse/paho%2emqtt%2egolang.(*client).reconnect()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:340 +0x93e
  github.com/eclipse/paho%2emqtt%2egolang.(*client).internalConnLost.func1.gowrap1()
      /home/niklas/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.5.0/client.go:562 +0x44

Following Options are set:

KeepAlive: 30s
PingTimeout: 1s
AutoReconnect: true
ConnectTimeout: 10s
ConnectRetry: true
ConnectRetryInterval: 500ms
ResumeSubs: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions