Skip to content

Fix race condition in Duplicate Manager causing UI freeze/crash#1095

Open
cd-dr wants to merge 1 commit intocrocodilestick:mainfrom
cd-dr:fix/duplicate-manager-race-condition
Open

Fix race condition in Duplicate Manager causing UI freeze/crash#1095
cd-dr wants to merge 1 commit intocrocodilestick:mainfrom
cd-dr:fix/duplicate-manager-race-condition

Conversation

@cd-dr
Copy link

@cd-dr cd-dr commented Feb 11, 2026

The Duplicate Manager experiences race conditions when deleting or merging multiple books, leading to UI freezes and application crashes.

Cause:

  • Multiple rapid database commits and cache invalidations per book
  • Immediate page reload before background operations completed

Fix:

  • Batch cache invalidation to run once after all operations complete
  • Add skip_cache_invalidation parameter to delete_book_from_table()
  • Add 800ms delay before page reload to allow cleanup to finish
  • Remove queued duplicate scan calls (page reload handles refresh)

This eliminates database contention and prevents session conflicts during batch operations in the Duplicate Manager.

Fixes: #1084

The Duplicate Manager experienced race conditions when deleting or merging
multiple books, leading to UI freezes and application crashes.

Root Cause:
- Multiple rapid database commits and cache invalidations per book
- Immediate page reload before background operations completed
- Conflicting database sessions during cleanup

Fix:
- Batch cache invalidation to run once after all operations complete
- Add skip_cache_invalidation parameter to delete_book_from_table()
- Add 800ms delay before page reload to allow cleanup to finish
- Remove queued duplicate scan calls (page reload handles refresh)

This eliminates database contention and prevents session conflicts
during batch operations in the Duplicate Manager.

Fixes: DELETE SELECTED and MERGE SELECTED operations in duplicates page
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.

[bug] Crash when too many duplicates

1 participant