kaldi-asr / kaldi-asr/kaldi

Race condition in TaskSequencer

Open
#4,477 0 comments 0 reactions 1 assignee Claimed by @kkm000 View on GitHub
bug in progress
Dominant language
Shell
Stars
15.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

The fixes #4434 and #4464 did not address the core problem. An `std::thread` may return `!joinable` in only a handful of cases: ["after default construction, move() from, detach(), or join()"](https://en.cppreference.com/w/cpp/thread/thread) (or `std::swap()` with a non-joinable thread, I believe), or if called from the same thread. Obviously, waiting in a loop with a sleep won't make the non-joinable thread joinable under these conditions: the thread objects are not default-constructed, moved from, swapped or detached by `TaskSequencer`, and the current thread will remain current thread.

TL;DR: In TaskSequencer as it is written, a non-joinable thread may not ever become joinable. Yet it does.

The problem is obviously related to unsynchronized access to a common data structure, the thread list. The list has not been updated yet, and the code is hitting a wrong thread.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.