juju/state: intermittent test failure in SubnetSuite with mongod 3.2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
juju-core |
Triaged
|
Medium
|
Unassigned |
Bug Description
Running SubnetSuite.
cd $GOPATH/state
go test -c
bash -c "set -e; while true; do JUJU_MONGOD=
Digging into the test, it's running two transactions in parallel to provoke a conflict between them. The code expects a txn.ErrAborted, but instead gets an error from mgo that looks like this:
&mgo.QueryError{
Code:11000,
Message:"E11000 duplicate key error collection: juju.txns.stash index: _id_ dup key: { : { c: \"ipaddresses\", id: \"d50476f7-
Assertion:
}
Running the loop using JUJU_MONGOD=
Example output from running the test in a loop against mongod 3.2:
PASS: /home/xtian/
OK: 1 passed
PASS
PASS: /home/xtian/
OK: 1 passed
PASS
PASS: /home/xtian/
OK: 1 passed
PASS
PASS: /home/xtian/
OK: 1 passed
PASS
-------
FAIL: /home/xtian/
SetUpTest
[LOG] 0:00.001 INFO juju.state opening state, mongo addresses: ["localhost:
[LOG] 0:00.001 DEBUG juju.state dialing mongo
[LOG] 0:00.002 INFO juju.mongo dialled mongo successfully on address "127.0.0.1:40933"
[LOG] 0:00.002 DEBUG juju.state connection established
[LOG] 0:00.002 DEBUG juju.state mongodb login successful
[LOG] 0:00.422 INFO juju.mongo dialled mongo successfully on address "127.0.0.1:40933"
[LOG] 0:00.423 INFO juju.state initializing controller model 60d109d3-
[LOG] 0:00.597 INFO juju.state running state anonymously; using unique client id
[LOG] 0:00.597 INFO juju.state starting standard state workers
[LOG] 0:00.597 DEBUG juju.state.workers starting leadership lease manager
[LOG] 0:00.599 INFO juju.mongo dialled mongo successfully on address "127.0.0.1:40933"
[LOG] 0:00.602 DEBUG juju.state.workers starting singular lease manager
[LOG] 0:00.602 DEBUG juju.worker.lease waking to check leases at 2016-06-03 12:19:09.460057936 +0100 BST
[LOG] 0:00.605 DEBUG juju.state.workers starting transaction log watcher
[LOG] 0:00.605 DEBUG juju.state.workers starting presence watcher
[LOG] 0:00.605 INFO juju.state creating cloud image metadata storage
[LOG] 0:00.605 DEBUG juju.worker.lease waking to check leases at 2016-06-03 12:19:09.462834777 +0100 BST
[LOG] 0:00.605 INFO juju.state started state for model-60d109d3-
SetUpTest done
[LOG] 0:00.619 INFO juju.mongo dialled mongo successfully on address "127.0.0.1:40933"
[LOG] 0:00.619 INFO juju.mongo dialled mongo successfully on address "127.0.0.1:40933"
/home/xtian/
c.Assert(
... value *errors.Err = &errors.
\"local-
... error stack:
E11000 duplicate key error collection: juju.txns.stash index: _id_ dup key: { : { c: "ipaddresses", id: "60d109d3-
[LOG] 0:00.626 DEBUG juju.state.workers stopped state workers without error
[LOG] 0:00.626 DEBUG juju.state closed state without error
OOPS: 0 passed, 1 FAILED
--- FAIL: TestPackage (1.00s)
FAIL
Changed in juju-core: | |
status: | New → Triaged |
importance: | Undecided → Medium |
This seems like a bug in mgo against mongo3.2 - you can see the same duplicate key error inserting into the stash collection in this standalone program (using mgo.v2-unstable).
Again, this runs two conflicting transactions in parallel expecting one to fail with a txn.ErrAborted. Most of the time it does, but occasionally (after about 50 times through the loop) it returns the duplicate key error instead. Both transactions assert that a base document exists, and then try to insert the same new document. The assertion is needed to cause the error - without it the transactions only fail with txn.ErrAborted as expected.
Run the example with: go run mgo-duplicate- key.go /usr/lib/ juju/mongo3. 2/bin