Skip to content

CRE-6427: Make triggerRegistrationManager thread-safe - #2383

Draft
bolekk wants to merge 1 commit into
mainfrom
bk/CRE-6427-thread-safe-trigger-registration-manager
Draft

CRE-6427: Make triggerRegistrationManager thread-safe#2383
bolekk wants to merge 1 commit into
mainfrom
bk/CRE-6427-thread-safe-trigger-registration-manager

Conversation

@bolekk

@bolekk bolekk commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Concurrent trigger registrations were serialized by the exclusive lock in atomic*Capability.RegisterTrigger and the single-lock (non-thread-safe) triggerRegistrationManager, so the async RegisterTrigger work on the trigger_publisher side (chainlink#23049) still blocked on this lock and startup registrations were slow.

Assign a lock per registration instead of a single lock for the whole manager: the regs map is guarded by a manager mutex while each registration owns its own lock, so (un)registrations of different triggers proceed concurrently and same-trigger lifecycle operations are serialized. RegisterTrigger/UnregisterTrigger now take a read lock on the atomic capability; Update still rebinds registrations under the exclusive write lock.

Concurrent trigger registrations were serialized by the exclusive lock in
atomic*Capability.RegisterTrigger and the single-lock (non-thread-safe)
triggerRegistrationManager, so the async RegisterTrigger work on the
trigger_publisher side (chainlink#23049) still blocked on this lock and
startup registrations were slow.

Assign a lock per registration instead of a single lock for the whole
manager: the regs map is guarded by a manager mutex while each
registration owns its own lock, so (un)registrations of different
triggers proceed concurrently and same-trigger lifecycle operations are
serialized. RegisterTrigger/UnregisterTrigger now take a read lock on
the atomic capability; Update still rebinds registrations under the
exclusive write lock.

10 concurrent registrations with a 100ms underlying call drop from
~1.01s (serialized) to ~0.10s.
@bolekk bolekk changed the title Make triggerRegistrationManager thread-safe [CRE-6427] CRE-6427: Make triggerRegistrationManager thread-safe Sep 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-common

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant