Bug 167

Summary: job can't be cancelled
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:16:32 CEST
[BitBucket user: Sylvain Rouquette]
[BitBucket date: 2020-02-06.13:36:56]

**What steps will reproduce the problem?**

Sometimes, after a Query/Retreive, the PACS doesn’t seem to send any instances.

The job stays at “Running” and I can’t run another job due to ConcurrentJobs at 2 by default.

I try to cancel the job with the UI. The action returns HTTP 200, but the job keep on running, and I can’t cancel it.

I tried to run Orthanc in VERBOSE and TRACE, I can see the command happening, but there’s no additional logs, no error.

I also tried to restart Orthanc, but I still can’t cancel the jobs.

**What is the expected output? What do you see instead?**

I should be able to cancel a running job, or at least have a log explaining why the job is still running after requesting a cancel.

**What version of the product are you using? On what operating system?**

docker image osimis/orthanc:[20.2.0](https://hub.docker.com/layers/osimis/orthanc/20.2.0/images/sha256-14ecb0805aa022ed6ef59486a8cf201b9f0f6770b752a145be8e9069c79dc472)

but the bug is happening for a month now.

**Please provide sample, possibly anonymized, DICOM files**

Job details

CreationTime: Thu Jan 30 2020 22:32:50 GMT\+0100 \(heure normale dÔÇÖEurope centrale\)  
EffectiveRuntime: 324652.2  
ErrorCode: 0  
ErrorDescription: Success  
ID: 6b17ca8e-6a41-4705-bba8-4a272a6d35f1  
Priority: 0  
Progress: 0  
State: Running  
Type: DicomMoveScu

Description: REST API  
LocalAet: LOCAL\_AET  
Query: \[\{"0008,0050":"ACCESSION\_NUMBER","0008,0052":"SERIES","0010,0020":"PATIENT\_ID","0020,000d":"2.25.1.2.3","0020,000e":"2.25.4.5.6"\}\]  
RemoteAet: REMOTE\_AET
Comment 1 Sébastien Jodogne 2020-06-29 15:26:58 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2020-02-19.14:19:54]

The job can’t be canceled by Orthanc as long as the DICOM association between Orthanc and your PACS is not released. It is up to the PACS to avoid keeping the C-MOVE association up while not answering. You could give a try setting “DicomScuTimeout” to a smaller value \(but different from 0 as this corresponds to infinite timeout\).
Comment 2 Sébastien Jodogne 2020-06-29 15:27:06 CEST
[BitBucket user: Sylvain Rouquette]
[BitBucket date: 2020-02-27.05:53:46]

DicomScuTimeout and DicomScpTimeout were the default values \(10 and 30\) according to this page: https://osimis.atlassian.net/wiki/spaces/OKB/pages/26738689/How+to+use+osimis+orthanc+Docker+images

The association was kept for 24h.

Is it a message the PACS should send? Or is it an active TCP connection?

The problem is that Orthanc is stuck in this state, even after restarting, since the JobsLimit is 2 by default, Orthanc can’t continue working and we can’t unstuck it by cancelling jobs.

The problem was fixed for me because it was a problem on the PACS side and they fixed it, but this seems to be a rare case, kinda hard to reproduce, and Orthanc doesn’t work properly if this happens.
Comment 3 Sébastien Jodogne 2020-06-29 15:27:07 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2020-02-27.09:24:25]

Small note about this sentence: _“The problem is that Orthanc is stuck in this state, even after restarting, since the JobsLimit is 2 by default, Orthanc can’t continue working and we can’t unstuck it by cancelling jobs.”_ => You can start Orthanc with the `--no-jobs` command-line flags in order to prevent it from reloading jobs from its previous execution.
Comment 4 Sébastien Jodogne 2020-06-29 15:27:08 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2020-02-27.10:26:05]

Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)

→ https://hg.orthanc-server.com/orthanc/changeset/58f92b1c8061