Skip to content
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

Prevent deadlock, ensure that no locks are being held at the time of forking #491

Merged
merged 5 commits into from May 4, 2020

Conversation

jjnicola
Copy link
Member

During testing, the child deadlock was reproduce, right after fork()'ing, when logging the message
"Testing xxx.xxx.xxx.xxx (Vhost...."

Before, since alive detection is running in a thread, it can lock a mutex when the main process is forking a new child. This mutex is copied into the child process in its locked state, and any child that tries to lock the mutex waits forever.

Also, add log domain for alive detection.

@jjnicola
Copy link
Member Author

Depends on PR greenbone/gvm-libs#328

@jjnicola jjnicola force-pushed the log-mutex-lock branch 2 times, most recently from 82e94b6 to bf6f5e6 Compare May 4, 2020 07:41
janowagner
janowagner previously approved these changes May 4, 2020
Copy link
Member

@janowagner janowagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.

…forking.

During testing, the child deadlock was reproduce, directly after fork, when logging the message
"Testing xxx.xxx.xxx.xxx (Vhost...."

Since alive detection is running in a thread, it can lock a mutex when the main process is forking a new child.
This mutex is copied into the child process in its locked state, and any child that tries to lock the mutex waits forever.
This patch prevent the child deadlock.
Also, set the defaul log level to 16 (warning).
@ArnoStiefvater ArnoStiefvater merged commit 49a87ac into greenbone:master May 4, 2020
@jjnicola jjnicola deleted the log-mutex-lock branch May 7, 2020 08:35
@jjnicola jjnicola mentioned this pull request Aug 22, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants