NServiceBus
NServiceBus copied to clipboard
Detect hanging handlers to enable mitigating actions from this state
Describe the feature.
Message processing could slow down or even halt when handlers never complete (hang). For example, handlers that deadlock or infinitely wait on a state change that will never happen and the code is not applying any timeout logic or (cooperative) cancellation.
Ideally, the framework should detect such hanging or extremely long-running handlers. After detecting such handlers the endpoint should at minimum log about this. Likely the endpoint will be considered to be in an unhealthy state. It could raise a critical error so that its host can decide to terminate and restart to resolve such persistent issues.
Related
The following community project provides partial solutions to this problem
- Reports long-running handlers: https://github.com/ramonsmits/NServiceBus.SimpleMonitoring
- Raises a critical error if there is no activity for a configurable duration: https://github.com/ramonsmits/NServiceBus.GuardNoActivity
Additional Context
No response