-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
DICOM associations do not release properly. The TCPConnector lambda remains in memory even when everything is closed. After a certain number of iterations there are sometimes errors (changing to 20-50).
package org.dcm4che6.tool.echoscu;
import org.dcm4che6.conf.model.Connection;
import org.dcm4che6.data.UID;
import org.dcm4che6.net.AAssociate;
import org.dcm4che6.net.Association;
import org.dcm4che6.net.DicomServiceRegistry;
import org.dcm4che6.net.TCPConnector;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
public class MultipleEcho {
public static void main(String[] args) throws Exception {
String calling = "ECHOSCU";
String called = "DICOMSERVER";
String host = "dicomserver.co.uk";
int port = 11112;
for (int i = 0; i < 20; i++) {
DicomServiceRegistry serviceRegistry = new DicomServiceRegistry();
TCPConnector<Association> inst = new TCPConnector<>(
(connector, role) -> new Association(connector, role, serviceRegistry));
CompletableFuture<Void> task = CompletableFuture.runAsync(inst);
AAssociate.RQ rq = new AAssociate.RQ();
rq.setCallingAETitle(calling);
rq.setCalledAETitle(called);
rq.putPresentationContext((byte) 1, UID.VerificationSOPClass, UID.ImplicitVRLittleEndian);
Association as = inst.connect(new Connection(), new Connection().setHostname(host).setPort(port))
.thenCompose(as1 -> as1.open(rq))
.get(3000, TimeUnit.MILLISECONDS);
as.cecho().get(3000, TimeUnit.MILLISECONDS);
as.release();
as.onClose().get(3000, TimeUnit.MILLISECONDS);
task.cancel(true);
}
System.out.println("end");
}
}
Breakpoint after the iterations:
In TCPConnector the run hangs in selector.select(this::onReady);?
Metadata
Metadata
Assignees
Labels
No labels