-
Notifications
You must be signed in to change notification settings - Fork 285
Potential segfault on server statup #194
Description
Hi! Recently, I've got the following error https://gist.github.com/alesapin/0dbbc2616a6b88d6a14467fd78dc922a on server startup. Actually, this specific error is not important, but the idea to start some threads from a partially initialized object doesn't look good:
https://github.com/eBay/NuRaft/blob/master/src/raft_server.cxx#L252-L257
So in my case background threads were fast enough to do something and call my callback which (in my case) checks that the current node is Leader. And all these things have happened before the constructor of raft_server was finished. So such behavior makes raft_server object very dangerous not only for user callbacks but also for its own code which executes in background threads. Maybe we can introduce some kind of startup() method which will start all background threads after the object already initialized?