Ran suman tests and identified the following:
-
Missing
asyncmodule - Many tests failed with "Cannot find module 'async'"- Tests affected: alphabet.test.ts, alphabet2.test.ts, alphabet3.test.ts, broker-destroy.test.ts, broker.end.test.ts, client-destroy.test.ts, client-end.test.ts, errors.test.ts, general.test.ts, semaphore.test.ts
- Fix: These tests need
asyncinstalled as a dependency (setup-test.sh should handle this)
-
Missing
live-mutexmodule - Some tests failed with "Cannot find module 'live-mutex'"- Tests affected: four-promise.test.ts, ts.test.ts
- Fix: These tests are importing from 'live-mutex' instead of '../../dist/main' or using relative paths
- Error:
lmx client lock request timed out after 9000 ms, 2 retries attempted to acquire lock for key "order-test" - Status: REAL BUG - Lock acquisition is timing out, suggesting a deadlock or queue issue
- Location: test/@src/edge-cases.test.ts:151
All tests are timing out with "timed out - did you forget to fire a callback?"
- "writer blocks all readers" - Timeout
- "readers can coexist" - Timeout
- "writer exclusive during readers" - Timeout
- "rapid read/write cycles" - Timeout
- "write lock timeout when readers hold" - Timeout
Status: REAL BUGS - All RW lock tests are timing out, indicating callbacks are not being fired.
Root Cause Analysis:
- The RW lock client (
RWLockWritePrefClient) uses methods like:registerWriteFlagCheck()registerWriteFlagAndReadersCheck()incrementReaders()decrementReaders()
- These methods set up callbacks in
this.resolutions[uuid]and send messages to the broker - The broker responds with messages like:
'register-write-flag-success''register-write-flag-and-readers-check-success''increment-readers-success''decrement-readers-success'
- The client should handle these via UUID lookup in the
onDatahandler - Issue: Callbacks are not being called, causing tests to hang
Possible Causes:
- Broker responses not being sent properly
- Client not receiving broker responses
- UUID mismatch between request and response
- Callbacks being cleared before response arrives
- Timeout handling interfering with callback execution
- Total Tests: 101
- Passed: 95
- Failed: 6 (1 edge-case + 5 RW lock tests)
- Setup Failures: 14 (missing dependencies/modules)
-
Fix setup issues first:
- Ensure
asyncmodule is installed - Fix imports in tests to use relative paths instead of 'live-mutex'
- Ensure
-
Investigate RW lock bugs:
- Add logging to track UUID flow between client and broker
- Verify broker is sending responses with correct UUIDs
- Check if client is receiving and processing responses correctly
- Verify timeout handling isn't interfering with callbacks
-
Fix edge-case test:
- Investigate why "order-test" lock acquisition is timing out
- Check for deadlock conditions in lock release order logic