-
Improvement
-
Resolution: Fixed
-
Major
-
3.7
-
MOODLE_37_STABLE
-
MOODLE_37_STABLE
-
MDL-64359-master -
- Ensure you've the pcntl extension installed.
- Copy test_64359.php into your moodle root directory
- Open a terminal
- Run the script and follow its instructions
Ctrl+C generates a SIGINT, but we do not make any attempt to handle that. Same goes for a SIGTERM.
These should cause the shutdown handlers to be called as in normal operation.
Whilst we can't do so on windows (pcntl doesn't exist there) we can on *nix systems using the pcntl extension (optional but most OSs compile with it).
The patch I have produced makes use of pcntl_async_signals which is only available from PHP 7.1. Prior to this you had to use ticks which had an effect on performance. Moodle 3.7 will not support PHP 7.0 as it is no longer in official support in any way (security support ended last week) so this is fine.
I noticed this as we do not clean up locks, or per-request directories if the user manually cancelled the request (i.e. cron).