Skip to content

Race in TCPServerDispatcher::stop #2746

@Mardalemer

Description

@Mardalemer

Expected behavior

Server stops immediately

Actual behavior

Server stops after timeout

Steps to reproduce the problem

Unfortunately there is no easy way to reproduce this bug, but I'll try to explain what I see in debugger.

There are two threads: the first one threadA with the TCPServerDispatcher::run() and the other one threadB that calls the
TCPServerDispatcher::stop(). The TCPServerDispatcher::stop() in threadB calls the _queue.wakeUpAll() and locks the
NotificationQueue mutex, at the same time threadA can call the _queue.waitDequeueNotification(idleTime) and
start waiting for NotificationQueue mutex unlock. So we've got the event in the _queue.waitDequeueNotification(idleTime)
that will never be set and when the threadPool::joinAll is called it'll wait for an idleTime timeout.

POCO version

poco-1.9.0-release

Compiler and version

msvc-2017

Operating system and version

windows 10

Other relevant information

Looks like it relates to this issue

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions