Bug 119 - /patients/.../archive returns a 500 when JobsHistorySize is 0
Summary: /patients/.../archive returns a 500 when JobsHistorySize is 0
Status: RESOLVED FIXED
Alias: None
Product: Orthanc
Classification: Unclassified
Component: Orthanc Core (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Assignee: Sébastien Jodogne
URL:
Depends on:
Blocks:
 
Reported: 2020-06-29 15:14 CEST by Sébastien Jodogne
Modified: 2020-06-29 15:24 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sébastien Jodogne 2020-06-29 15:14:52 CEST
[BitBucket user: Alain Mazy]
[BitBucket date: 2018-12-26.12:28:55]

The job actually succeeds but, to return the HTTP response, we're trying to look in the job history to get the state of the job.  Since history size is 0, it is not found -> 500

of course, same problem happens with /media too.
Comment 1 Sébastien Jodogne 2020-06-29 15:23:16 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2018-12-28.08:09:38]

This is the expected behavior if the asynchronous mode is used: If the job history size is 0, the state of a job is "lost" as soon as it succeeds or fails. Either set the job history size to 1, or use the synchronous mode for creating archives.
Comment 2 Sébastien Jodogne 2020-06-29 15:23:18 CEST
[BitBucket user: Alain Mazy]
[BitBucket date: 2018-12-28.08:54:26]

Well, the problem is that this happens when using the Orthanc Explorer and users don't get their files !  

So I would say we should:

- update Orthanc Explorer to use the synchronous mode
- return a 400 with a nice error message when trying to use the asynchronous mode when JobsHistorySize is 0.
Comment 3 Sébastien Jodogne 2020-06-29 15:23:19 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2018-12-28.09:59:39]

This is very strange, as synchronous mode is the default mode to preserve backward compatibility, and as Orthanc Explorer does not specify "Synchronous" or "Asynchronous" in their body request: https://hg.orthanc-server.com/orthanc/file/b89a4288d60521c924be884141d490d7ed938bef/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp#L103

Looks like an issue within the Orthanc core. I would say that we need:

1. Understand why synchronous mode is not the default, and fix this.
2. Indeed, report 404 on expired jobs => this should be introduced as a separate issue.
Comment 4 Sébastien Jodogne 2020-06-29 15:24:14 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2019-01-24.15:47:13]

Fix issue #119 (/patients/.../archive returns a 500 when JobsHistorySize is 0)

→ https://hg.orthanc-server.com/orthanc/changeset/94a4f75cc746