diff --git a/src/Simplex/Messaging/Agent/Client.hs b/src/Simplex/Messaging/Agent/Client.hs index 571a044a3..33a3c2a10 100644 --- a/src/Simplex/Messaging/Agent/Client.hs +++ b/src/Simplex/Messaging/Agent/Client.hs @@ -1388,6 +1388,7 @@ temporaryAgentError = \case PROXY _ _ (ProxyProtocolError (SMP.PROXY (SMP.BROKER e))) -> tempBrokerError e PROXY _ _ (ProxyProtocolError (SMP.PROXY SMP.NO_SESSION)) -> True INACTIVE -> True + CRITICAL True _ -> True -- critical errors that do not show restart button are likely to be permanent _ -> False where tempBrokerError = \case diff --git a/src/Simplex/Messaging/Agent/Env/SQLite.hs b/src/Simplex/Messaging/Agent/Env/SQLite.hs index 069470f0b..c08ccef63 100644 --- a/src/Simplex/Messaging/Agent/Env/SQLite.hs +++ b/src/Simplex/Messaging/Agent/Env/SQLite.hs @@ -42,6 +42,7 @@ module Simplex.Messaging.Agent.Env.SQLite where import Control.Concurrent (ThreadId) +import Control.Exception (BlockedIndefinitelyOnSTM (..), SomeException, fromException) import Control.Monad.Except import Control.Monad.IO.Unlift import Control.Monad.Reader @@ -78,7 +79,6 @@ import Simplex.Messaging.Transport (SMPVersion) import Simplex.Messaging.Util (allFinally, catchAllErrors, catchAllErrors', tryAllErrors, tryAllErrors') import System.Mem.Weak (Weak) import System.Random (StdGen, newStdGen) -import UnliftIO (SomeException) import UnliftIO.STM type AM' a = ReaderT Env IO a @@ -313,7 +313,9 @@ agentFinally = allFinally mkInternal {-# INLINE agentFinally #-} mkInternal :: SomeException -> AgentErrorType -mkInternal = INTERNAL . show +mkInternal e = case fromException e of + Just BlockedIndefinitelyOnSTM -> CRITICAL True "Thread blocked indefinitely in STM transaction" + _ -> INTERNAL $ show e {-# INLINE mkInternal #-} data Worker = Worker