feat(preprod): Run snapshot odiff comparisons in parallel#116712
Merged
Conversation
NicoHinderling
marked this pull request as ready for review
June 2, 2026 19:39
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2c17f56df69701ff004d9e5605a26c624f08a12a. Configure here.
NicoHinderling
force-pushed
the
nico/parallelize-snapshot-odiff
branch
2 times, most recently
from
June 2, 2026 19:48
73ee96e to
d1ebe08
Compare
mtopo27
approved these changes
Jun 2, 2026
Replace the single serial OdiffServer with a pool of N persistent servers (tunable via preprod.snapshots.odiff-worker-count, default 4) driven by a thread pool. The per-batch fetch -> compare -> upload work is extracted into _process_batch, which returns partial results merged in the main thread; a mid-batch failure is isolated (only its unprocessed pairs are marked errored) rather than aborting the whole comparison. This cuts a multi-minute comparison of thousands of changed pairs to well under the processing deadline, so large comparisons stop getting killed. The deadline is also raised from 300s to 600s as an extra safety margin. Adds an odiff phase-summary log (duration, throughput, slowest batch, worker count) for post-deploy diagnosis, and the first end-to-end tests for compare_snapshots. Co-Authored-By: Claude <[email protected]>
NicoHinderling
force-pushed
the
nico/parallelize-snapshot-odiff
branch
from
June 2, 2026 22:07
17680b3 to
181f16e
Compare
Contributor
|
PR reverted: bce98e2 |
getsentry-bot
added a commit
that referenced
this pull request
Jun 3, 2026
…16712)" This reverts commit 8fcc162. Co-authored-by: NicoHinderling <[email protected]>
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.

Parallelize the preprod snapshot odiff comparison phase. The single serial
OdiffServeris replaced with a pool of N persistent servers (tunable via the newpreprod.snapshots.odiff-worker-countoption, default 4) driven by aContextPropagatingThreadPoolExecutor. The per-batch fetch → compare → upload work is extracted into_process_batch, which checks a server out of aqueue.Queue, runs the batch, uploads its diff masks, and returns partial results that are merged single-threaded in the main loop.Why: for large builds the comparison diffs thousands of changed image pairs one at a time against one node process, taking 3+ minutes — long enough to hit the task's 300s
processing_deadline(ProcessingDeadlineExceeded) or be interrupted by a deploy SIGTERM. A real build (~6,000 changed pairs across 431 batches) was timing out this way. Spreading the batches across N servers brings it comfortably under the deadline.Notes for reviewers:
OdiffServeris only ever used by one thread (checked out of the pool); the objectstoreSessionis thread-safe forget/put; each batch'scompare_images_batchuses its own tempdir, so there are no cross-thread filename collisions. All result accumulation happens in the main thread — workers mutate no shared state.errored, so a single bad batch doesn't fail the whole comparison.FLAG_AUTOMATOR_MODIFIABLEoption — it can be dialed down in prod without a deploy.MAX_DIFF_PIXELSstill caps any single pair.compare_snapshots: odiff phase completesummary log (duration, throughput, slowest batch, worker count) for post-deploy diagnosis, and the first end-to-end tests forcompare_snapshots(which previously had no task-level coverage).This is the durable follow-up to #116708 (which stopped killed comparisons from getting stuck in
PROCESSING); together they address the timeout end-to-end.