Clean up invalid FuzzerJob entities in cleanup task - #5409
Conversation
Add cleanup_invalid_fuzzer_jobs to cleanup.py to detect and delete FuzzerJob entities referencing non-existent Fuzzer or Job entities. Also add unit tests covering this cleanup behavior in cleanup_test.py.
ViniciustCosta
left a comment
There was a problem hiding this comment.
It should be ok to add this in cleanup, but I think this deletion is already done in fuzzer_selection.py here: https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/_internal/fuzzing/fuzzer_selection.py#L32,
which should be called by the update/delete handlers (ex: https://github.com/google/clusterfuzz/blob/master/src/appengine/handlers/fuzzers.py#L303)
I think there's still a possibility that we're left with dangling This means that if there exists a We don't validate the Fuzzer actually exists before we schedule |
I wonder if we should expand this repair cron to just keep the |
I agree that this might be a cleaner solution |
fix b/538683766
Problem
When
JoborFuzzerentities are deleted, orphanedFuzzerJobmappings can linger in Datastore because the cleanup cron task does not detect and prune them.Solution
cleanup_invalid_fuzzer_jobs()insrc/clusterfuzz/_internal/cron/cleanup.pyto deleteFuzzerJobentities referencing non-existentFuzzerorJobentities.cleanup_invalid_fuzzer_jobs()incleanup.py'smain().src/clusterfuzz/_internal/tests/appengine/handlers/cron/cleanup_test.py.Testing