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
I have investigated a memory leak, which seems to be related to attempts of manually aborting associations.
Minimal example:
def_on_pdu_recv(self, event):
# Method bound to `EVT_PDU_RECV` event.ifisinstance(event.pdu, A_RELEASE_RQ):
self._on_handle_a_release_rq(event)
def_on_handle_a_release_rq(self, event):
try:
do_something_with_event(event)
exceptException:
# The following line of code kills the Association thread. The DUL's # FSM is stuck in `Sta6`, thus it is not killed by the Association # thread's `kill()` method, which is invoked by the calling to `abort()` # below. As a result, the `kill()` method is stuck in a `while` loop# trying to stop the DUL.event.assoc.abort()
# Due to the above, the line below is never executed.do_something_else()
The above seems like a straight-forward way of aborting, but leads to leaking of DUL threads.
I have found that the below alternative works better:
def_on_pdu_recv(self, event):
# Method bound to `EVT_PDU_RECV` event.ifisinstance(event.pdu, A_RELEASE_RQ):
self._on_handle_a_release_rq(event)
def_on_handle_a_release_rq(self, event):
try:
do_something_with_event(event)
exceptException:
# Manually create the PDU to abort.abort_pdu=A_ABORT_RQ()
abort_pdu.source=0x02abort_pdu.reason_diagnostic=0x00event.assoc.dul.socket.send(abort_pdu.encode())
event.assoc.dul.assoc.is_aborted=Trueevent.assoc.dul.assoc.is_established=False# Hard shutdown of the Association and DUL reactors.event.assoc.dul.assoc._kill=Trueevent.assoc.dul._kill_thread=True# The line below is called.do_something_else()
Hi,
I have investigated a memory leak, which seems to be related to attempts of manually aborting associations.
Minimal example:
The above seems like a straight-forward way of aborting, but leads to leaking of DUL threads.
I have found that the below alternative works better:
The above approach is based on this.
I am wondering what is actually the best approach to abort an association at any time. Thoughts?
Originally posted by @pchristos in #652 (comment)
pydicom 2.3.1
pynetdicom 2.0.2
The text was updated successfully, but these errors were encountered: