jezdez/django_compressor — Issue #159: Race condition in FileSystemStorage impacting CompressorFileStorage
Author: mlavin
Created: 2011-11-18 19:56:52+00:00
State: open

This is related to Django ticket 16108 which is currently fixed on trunk but impacts Django 1.3.1 and earlier: https://code.djangoproject.com/ticket/16108

There is a race condition in `FileSystemStorage.delete` which can raise an `OSError` when concurrent requests attempt to delete the same file. We have experienced this issue with django_compressor when we roll out new CSS/JS changes and new cache files need to be created, `CompressorFileStorage.get_available_name` attempts to delete the file but it's already been deleted by a simultaneous request. More or less a thundering herd problem for the compressed file cache.

It would be nice for django_compressor to implement a similar fix which exists in trunk for people using Django earlier than 1.4. I can submit a pull request this weekend. If nothing else let this be a placeholder for others that might experience this issue.