attic icon indicating copy to clipboard operation
attic copied to clipboard

It is possible for `nar` and `chunk` rows to be stuck in the "pending upload" state permanently

Open tstat opened this issue 1 year ago • 0 comments

I noticed this in my own attic instance across restarts and gcs.

Skimming the upload code, it looks like a nar row is inserted and a cleanup action is registered to delete the newly inserted row if an error occurs before the nar is transitioned to valid, but that doesn't help if the process halts between insertion and transitioning to valid.

These rows will never be garbage collected since only valid nars are selected for deletion.

Chunks are handled in the same way for upload and garbage collection.

This problem can easily be replicated by sending atticd a SIGINT or SIGTERM during an upload, so the lowest hanging fruit would be to install proper signal handlers. Note that the systemd service is configured to receive a SIGTERM when a stop is requested.

Putting aside proper signal handling, I think nars and chunks in the pending upload state should be examined and handled when we know that no upload could be occurring.

tstat avatar Jun 27 '23 02:06 tstat