watermill icon indicating copy to clipboard operation
watermill copied to clipboard

Data race on Publish for Google pubsub

Open alan-anzenna opened this issue 1 year ago • 0 comments

Running code with -race that publishes from multiple goroutines at the same time:

WARNING: DATA RACE
Write at 0x00c002c291d8 by goroutine 1498:
  github.com/ThreeDotsLabs/watermill-googlecloud/pkg/googlecloud.(*Publisher).Publish()
      github.com/ThreeDotsLabs/[email protected]/pkg/googlecloud/publisher.go:149 +0xe4
[...]

Previous write at 0x00c002c291d8 by goroutine 1439:
  github.com/ThreeDotsLabs/watermill-googlecloud/pkg/googlecloud.(*Publisher).Publish()
      github.com/ThreeDotsLabs/[email protected]/pkg/googlecloud/publisher.go:149 +0xe4
[...]

Line 149 is:

t.EnableMessageOrdering = p.config.EnableMessageOrdering

which is a write to a shared Topic without synchronization.

alan-anzenna avatar Apr 11 '24 22:04 alan-anzenna