worker/statushistorypruner: data race

Bug #1492095 reported by Dave Cheney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Critical
Horacio Durán

Bug Description

lucky(~/src/github.com/juju/juju/worker/statushistorypruner) % bash ~/stress.bash
==================
WARNING: DATA RACE
Write by goroutine 18:
  github.com/juju/juju/worker/statushistorypruner_test.(*statusHistoryPrunerSuite).TestWorker.func1()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/worker_test.go:57 +0x3e
  github.com/juju/juju/worker/statushistorypruner.(*pruneWorker).doPruning()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/worker.go:52 +0x97
  github.com/juju/juju/worker/statushistorypruner.(*pruneWorker).(github.com/juju/juju/worker/statushistorypruner.doPruning)-fm()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/worker.go:48 +0x45
  github.com/juju/juju/worker.(*periodicWorker).run()
      /home/dfc/src/github.com/juju/juju/worker/periodicworker.go:86 +0x1a2
  github.com/juju/juju/worker.NewPeriodicWorker.func1()
      /home/dfc/src/github.com/juju/juju/worker/periodicworker.go:73 +0x79

Previous read by goroutine 16:
  github.com/juju/juju/worker/statushistorypruner_test.(*statusHistoryPrunerSuite).TestWorker()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/worker_test.go:84 +0x6b5
  runtime.call32()
      /home/dfc/go/src/runtime/asm_amd64.s:442 +0x3d
  reflect.Value.Call()
      /home/dfc/go/src/reflect/value.go:300 +0xcd
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /home/dfc/src/gopkg.in/check.v1/check.go:772 +0x5e0
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/dfc/src/gopkg.in/check.v1/check.go:666 +0x80

Goroutine 18 (running) created at:
  github.com/juju/juju/worker.NewPeriodicWorker()
      /home/dfc/src/github.com/juju/juju/worker/periodicworker.go:74 +0xea
  github.com/juju/juju/worker/statushistorypruner.NewPruneWorker()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/export_test.go:17 +0x1ad
  github.com/juju/juju/worker/statushistorypruner_test.(*statusHistoryPrunerSuite).TestWorker()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/worker_test.go:77 +0x388
  runtime.call32()
      /home/dfc/go/src/runtime/asm_amd64.s:442 +0x3d
  reflect.Value.Call()
      /home/dfc/go/src/reflect/value.go:300 +0xcd
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /home/dfc/src/gopkg.in/check.v1/check.go:772 +0x5e0
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/dfc/src/gopkg.in/check.v1/check.go:666 +0x80

Goroutine 16 (running) created at:
  gopkg.in/check%2ev1.(*suiteRunner).forkCall()
      /home/dfc/src/gopkg.in/check.v1/check.go:667 +0x486
  gopkg.in/check%2ev1.(*suiteRunner).forkTest()
      /home/dfc/src/gopkg.in/check.v1/check.go:804 +0x126
  gopkg.in/check%2ev1.(*suiteRunner).runTest()
      /home/dfc/src/gopkg.in/check.v1/check.go:809 +0x38
  gopkg.in/check%2ev1.(*suiteRunner).run()
      /home/dfc/src/gopkg.in/check.v1/check.go:615 +0x481
  gopkg.in/check%2ev1.Run()
      /home/dfc/src/gopkg.in/check.v1/run.go:92 +0x50
  gopkg.in/check%2ev1.RunAll()
      /home/dfc/src/gopkg.in/check.v1/run.go:84 +0x133
  gopkg.in/check%2ev1.TestingT()
      /home/dfc/src/gopkg.in/check.v1/run.go:72 +0x4b5
  github.com/juju/juju/worker/statushistorypruner_test.TestPackage()
      /home/dfc/src/github.com/juju/juju/worker/statushistorypruner/package_test.go:13 +0x2e
  testing.tRunner()
      /home/dfc/go/src/testing/testing.go:456 +0xdc
==================

----------------------------------------------------------------------
FAIL: worker_test.go:54: statusHistoryPrunerSuite.TestWorker

worker_test.go:84:
    c.Assert(passedMaxLogs, gc.Equals, 3)
... obtained int = 0
... expected int = 3

OOPS: 0 passed, 1 FAILED
--- FAIL: TestPackage (0.01s)
FAIL

Ian Booth (wallyworld)
Changed in juju-core:
importance: Undecided → Critical
assignee: nobody → Horacio Durán (hduran-8)
status: New → Triaged
Revision history for this message
Horacio Durán (hduran-8) wrote :

I proposed https://github.com/juju/juju/pull/3214 as a solution.

Changed in juju-core:
status: Triaged → In Progress
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: none → 1.26-alpha1
Curtis Hovey (sinzui)
tags: added: race-condition
Curtis Hovey (sinzui)
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
tags: added: tech-debt
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.