Per Eliot's suggestion, instead of calling dbexit in startReplSets thread. Create theReplSet object in main thread, which checks and parses --replSet parameter, then just call its go() methon in startReplSets thread. Conflicts: db/repl/rs.cpp