[GOBBLIN-2257] Fix thread-safety of specSyncObjects after parallel onAddSpec#4182
Closed
DaisyModi wants to merge 1 commit into
Closed
[GOBBLIN-2257] Fix thread-safety of specSyncObjects after parallel onAddSpec#4182DaisyModi wants to merge 1 commit into
DaisyModi wants to merge 1 commit into
Conversation
…AddSpec GOBBLIN-2257 removed synchronized from onAddSpec and introduced a multi-threaded executor for parallel flow compilation. However, FlowCatalog.specSyncObjects is a plain HashMap that is now accessed concurrently from multiple updateOrAddSpecHelper calls (put/remove without synchronization). Concurrent HashMap modifications can cause lost entries and structural corruption, leading to: - LaunchDagProc errors (syncObject lost, DAG initialization fails) - DagNode not found for Reevaluate actions (orphaned DAGs) Fix: Change specSyncObjects from HashMap to ConcurrentHashMap. Also downgrade the "discovered in SpecStore is missing in FlowCatalog" log from ERROR to WARN. With concurrent writes, this transient condition is expected — the existing exponential backoff retries handle it, and the ERROR level creates false alarms in monitoring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
GOBBLIN-2257 removed
synchronizedfromonAddSpecand introduced a multi-threaded executor for parallel flow compilation, improvingflowConfigsV2GET API P99 latency. However,FlowCatalog.specSyncObjectsis a plainHashMapthat is now accessed concurrently from multipleupdateOrAddSpecHelpercalls without synchronization.The bug
In
updateOrAddSpecHelper, concurrent threads call:specSyncObjects.put(...)(adding sync objects)specSyncObjects.remove(...)(cleaning up after persist)HashMapis not thread-safe for concurrent modifications. This causes:LaunchDagProc - error—getSyncObject()returns null, breaking synchronization withNonScheduledJobRunner, causing DAG initialization failuresDagNode or its job status not found for Reevaluate— orphaned DAGs from failed initializationThe fix
HashMap→ConcurrentHashMapforspecSyncObjects— drop-in replacement, no API change, no impact on P99 latency improvementgetSpecURIs()can list a URI beforeaddSpec()fully commits the data. This is a transient condition already handled by exponential backoff retries; ERROR level creates false alarms in monitoringTest plan
FlowCatalogTestpassesLaunchDagProc - errorandDagNode not founderrors should stop occurring