Skip to content

Potential segfault on server statup #194

@alesapin

Description

@alesapin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions