# HG changeset patch # User Alain Mazy # Date 1634650188 -7200 # Node ID 23aeffecb8cb12bdbcf981dccab53d2dfcab0623 # Parent 588fa6fb32cab12ffddfb482e8030f22874886e7 Fix instances accumulating in DB while their attachments were not stored because of MaximumStorageSize limit reached with a single patient in DB. diff -r 588fa6fb32ca -r 23aeffecb8cb OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Mon Oct 18 21:55:06 2021 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Oct 19 15:29:48 2021 +0200 @@ -2810,7 +2810,7 @@ if (!ok) { - throw OrthancException(ErrorCode_FullStorage); + throw OrthancException(ErrorCode_FullStorage, "Cannot recycle more patients"); } LOG(TRACE) << "Recycling one patient"; @@ -3264,11 +3264,18 @@ { if (e.GetErrorCode() == ErrorCode_DatabaseCannotSerialize) { - throw; + throw; // the transaction has failed -> do not commit the current transaction (and retry) } else { - LOG(ERROR) << "EXCEPTION [" << e.What() << "]"; + LOG(ERROR) << "EXCEPTION [" << e.What() << " - " << e.GetDetails() << "]"; + + if (e.GetErrorCode() == ErrorCode_FullStorage) + { + throw; // do not commit the current transaction + } + + // this is an expected failure, exit normaly and commit the current transaction storeStatus_ = StoreStatus_Failure; } }