-
-
Notifications
You must be signed in to change notification settings - Fork 1
bug(redis): KB initialization fails with 'coroutine' object has no attribute 'ping' #3962
Copy link
Copy link
Open
Labels
Description
Summary
Knowledge base initialization consistently fails with error:
Failed to initialize Redis connections: 'coroutine' object has no attribute 'ping'
Root Cause (Unresolved - needs investigation)
During KB initialization in knowledge/base.py:337-342:
self.aioredis_client = await get_redis_client(
async_client=True, database="knowledge"
)
await self.aioredis_client.ping() # Line 342 failsThe error "'coroutine' object has no attribute 'ping'" indicates that self.aioredis_client is a coroutine object AFTER awaiting, not the actual Redis client.
Investigation Results
What we know:
get_redis_client(async_client=True, database="knowledge")returns_get_connection_manager().get_async_client(database)get_async_client()is properly defined asasync def(line 903 of connection_manager.py)- Calling an async function returns a coroutine ✓
- Line 337 correctly awaits the coroutine ✓
- But somehow
self.aioredis_clientremains a coroutine after the await
Double-coroutine scenario (most likely):
The only way awaiting a coroutine results in another coroutine is if the async function returns a coroutine object directly instead of a result.
This could happen if:
_create_and_verify_async_client()or one of its callees is returning a coroutine instead of awaiting it_ensure_async_pool_exists()is not properly awaited internally- An exception handler is returning an unawaited coroutine
Reproduction path:
- Start backend
- Knowledge base initialization triggers
_init_redis_connections()executes- Line 337-339 awaits
get_redis_client(async_client=True, ...) - Line 342 fails:
await self.aioredis_client.ping()with "'coroutine' object has no attribute 'ping'"
Files Affected
- autobot-backend/knowledge/base.py - line 337-342
- autobot_shared/redis_client.py - get_redis_client()
- autobot_shared/redis_management/connection_manager.py - get_async_client()
Evidence
Full backtrace not available in logs (logger configured for message-only output), but error is consistent and reproducible on every backend startup.
Next Steps
- Add detailed logging to trace the actual type of value returned at each step
- Add test case for async Redis client initialization
- Check recent changes to async retry mechanism (Issue refactor(retry): standardize all retry/backoff logic on retry_mechanism.py — eliminate 4 independent implementations #3830)
Reactions are currently unavailable