Skip to content

Synchronization issue/deadlock in Poco::Util::Timer at destruction #2058

@SebastianTaube

Description

@SebastianTaube

Expected behavior

When on a Timer object cancel() is called and the object is deleted immediately afterwards, the object's destructor should return.

Actual behavior

Dependent on scheduler behavior, constructor returns or is stuck at _thread.join();

Steps to reproduce the problem

When calling cancel() and deleting the Timer object immediately afterwards, first CancelNotification is enqueued by cancel() and afterwards StopNotification is enqueued by ~Timer(). If inbetween there was no rescheduling to the Timer's thread, the following happens, once the thread is running again:

Due to the execution of CancelNotification the _queue is being cleared, so the StopNotification is being deleted without being executed. As a result, the thread's while loop is not left and _thread.join(); in ~Timer() is blocking forever.

POCO version

1.7.2

Compiler and version

Visual Studio 2015

Operating system and version

Windows 7 Build 7601

Other relevant information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions