dcm4che / dcm4chee-arc-light

DICOM Archive J2EE application
440 stars 242 forks source link

Sometimes the deletion of old studies loops indefinitely over the same studies #4343

Open jm2rodriguez opened 10 months ago

jm2rodriguez commented 10 months ago

Sometimes the deletion of old studies loops indefinitely on the same studies and other studies that meets the deletion criteria are not deleted.

This problem does not occur systematically, but only with certain studies. The deletion of old studies must be enabled. Ex. Delete Studies Older Than 95 days.

All studies archived before 95 days must be deleted. If one or more studies pose a problem, this should not lead to an infinite loop on these studies. The deletion of other studies must continue.

Log files,

2024-01-09 06:43:21,184 DEBUG [org.dcm4chee.arc.delete.impl.DeletionServiceEJB] (EE-ManagedExecutorService-default-Thread-28) Query for objects of Study[pk=37400]
2024-01-09 06:43:21,184 DEBUG [org.dcm4chee.arc.delete.impl.DeletionServiceEJB] (EE-ManagedExecutorService-default-Thread-28) **No objects of Study[pk=37400] found**
2024-01-09 06:43:21,184 INFO [org.dcm4chee.arc.delete.impl.PurgeStorageScheduler] (EE-ManagedExecutorService-default-Thread-28) **Successfully delete null on Storage**[id=scality, uri=...]

These logs are repeated indefinitely until those studies are manually deleted via the UI.

Workaround: Delete those studies (Reject + Permanent Delete) But, some of these studies are not displayed in the UI. It is therefore impossible to delete them via the user interface.

All of these studies are produced outside our hospital.

dcm4chee release is 5.31.1

jm2rodriguez commented 10 months ago

The deletion logs show that no objects are found for the study with a pk of 37399

2024-01-11 07:50:22,849 DEBUG [org.dcm4chee.arc.delete.impl.DeletionServiceEJB] (EE-ManagedExecutorService-default-Thread-28) Query for objects of Study[pk=37399]
2024-01-11 07:50:22,849 DEBUG [org.dcm4chee.arc.delete.impl.DeletionServiceEJB] (EE-ManagedExecutorService-default-Thread-28) No objects of Study[pk=37399] found
2024-01-11 07:50:22,849 INFO  [org.dcm4chee.arc.delete.impl.PurgeStorageScheduler] (EE-ManagedExecutorService-default-Thread-28) Successfully delete null on Storage[id=scality, uri=jclouds:s3:https://.../]

This study contains several series and several images, as shown by the SQL queries listed below.

select * from study where pk=37399;
select * from series where study_fk=37399; -- series.pk found 265309, 265304, 265310, 265311
select count(*) from instance where series_fk=265309; -- 2 instances found
select count(*) from instance where series_fk=265304; -- 39 instances found
select count(*) from instance where series_fk=265310; -- 5 instances found
select count(*) from instance where series_fk=265311; -- 1 instance found

The metadata exist for this study.

Why does the search indicate that no object has been found for this study?