Commit Graph

3 Commits

Author SHA1 Message Date
Puskar Basu
3f4eaae1a8 Fix db client deadlocks with non-blocking cleanup and RW locks (#4918) 2025-12-16 21:19:27 +05:30
Nathan Wallace
189a1e38a2 Fix race condition on customSearchPath slice closes #4792 (#4837)
* Add test for #4792: customSearchPath data race

This test demonstrates the data race on the customSearchPath slice when
accessed concurrently from multiple goroutines without synchronization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix #4792: Add mutex protection for customSearchPath slice

The customSearchPath slice was being accessed concurrently from multiple
goroutines without synchronization, causing data races. This fix adds a
dedicated mutex (searchPathMutex) to protect all reads and writes to the
customSearchPath and searchPathPrefix fields.

Changes:
- Added searchPathMutex field to DbClient struct
- Initialize searchPathMutex in NewDbClient constructor
- Protected all customSearchPath writes in SetRequiredSessionSearchPath
- Protected all customSearchPath reads in GetRequiredSessionSearchPath
- Protected all customSearchPath reads in GetCustomSearchPath
- Fixed logging in ensureSessionSearchPath to use already-fetched value
- Updated test to initialize searchPathMutex for proper testing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-16 11:51:41 -05:00
Nathan Wallace
2e5f3fda97 Add comprehensive passing tests from bug hunting initiative (#4864) 2025-11-13 09:26:46 +08:00