You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When PrintSCP receives an N-Delete request it frees memory that may still be in use by the worker print thread, resulting in a memory violation. I think is related to a bug in the Image code which is already known.
WORKAROUND:
In PrintJob.cs line 241 the current code is:
var thread = new Thread(new ThreadStart(DoPrint));
thread.Name = string.Format("PrintJob {0}", SOPInstanceUID.UID);
thread.IsBackground = true;
thread.Start();
Replacing all of the above with:
DoPrint();
Solves the issue for me, as it lets the printing finish before responding, and so the N-DELETE gets called when its safe to dispose of the memory (AFAIK). The only problem I can see is if the other services calls N-DELETE before waiting for a response then this can also fail, but I don't think this is likely. Ideally there should be some check in N-DELETE to makes sure it's safe to release everything - best in the underlying image classes so they can be deleted but not garbage collected.
The text was updated successfully, but these errors were encountered:
This requires changes in fo-dicom.
Maybe we could add a PrintInProgress flag and a OnPrintComplete Action-List.
When printing, then the printInProgress flag is set. After printing the flag is removed and the OnPrintComplete actions are called.
The OnNDelete should not remove directly, but check if PrintInProgress is set. If yes, then an action to free the memory shall be added to the OnPrintComplete list.
PROBLEM:
When PrintSCP receives an N-Delete request it frees memory that may still be in use by the worker print thread, resulting in a memory violation. I think is related to a bug in the Image code which is already known.
WORKAROUND:
In PrintJob.cs line 241 the current code is:
Replacing all of the above with:
Solves the issue for me, as it lets the printing finish before responding, and so the N-DELETE gets called when its safe to dispose of the memory (AFAIK). The only problem I can see is if the other services calls N-DELETE before waiting for a response then this can also fail, but I don't think this is likely. Ideally there should be some check in N-DELETE to makes sure it's safe to release everything - best in the underlying image classes so they can be deleted but not garbage collected.
The text was updated successfully, but these errors were encountered: