# HG changeset patch # User Alain Mazy # Date 1702023524 -3600 # Node ID 06eb8bc9f0241c3b05f230271906d30d231c7f15 # Parent 176bc05f85f46accac4c517e91eed4581a4af05d raise 409 if multiple clients are writing the same instance at the same time diff -r 176bc05f85f4 -r 06eb8bc9f024 OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Thu Dec 07 12:04:11 2023 +0100 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Fri Dec 08 09:18:44 2023 +0100 @@ -3153,7 +3153,11 @@ if (!transaction.CreateInstance(status, instanceId, hashPatient_, hashStudy_, hashSeries_, hashInstance_)) { - throw OrthancException(ErrorCode_InternalError, "No new instance while overwriting; this should not happen."); + // Note that, sometime, it does not create a new instance, + // in very rare occasions in READ COMMITTED mode when multiple clients are pushing the same instance at the same time, + // this thread will not create the instance because another thread has created it in the meantime. + // At the end, there is always a thread that creates the instance and this is what we expect. + throw OrthancException(ErrorCode_InternalError, HttpStatus_409_Conflict, "No new instance while overwriting; this might happen if another client has pushed the same instance at the same time."); } } else