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

MODRESTART/MODRELOAD: Defer reloading more quickly #422

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

aaronmdjones
Copy link
Member

@aaronmdjones aaronmdjones commented Nov 19, 2023

Commit 41390bf fixed a bug whereby the processing of a MODRESTART command could result in a crash. The approach taken in this fix was to defer the reloading of all modules so that the call stack does not contain functions located in modules that are being reloaded. It did this by scheduling a one-shot timer event for 1 second in the future, in the absense of any better deferral mechanism at the time. Timers are processed by the event loop, which is core to IRCd and cannot be reloaded.

Commit 59ea3c6 introduced a mechanism to defer the execution of a function until all events have been processed by the event loop, in order to fix a REHASH bug that could result in a crash due to closing and reopening listener sockets with a pending socket connection event to process after the REHASH was completed.

Rework commit 41390bf to use the new deferral mechanism introduced by commit 59ea3c6 and do the same for module reloads.

@aaronmdjones aaronmdjones changed the title MODRESTART: Defer reloading more quickly MODRESTART/MODRELOAD: Defer reloading more quickly Nov 19, 2023
Commit 41390bf fixed a bug whereby the processing
of a MODRESTART command could result in a crash. The approach
taken in this fix was to defer the reloading of all modules
so that the call stack does not contain functions located in
modules that are being reloaded. It did this by scheduling a
one-shot timer event for 1 second in the future, in the absense
of any better deferral mechanism at the time. Timers are
processed by the event loop, which is core to IRCd and cannot
be reloaded.

Commit 59ea3c6 introduced a mechanism to defer the
execution of a function until all events have been processed by
the event loop, in order to fix a REHASH bug that could result
in a crash due to closing and reopening listener sockets with a
pending socket connection event to process after the REHASH was
completed.

Rework commit 41390bf to use the new deferral
mechanism introduced by commit 59ea3c6 and do the
same for module reloads.
@aaronmdjones aaronmdjones merged commit a950505 into main Nov 20, 2023
9 checks passed
@aaronmdjones aaronmdjones deleted the amdj/modrestart-rbdefer branch November 20, 2023 14:01
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.

2 participants