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 assume this still applies and is the correct approach:
AppHost.UncaughtExceptionHandlers.Add(HandleUnhandledException);
…
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?
*/
}