Bug 25

Summary: Deadlock with Lua scripts
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:11:45 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2016-09-19.07:22:14]

Joe Mesterhazy has reported a deadlock while anonymizing large studies:
https://groups.google.com/forum/#!topic/orthanc-users/QDBpI2Ptit0

The issue is that the "StableSeries" callback is invoked while the previous "StableStudy" that triggered the anonymization is still running, which causes deadlock as the Lua scripting engine of Orthanc is protected by a mutex.

The fix would consist in introducing a shared message queue (FIFO) to store events and delay their actual processing.

As a temporary workaround, increase the "StableAge" configuration of Orthanc to a higher value (e.g. "180" seconds).
Comment 1 Sébastien Jodogne 2020-06-29 15:19:16 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2016-09-20.07:38:40]

Furthermore, add concurrency against callbacks such as "ReceivedInstanceFilter()", "IncomingHttpRequestFilter()" and "IncomingFindRequestFilter()", that should be fast and thus not be blocked by "On*()" events. This would require duplicating the Lua context.

https://orthanc.chu.ulg.ac.be/book/users/lua.html#callbacks-to-react-to-events
Comment 2 Sébastien Jodogne 2020-06-29 15:21:40 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2018-05-22.11:11:56]

fix issue #25

→ https://hg.orthanc-server.com/orthanc/changeset/4ecb79c6e81c