Commit 37004bf
fix(database): remove orphan pass to fix race with transport thread
The orphan pass in sentry__cleanup_cache deleted attachment dirs without
a matching .envelope file. This raced with the transport background
thread: process_old_runs submits envelopes to the transport and deletes
the .run files, but the transport hasn't yet written the retry .envelope
to cache when the orphan pass runs, causing it to delete the attachment
dir before the TUS upload can use it.
All cleanup paths are already covered without the orphan pass: the first
pass deletes attachment dirs alongside pruned envelopes, handle_result
cleans up on retry discard, process_old_runs handles materialization
failure, and sentry__db_remove_large_attachment handles TUS success.
Also restores the cache_keep/http_retry gate on sentry__cleanup_cache
since without the orphan pass there's no reason to run it otherwise.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent c379816 commit 37004bf
2 files changed
+3
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | 718 | | |
751 | 719 | | |
752 | 720 | | |
| |||
0 commit comments