MODRESTART/MODRELOAD: Defer reloading more quickly #422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theREHASH
was completed.Rework commit 41390bf to use the new deferral mechanism introduced by commit 59ea3c6 and do the same for module reloads.