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

File upload fails silently on NFS volume with no space remaining

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.4, 3.2.1
    • Fix Version/s: 3.1.5, 3.2.2
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide
      1. Mount a small NFS volume as your moodledata directory (if possible).
      2. Apply the first commit from this patch (the one to verify the hash).
      3. Upload a file (or files) large enough to fill the data volume.
      4. Verify that the filesystem is now 100% full.
      5. Attempt to upload another file.
      6. Verify that the upload has failed.
      7. Delete some files to free up some space.
      8. Apply the second commit, and attempt to fill the volume again.
      9. Verify that the upload that would fill the volume has now failed.
      Show
      Mount a small NFS volume as your moodledata directory (if possible). Apply the first commit from this patch (the one to verify the hash). Upload a file (or files) large enough to fill the data volume. Verify that the filesystem is now 100% full. Attempt to upload another file. Verify that the upload has failed. Delete some files to free up some space. Apply the second commit, and attempt to fill the volume again. Verify that the upload that would fill the volume has now failed.
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57801-master

      Description

      Admittedly this is the edgiest of edge cases, and for all I know it may even be restricted to certain NFS implementations/configurations, but we got bitten by it fairly badly.

      For some reason the full NFS filesystem creates a zero byte temp file but with the hash of the original file. However, the filesize check in add_file_to_pool() somehow passes anyway. So I've added another check to verify the content hash of the temp file, and fortunately this fails for the zero byte file.

      I also discovered while testing this that if someone uploads a large file that fills the remaining space, this temp file is never deleted and the filesystem stays full, so I've included a fix for that too in a separate commit (this doesn't seem to be restricted to NFS filesystems).

        Attachments

          Activity

            People

            Assignee:
            tonybutler Tony Butler
            Reporter:
            tonybutler Tony Butler
            Peer reviewer:
            Ankit Agarwal
            Integrator:
            David Monllaó
            Tester:
            Rajesh Taneja
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Mar/17