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

Fix mainloop call crash on freebsd #4262

Merged
merged 2 commits into from Dec 29, 2022

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Dec 28, 2022

The patches in this branch fixes #4258.

Thanks a lot for @chucksilvers for the diagnosis and the proposed fix. At the end I wasn't using the proposed fix as it was, but I did included a Reported-By header. This fix would probably not exist today if it wasn't your hard work to reproduce and diagnose the issue.

As a preparation for fixing syslog-ng#4258, this patch extracts a few lines as
a new function from main_loop_call().

The goal of the new function is to wait for any pending executions of
mainloop-calls, which can happen if a worker thread submits a new one while
the old is still executing. At the moment, there can be only ONE outstanding
mainloop-calls at the same time.

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
…ead deinit time

As explained in syslog-ng#4258, a crash can happen in syslog-ng if a worker thread
exits while a mainloop call is still being processed.

The solution is to prevent the worker from exiting until that pending call
is finished.

NOTE: in this state the worker is not going to execute tasks, but for all
ivykis knows this thread does not really exist anymore. So if the workpool
requires new threads, they are going to be launched, while this exists
in limbo.

Reported-by: @chucksilvers
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
@bazsi bazsi force-pushed the fix-mainloop-call-crash-on-freebsd branch from 7fce9b8 to e415a87 Compare December 28, 2022 21:18
@github-actions
Copy link
Contributor

No news file has been detected. Please write one, if applicable.

@kira-syslogng
Copy link
Contributor

Build FAILURE

@MrAnno MrAnno self-requested a review December 28, 2022 21:41
@bazsi
Copy link
Collaborator Author

bazsi commented Dec 29, 2022

Btw I reproduced the issue by inserting a sleep(15) into a mainloop_call handler, to trigger a worker exit while the call is executing.

The one I used was the ml_batched_timer()'s update function.

@MrAnno MrAnno merged commit 8107f8b into syslog-ng:master Dec 29, 2022
alltilla added a commit to alltilla/syslog-ng that referenced this pull request Feb 14, 2023
MrAnno added a commit that referenced this pull request Feb 14, 2023
Genfood pushed a commit to Genfood/syslog-ng that referenced this pull request Jun 14, 2023
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.

Occasional crash in main_loop_call_handler()
3 participants