When you run the 'shutdown' server command on a MongoDB server that was launched by dbtest.DBServer, the .monitor() goroutine causes a panic of the entire test/program.
---- mongod process died unexpectedly:
...
...
2018-08-21T21:10:46.139+0200 I COMMAND [conn1] terminating, shutdown command received
2018-08-21T21:10:46.139+0200 I NETWORK [conn1] shutdown: going to close listening sockets...
2018-08-21T21:10:46.140+0200 I NETWORK [conn1] removing socket file: /tmp/mongodb-36729.sock
2018-08-21T21:10:46.140+0200 I FTDC [conn1] Shutting down full-time diagnostic data capture
2018-08-21T21:10:46.142+0200 I STORAGE [conn1] WiredTigerKVEngine shutting down
2018-08-21T21:10:46.253+0200 I STORAGE [conn1] shutdown: removing fs lock...
2018-08-21T21:10:46.253+0200 I CONTROL [conn1] now exiting
2018-08-21T21:10:46.253+0200 I CONTROL [conn1] shutting down with code:0
---- mongod processes running right now:
tim 7089 0.0 0.0 113172 1200 pts/0 S+ 21:10 0:00 /bin/sh -c ps auxw | grep mongod
tim 7091 0.0 0.0 112704 940 pts/0 S+ 21:10 0:00 grep mongod
----------------------------------------
panic: mongod process died unexpectedly
goroutine 14 [running]:
github.com/globalsign/mgo/dbtest.(*DBServer).monitor(0xc4201ea000, 0xc42008e001, 0x631c39)
/home/tim/go/src/github.com/globalsign/mgo/dbtest/dbserver.go:90 +0x2fd
github.com/globalsign/mgo/dbtest.(*DBServer).(github.com/globalsign/mgo/dbtest.monitor)-fm(0x631c39, 0xc42009c060)
/home/tim/go/src/github.com/globalsign/mgo/dbtest/dbserver.go:73 +0x2a
gopkg.in/tomb%2ev2.(*Tomb).run(0xc4201ea098, 0xc4201cb6c0)
/home/tim/go/src/gopkg.in/tomb.v2/tomb.go:163 +0x2b
created by gopkg.in/tomb%2ev2.(*Tomb).Go
/home/tim/go/src/gopkg.in/tomb.v2/tomb.go:159 +0xb9
I plan to create a PR to add an option to disable the .monitor() func in edge-cases like mine, unless there are any other suggestions.
I think a .SetMonitor(enabled bool) func would work nicely unless there are any other suggestions.
When you run the 'shutdown' server command on a MongoDB server that was launched by dbtest.DBServer, the .monitor() goroutine causes a panic of the entire test/program.
I plan to create a PR to add an option to disable the .monitor() func in edge-cases like mine, unless there are any other suggestions.
I think a .SetMonitor(enabled bool) func would work nicely unless there are any other suggestions.
Thanks!