Capture REDIS exceptions

I have noticed that if there is a REDIS issue such as:

“redis bgsave failed because fork Cannot allocate memory”

The service, which is IMessageService class, is exiting - assuming due to an unhandled exception.

I thought I had a global exception handler applied so I am wondering, What is the best way to trap these exceptions when using service stack so that the service remains running and queue processing also remains intact in a resilient manner.

I note that there is a way to tell REDIS to not raise these exceptions, and we will likely apply this, but I would also like to safeguard the code implementation as well.

I think we may have dropped our global handlers :confused:

I assume this still applies and is the correct approach:



private void HandleUnhandledException(IRequest request, IResponse response, string operationName, Exception exception)
The Redis Exception is caught here but only after navigating to other route, which route does not matter, next page navigation will throw the Redis exception which I expected should rather be returned by any of the SSE endpoints? 


Right, that’s how you would handle any Unhandled non-Service Exceptions.

1 Like