-
Notifications
You must be signed in to change notification settings - Fork 704
Description
Description
In the journalist interface, if you select a large number of sources and delete them, the operation can take longer than the Apache timeout. Some sources' store directories will have been moved to the shredder before the failure. Thereafter, if you try to delete them, a ValueError will be thrown at line 246 of store.py, in move_to_shredder. The unhandled exception prevents the deletion of the source record, and this is how we get the zombie apocalypse.
Steps to Reproduce
In an environment using Apache (staging, prod VMs, QA hardware):
- Add 500 sources with
qa_loader.py --source-count 500. - Log in as a journalist.
- Select all sources and click delete.
Expected Behavior
That the sources would be deleted without error.
Actual Behavior
You get a gateway timeout. Navigating back to the source list and trying again results in an internal server error, with a stacktrace in /var/log/apache2/journalist-error.log.
Comments
The fix might be as simple as checking for the existence of the source's store directory in journalist_app.utils.delete_collection and only calling move_to_shredder if it still exists. While there, the key pair deletion should be checked as well, so that if it's already gone, the source database record is still deleted.