V2 Pool Final Fix Summary
Root Cause Analysis
The test failures are caused by:
- Insufficient Pool Size: Tests are trying to check out 5 workers concurrently but pool only has 4 workers
- Worker Initialization Delays: Python process startup takes ~1.5 seconds, causing checkout timeouts
- Message Queue Pollution: Workers receive checkout requests during initialization
Critical Fixes Needed
1. Increase Pool Size for Concurrent Tests
The concurrent test spawns 5 processes but the pool only has 4 workers:
# Current setup
pool_config = [
pool_size: 4, # TOO SMALL for 5 concurrent checkouts
overflow: 2,
name: genserver_name
]
# Fix:
pool_config = [
pool_size: 6, # Enough for 5 concurrent + 1 spare
overflow: 2,
name: genserver_name
]
2. Pre-warm Workers
Initialize all workers before running concurrent tests:
# After starting pool
Process.sleep(500) # Current delay
# Better: Wait for workers to initialize
for i <- 1..pool_size do
SessionPoolV2.execute_anonymous(:ping, %{warm: true}, pool_name: pool_name)
end
3. Fix Worker Death Test
The worker death test is using a command that doesn’t exist (force_exit
). Need to use a real command that causes Python to exit.
Implementation Status
✅ Made tests synchronous (async: false) ✅ Use start_supervised! for proper cleanup ✅ Added Process.alive? guards ✅ Increased timeouts in config ✅ Fixed process lifetime in concurrent tests ❌ Need to increase pool size for concurrent tests ❌ Need to pre-warm workers ❌ Need to fix worker death test command