# asyncio.exceptions.TimeoutError: semaphore could not be acquired within timeout

- **ID:** `python/asyncio-semaphore-timeout`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using asyncio.wait_for() on a semaphore acquire() that times out due to high contention.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   async with asyncio.timeout(5): await sem.acquire()
   ```
2. **** (80% success)
   ```
   for i in range(3): try: await asyncio.wait_for(sem.acquire(), 1); break except TimeoutError: pass
   ```

## Dead Ends

- **** — May still fail under heavy load; doesn't address root cause. (60% fail)
- **** — Leads to resource exhaustion and potential system instability. (70% fail)
