Skip to content

Fix race condition in UniqueId::uniqueId() #1786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

weliu
Copy link

@weliu weliu commented May 25, 2018

There exists a race condition in UniqueId::uniqueId(). I called msc_init() simultaneously in many threads, so they can have their own instance of ModSecurity. However, the process get core dumped every once in a while. The stack looks like this:
1
This PR uses std::once_flag to make sure UniqueId::getInstance().fillUniqueId() only called once.

@zimmerle zimmerle self-assigned this May 28, 2018
@zimmerle zimmerle self-requested a review May 28, 2018 21:04
@zimmerle zimmerle added the 3.x Related to ModSecurity version 3.x label May 28, 2018
@zimmerle
Copy link
Contributor

Merged! Thanks!

@zimmerle zimmerle closed this May 28, 2018
zimmerle pushed a commit that referenced this pull request May 28, 2018
@weliu weliu deleted the uniqueID branch May 29, 2018 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants