Skip to content

Conversation

@danlamanna
Copy link
Member

@danlamanna danlamanna commented Nov 10, 2025

This was leading to quite reproducible deadlocks during publish. When
the table is locked for share mode and two concurrenct transactions
acquire the lock, t1 acquires a row exclusive lock on IsicId creation
and waits for t2 that's just been opened in share mode to complete. When
t2 then attempts to acquire a row exclusive lock to create an IsicId -
t2 deadlocks because it recognizes that it's now waiting for t1.

This modifies the code such that an exclusive lock is acquired, and
reads are the only operations that can happen concurrently. This makes
it such that every accession_publish call is effectively serialized.

This was leading to quite reproducible deadlocks during publish. When
the table is locked for share mode and two concurrenct transactions
acquire the lock, t1 acquires a row exclusive lock on IsicId creation
and waits for t2 that's just been opened in share mode to complete. When
t2 then attempts to acquire a row exclusive lock to create an IsicId -
t2 deadlocks because it recognizes that it's now waiting for t1.

This modifies the code such that an exclusive lock is acquired, and
reads are the only operations that can happen concurrently. This makes
it such that every accession_publish call is effectively serialized.
@danlamanna danlamanna merged commit 745394a into master Nov 17, 2025
2 checks passed
@danlamanna danlamanna deleted the fix-table-locking branch November 17, 2025 19:56
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.

2 participants