Skip to content

OpenSSLInitializer isn't threadsafe #1739

@neotron

Description

@neotron

The initialize and uninitialize methods in OpenSSLInitializer uses a construct like this:

if (++_rc == 1) { ... }

_rc is a Poco::AtomicCounter.

This is insufficient since you can easily get into a situation where both uninitialize and initialize is called at the same time from multiple threads. These methods should be protected by a mutex lock to ensure proper execution.

The workaround to keep a persistent instance of this object works of course, but that just avoids triggering the race condition.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions