Bug 103

Summary: queries/.../retrieve API returns HTTP code 200 even when there are server errors
Product: Orthanc Reporter: Sébastien Jodogne <s.jodogne>
Component: Orthanc CoreAssignee: Sébastien Jodogne <s.jodogne>
Status: RESOLVED FIXED    
Severity: normal    
Priority: ---    
Version: unspecified   
Hardware: All   
OS: All   

Description Sébastien Jodogne 2020-06-29 15:14:23 CEST
[BitBucket user: Ales Kozumplik]
[BitBucket date: 2018-09-20.13:20:13]

I am testing Orthanc under various error scenarios. Using docker's tmpfs I allocated only 10 MB storage for its database in`/var/lib/orthanc/db`. I execute modality query followed by the retrieve query. After fetching the first couple of images, orthanc logs the error repeatedly:

> E0920 13:09:22.351950 StoreScp.cpp:220] Exception while storing DICOM: Unable to create a subdirectory or a file in the file storage

The HTTP operation returns with code 200. Most images however are missing from the Orthanc instances as expected.
Comment 1 Sébastien Jodogne 2020-06-29 15:22:29 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2018-09-20.13:23:25]

Please provide complete instructions to reproduce your issue. We need the exact command lines, and full scenario.
Comment 2 Sébastien Jodogne 2020-06-29 15:22:30 CEST
[BitBucket user: Ales Kozumplik]
[BitBucket date: 2018-09-20.15:17:16]

I setup my Orthanc instance as a modality of a DICOM server:

    "DicomModalities" : {
        "pacs" : [ "THE-PACS", "pacs.url.com", 4242 ]
      ...

Create and mount small tmpfs:

    sudo mount -t tmpfs -o size=10M tmpfs /mnt/proxy/

Launch Orthanc from docker image, using the tiny tmpfs instance:

    sudo docker run -p 4242:4242 -p 8042:8042 -v /mnt/proxy/:/var/lib/orthanc/db -v proxy-localhost.json:/etc/orthanc/orthanc.json jodogne/orthanc

Query the PACS modality via REST:

    curl --include -d '{"Level":"Study", "Query": {"PatientID": "438398734"}}' localhost:8042/modalities/pacs/query

Parse the answer and instruct Orthanc to retrieve the result:

    curl --include -d 'THE-PACS' localhost:8042/queries/<hash>/retrieve

The last POST reports HTTP error 200, but there are many filesystem errors in the Orthanc log.
Comment 3 Sébastien Jodogne 2020-06-29 15:22:31 CEST
[BitBucket user: Ales Kozumplik]
[BitBucket date: 2018-09-20.15:25:33]

To clarify: this is quite definitely not specific to running from Docker. The tldr; is "no more disk space in `/var/lib/orthanc/db` still makes Orthanc report 200 for an operation that fails to store data there."
Comment 4 Sébastien Jodogne 2020-06-29 15:27:05 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2020-02-26.12:21:49]

Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)

→ https://hg.orthanc-server.com/orthanc/changeset/5cbbf14e516b