Skip to content

Replaced log locking using mutex with fcntl lock #1949

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
Closed

Replaced log locking using mutex with fcntl lock #1949

wants to merge 1 commit into from

Conversation

Cloaked9000
Copy link
Contributor

Switching from mutexes to file locking for logging. Fixes #1927

When reloading Nginx, there is a race condition which is visible under high load. As the logging mutex is shared between multiple workers, when a worker is sent a stop signal during a reload, and the log mutex is held, write() will never return, which means that the mutex will never unlock. As other workers share this mutex, they will deadlock.

fcntl does not suffer from this issue.
@victorhora victorhora requested a review from zimmerle November 10, 2018 18:28
@victorhora victorhora added RIP - libmodsecurity 3.x Related to ModSecurity version 3.x pr available labels Nov 10, 2018
@victorhora victorhora added this to the v3.0.4 milestone Nov 10, 2018
@zimmerle
Copy link
Contributor

Hi @Cloaked9000,

Sorry for the delay in looking into this. There is indeed a very clever approach. Thank you. Merged.

@defanator
Copy link
Contributor

@Cloaked9000 kudos for this one!

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 pr available RIP - libmodsecurity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants