- 119 tests passed ✅
- 7 tests failed ❌
Status: FALSE NEGATIVE
Issue: The test calls c.endCurrentConnection() on line 75 immediately after starting async.times(5, ...) to acquire locks. This ends the socket connection before the locks can complete, causing timeouts.
Root Cause: Test structure is incorrect - it ends the connection before operations complete.
Fix: Either:
- Wait for locks to complete before ending connection, OR
- Test that ending connection causes proper error handling (not timeout)
Status: POTENTIALLY REAL ISSUE
Issue: Test acquires 5 locks on the same key 'order-test' without max option. Since it's a regular lock (not semaphore), only one lock should be acquired at a time, with others queued. The test expects all 5 to acquire, then releases in reverse order.
Root Cause:
- If this is meant to test semaphore behavior, it should use
{max: 5} - If this is meant to test queued locks, the test logic may be incorrect
- Could be a real issue with lock release order affecting queued locks
Fix: Clarify test intent and fix accordingly.
Status: NEEDS INVESTIGATION 🔍
Failures:
- "writer blocks all readers" - Writer acquires, readers queue, writer releases after 500ms, but readers timeout
- "readers can coexist" - 10 readers should acquire simultaneously, but timeout
- "writer exclusive during readers" - Similar pattern failure
- "rapid read/write cycles" - Rapid cycling between read/write locks times out
- "write lock timeout when readers hold" - Writer should timeout when reader holds, but test times out
Possible Causes:
- Race conditions in tests - Callback-based tests with timing dependencies
- RW lock implementation issues - Problems with write-preferred RW lock logic
- Connection/socket issues - Problems with socket handling in RW client
- Timeout values too short - Tests may need longer timeouts
Investigation Needed:
- Check if RW lock broker logic properly handles write-preferred semantics
- Verify that readers are properly queued when writer holds lock
- Check if socket events are properly propagated
- Review timeout values vs actual operation times
- Fix
client-end.test.ts- Restructure test to properly test connection ending - Clarify
edge-cases.test.ts- Determine if semaphore or queued lock test - Investigate RW lock failures - These may indicate real bugs in RW lock implementation
- Add better error handling - Tests should provide more diagnostic info on failures
- Consider converting to async/await - Callback-based tests are harder to debug
- Run individual failing tests in isolation to get better error messages
- Add logging to RW lock operations to trace execution
- Review RW lock broker implementation for write-preferred logic
- Check if there are known issues with RW locks in the codebase