Issue with deleting incoming dicoms when MaximumStorageSize is reached

Hello.

I found some feature that looks like bug or unintended behavior.
In some cases:

  • if “MaximumStorageMode” is set to “Reject”
  • if “MaximumStorageMode” is set to “Recycle” and incoming dicom is large (maximumStorageSize < addedInstanceSize)
    then exception ErrorCode_FullStorage is raised
    Therefore incoming dicoms:
  • are not stored in database (that is OK)
  • are not deleted from disk (that is not OK)

I looked into the source code and I think that you probably need to catch ErrorCode_FullStorage in ServerContext.cpp::ServerContext::StoreResult ServerContext::StoreAfterTranscoding(...)

Something like:

      try {
        result.SetStatus(index_.Store(
          instanceMetadata, summary, attachments, dicom.GetMetadata(), dicom.GetOrigin(), overwrite,
          hasTransferSyntax, transferSyntax, hasPixelDataOffset, pixelDataOffset, isReconstruct));
      } 
      catch (OrthancException& e)
      {
        if (e.GetErrorCode() == ErrorCode_FullStorage)
        {
          LOG(INFO) << "Store returned status: " << result.GetStatus();
        } else {
          throw;
        }
      }

It looks that if result.GetStatus() != StoreStatus_Success then the incoming dicom is deleted in following instructions in this function.

Kind regards,
Marcin

1 Like

Hi Marcin,

Thanks for reporting this issue.
This has now been fixed in:

Best regards,

Alain.

Thanks a lot for quick response, it works correctly now.

Best regards,
Marcin