Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64359

Call shutdown handlers on SIGINT/SIGTERM

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 3.7
    • Component/s: General
    • Labels:

      Description

      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).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19