Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1552

CorruptGridFile with gridfs after disk is full

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2
    • Affects Version/s: None
    • Component/s: GridFS
    • Environment:
      Docker python:2.7-stretch image
    • Minor Change

      Basically, if the disk get out of space (let say free space is 2KB) for saving with a python script, lets say, a 1MB file, the following will happen:

      1- gridfs will first save the fs.files document. As it is only a few bytes, it will succeed.

      2- gridfs will try to save fs.chunks, but it will fail because the disk is out of space.

      3-pymongo will raise an error, and that is the end.

      4- the next time someone query for that hash/file, gridfs will find it on fs.files, then it will search for the chunks, but the chunks will not be there. gridfs will raise CorruptGridFile.

       

      The fix would be to handle the error of out of space, and remove fs.files document, so the grid doesn't go into corrupt state for that file.

      root@db26f5ffc59d:/myapp# python -c "import sys; print(sys.version)"
      2.7.14 (default, Mar 14 2018, 18:16:04)
      [GCC 6.3.0 20170516]
      root@db26f5ffc59d:/myapp# python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
      3.6.1
      True

            Assignee:
            ben.warner@mongodb.com Ben Warner (Inactive)
            Reporter:
            CrimsonGlory Crimson Glory
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: