Bug 25 - Deadlock with Lua scripts
Summary: Deadlock with Lua scripts
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:11 CEST by Sébastien Jodogne
Modified: 2020-06-29 15:21 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: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