Skip to content

Leader Stepdown Deadlock Issue (Leader Stepdown 触发死锁) #531

Description

@gu0keno0

We found braft can run into deadlock when leader is stepping down amid high volume of other braft operations

#530 has more details and the fix.

Braft的leader stepdown 会 schedule所有的done closure,此时如果系统繁忙,会出现暂时无法调度的情况,此时stepdown的执行线程会在拿着NodeImpl.mutex的情况下spin on push_rq, 但此时如果它正在等待的bthreads也在同时请求NodeImpl.mutex (这很容易发生,比如apply()), 就会触发死锁。

#530 把closure调度的部分单独拿出来,在锁被释放后执行,因此可以消除这个死锁问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions