Repository navigation
AUT-686 - Adding tmpreaper for optional temp file cleanup - #1275
Conversation
| // Remove temp files that have not been accessed in the last 15 minutes | ||
| cmd := exec.Command("tmpreaper", "-a", "15m", os.TempDir()) | ||
| err := cmd.Run() | ||
| if err != nil { |
There was a problem hiding this comment.
Add debug log to see what files and their file size were.
There was a problem hiding this comment.
For the file paths, that's easy.
But for the file sizes, we don't have an easy way to do that using tmpreaper. I'd need to replace tmpreaper with some go code that would go over the temp files ourselves.
For now I'll add output from the tmpreaper command to list the paths it's removing.
There was a problem hiding this comment.
Example output:
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk2800557433.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk1689011704.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk861932279.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk533984321.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk3505681865.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk2094103173.idsig
rmdir /tmp/hsperfdata_app
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk3653607433.idsig
rm remotesettingsdev/remote-settings.content-signature.mozilla.org-2026-12-04-05-00-03.chain
rm remotesettingsdev/remote-settings.content-signature.mozilla.org-2026-12-04-04-49-32.chain
rm normandydev/normandy.content-signature.mozilla.org-2026-12-04-05-00-03.chain
rm normandydev/normandy.content-signature.mozilla.org-2026-12-04-04-49-32.chain
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk502597530.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk3875899127.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk528328939.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk2955558364.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk3510606547.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk1432556671.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk1634675701.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk644545883.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk1215753861.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk1368309012.idsig
rm /tmp/apk2_input_83d0006ea9e05d9344252bcae3f93a41d2d50d3065e1593d11c7215d983d9746.apk1212336375.idsig
say-yawn
left a comment
There was a problem hiding this comment.
Suggestions to add debug line and up the temp storage time due to historical higher response time.
| select { | ||
| case <-r.ticker.C: | ||
| r.cleanTmp() | ||
| case <-r.exit: |
There was a problem hiding this comment.
What happens when the service exits? It seems like the files will just stick around?
There was a problem hiding this comment.
That depends heavily on infra. Potential examples below:
- If the temp path is an ephemeral volume, then everything gets dropped regardless
- When autograph starts back up, then it will start the temp cleaning task again
- If autograph is running on a machine (VM or dev system) that's restarting, then the temp drive is getting wiped at shutdown anyway
say-yawn
left a comment
There was a problem hiding this comment.
One nit on trying to get the file size. Thanks for explaining how the tmpreaper works.
AUT-686
Adding an optional scheduled job to cleanup temp files. Using tmpreaper to keep things simple.
This is due to go not consistently cleaning up temp files that are involved in http responses. Only an issue for long running instances.