Skip to content

fix: resolve deadlock in LoadCTIndex when index file doesn't exist#91

Open
gnana997 wants to merge 1 commit intod-Rickyy-b:masterfrom
certwatch-app:fix/loadctindex-deadlock
Open

fix: resolve deadlock in LoadCTIndex when index file doesn't exist#91
gnana997 wants to merge 1 commit intod-Rickyy-b:masterfrom
certwatch-app:fix/loadctindex-deadlock

Conversation

@gnana997
Copy link

@gnana997 gnana997 commented Feb 3, 2026

Problem

LoadCTIndex holds mutex.Lock() and then calls createCTIndexFile(), which attempts to acquire mutex.RLock(), causing a deadlock when the CT index file doesn't exist on first run.

Solution

Restructure the code to:

  1. Read the file before acquiring the lock
  2. Only hold the lock while marshalling/unmarshalling the index
  3. Inline the file creation logic to avoid nested lock acquisition

@d-Rickyy-b
Copy link
Owner

Thank you for creating this pull request and making me aware of the underlying issue. Sadly, I cannot merge your PR, since I decided to fix the bug a little bit differently. At the same time I also took care of another issue.

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