| Previous | Next |
| STATUS_MUTANT_NOT_OWNED | STATUS_PORT_ALREADY_SET |
STATUS_SEMAPHORE_LIMIT_EXCEEDED
The semaphore count would exceed its maximum
A semaphore maintains a current count between zero and a fixed maximum. Successful waits decrement the count; ReleaseSemaphore increments it. This status means the requested release adjustment would cross the maximum, which usually indicates an unmatched release or incorrect accounting of resource units.
Record the semaphore maximum, release increment and previous count if the API provides it. A retry cannot fix the invariant while the same count remains. Look for cleanup paths that release after a failed acquisition, duplicate completion callbacks, or code that releases more units than it acquired. Do not raise the maximum only to hide a bookkeeping error unless the capacity model genuinely changed.
What to inspect
- Pair each acquired semaphore unit with exactly one release path.
- Log the release increment and prior count around failures.
- Audit cancellation and error cleanup for releases that run without a successful wait.
References
- Microsoft: Semaphore objects
- Microsoft: ReleaseSemaphore
- Microsoft Open Specifications: NTSTATUS values
Looking for a different code? Search another status or error code.
