8000 Race condition in AsyncChannel close/log · Issue #1039 · pocoproject/poco · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content 8000
Race condition in AsyncChannel close/log #1039
Closed
@DEvil0000

Description

@DEvil0000

void AsyncChannel::close()
{
if (_thread.isRunning())
{
while (!_queue.empty()) Thread::sleep(100);
do
{
_queue.wakeUpAll();
}
while (!_thread.tryJoin(100));
}
}

close() -> thread.isRunning() -> true
[thread context change]
some thread calling log().. exec until _queue.enqueue
[thread context change]
AsyncChannel thread finishes...
[thread context change]
close() -> while (!_queue.empty()) -> thread stuck

edit:
this can also cause shutdown issues in the following scenario:
main thread calls exit()
singleton Logger shutdown
other thread logging something
AsyncChannel creates the thread again
AsyncChannel has still some work while main thread destroys stuff with exit()
-> segfault

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0