Skip to content

Possible deadlock in SessionPool #1372

@micheleselea

Description

@micheleselea

Hi all, I think I found a possible deadlock in SessionPool shutdown function. I would know what do you think about.
The functions involved are
void SessionPool::onJanitorTimer(Poco::Timer&)
and
void SessionPool::shutdown()
the problem is in shutdown you have
Poco::Mutex::ScopedLock lock(_mutex);
and than
_janitorTimer.stop();
if timer thread is entering onJanitorTimer function you will obtain a deadlock because first line of function is ScopedLock
probably we should

{
Poco::Mutex::ScopedLock lock(_mutex);
  if (_shutdown) return;
  _shutdown = true;
}
  _janitorTimer.stop();

...

or

_shutdown = true;
_janitorTimer.stop();
Poco::Mutex::ScopedLock lock(_mutex);

let me know what you think

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions