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

$CFG->preventfilelocking not honored

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • None
    • 2.5.1
    • Files API
    • None
    • MOODLE_25_STABLE

      The configuration option $CFG->preventfilelocking should enable deployments on file systems that may have difficulties with calls to flock and file_put_contents with the LOCK_EX or LOCK_SH options. But there are a few places in the code where for example LOCK_EX is used without checking for this configuration option.

      An rgrep LOCK_EX returns for example ./filestorage/file_storage.php and ./pluginlib.php

      Background: we deploy moodle_data on Lustre (a shared filesystem) and encountered a similar problem to that reported here: https://tracker.moodle.org/browse/MDL-31685 . This time, there were problems generating thumbnails, giving an error in line 1761 of /lib/filestorage/file_storage.php . We solved our problem removing the LOCK_EX in line 1757 of file_put_contents($hashfile.'.tmp', $content, LOCK_EX)

      I appreciate that these are attempts to prevent race-conditions, and I don't understand why Lustre (and maybe NFS?) sometimes have difficulties with the LOCK_EX option, but probably the preventfilelocking option should work as advertised.

            Unassigned Unassigned
            ewout Ewout ter Haar
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.