Repository navigation
Stop insertJobOutputReport from failing on a concurrent duplicate insert - #886
Merged
Merged
Conversation
update_job_output_report() in finisher.py first tries an UPDATE (updateJobOutputReport), and only falls back to insertJobOutputReport when 0 rows were updated. Two concurrent callers for the same (PandaID, attemptNr) can both see 0 rows updated and both fall back to the INSERT, and a plain INSERT hits JOB_OUTPUT_REPORT_PK on whichever one commits second, logged as an ORA-00001 error even though the row ends up correctly stored either way. Replaced the plain INSERT with the same guarded INSERT ... SELECT ... WHERE NOT EXISTS pattern already used by backfill_pilot_attributes, so a losing concurrent attempt is a clean no-op instead of a logged constraint violation. Tested live on both backends with a safe, cleaned-up fake PandaID: production Oracle (aipanda092) and DOMA's Postgres (job_output_report table). On both, the first insert succeeds, a duplicate insert for the same key is a true no-op with no error, the original value is preserved, and cleanup is confirmed.
EdwardKaravakis
force-pushed
the
fix-job-output-report-duplicate-insert
branch
from
November 25, 2026 11:03
03e987e to
566d516
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
update_job_output_report() in finisher.py first tries an UPDATE (updateJobOutputReport), and only falls back to insertJobOutputReport when 0 rows were updated. Two concurrent callers for the same (PandaID, attemptNr) can both see 0 rows updated and both fall back to the INSERT, and a plain INSERT hits JOB_OUTPUT_REPORT_PK on whichever one commits second - logged as an ORA-00001 error even though the row ends up correctly stored either way.
Replaced the plain INSERT with the same guarded INSERT ... SELECT ... WHERE NOT EXISTS pattern already used by backfill_pilot_attributes, so a losing concurrent attempt becomes a clean no-op instead of a logged constraint violation.
Same bug family as #882 (MetricsDB.update() in metric_collector.py), found while reviewing the panda-server codebase for similar check-then-act races.
Tested live on both backends with a safe, cleaned-up fake PandaID: