OnJobSuccess issue

I need to grab more data on this but basically when receiving many images at a time I’ve run into an issue where when I’m hitting the OnJobSuccess method with a job id that doesn’t exist. It would be too costly for me to set up an example of the production environment on this.

I can share the relevant code and errors I am hitting

function OnJobSuccess(jobId)
local JobDetails = ParseJson(RestApiGet(‘/jobs/’ … jobId))
local DicomDataPath = allApiUrls[‘archive_path’]
if (JobDetails.Type == ‘Archive’) then

//not relevant logic here

at this point I get this error out of logs:

E0715 18:14:56.056530 LuaScripting.cpp:417] Lua: Unknown resource
E0715 18:14:56.056536 LuaScripting.cpp:420] Lua: Error in RestApiGet() for URI: /jobs/a830ff88-fc03-49b8-a455-7bf72b285a40
E0715 18:14:56.056550 OrthancException.cpp:57] Cannot execute a Lua command: [string “line”]:85: attempt to index a nil value (local ‘JobDetails’)
E0715 18:14:56.056561 LuaScripting.cpp:772] Error while processing Lua events: Cannot execute a Lua command

I just don’t understand what circumstances could cause this to ever happen. Could it be that in time it took for OnJobSuccess to be hit I lost the job?

My configurations are here:

and I am using Mysql to index but not store DICOMs, My Orthanc version is 1.8.2


The JobComplete events are queued (with the jobId). Therefore if you’re handling a lot of jobs at the same time, I guess the job might be deleted from history at the time the lua event handler is triggered.

I would suggest that you increase the “JobsHistorySize” configuration.



Thank you for the suggestion Alain!

I’ve increased JobHistorySize from 40 to 100 as well as LimitJobs - I’ve increased that from 60 to 100. Unfortunately since this problem doesn’t happen often it will be hard to tell if this solves it but I suppose there’s not much I can do besides wait and see. I’m hoping this does it!