Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release instead of Abort when network_timeout expires #619

Closed
GreasyAvocado opened this issue May 3, 2021 · 5 comments · Fixed by #725
Closed

Release instead of Abort when network_timeout expires #619

GreasyAvocado opened this issue May 3, 2021 · 5 comments · Fixed by #725

Comments

@GreasyAvocado
Copy link

Hello!

I'm using the default network_timeout, which is 60 seconds. After 60 seconds of inactivity, the association aborts

I: Aborting Association
D: Abort Parameters:
D: ============================ BEGIN A-ABORT PDU =============================
D: Abort Source: DUL service-user
D: Abort Reason: No reason given
D: ============================= END A-ABORT PDU ==============================

Is there a way to set the association to get released, rather than aborted, after the timeout expires?

@scaramallion
Copy link
Member

The network timeout exists because with TCP there's no notification when the connection has been dropped by the peer. So the assumption is that after 60s (default) with no communication the connection has been broken. If the connection's broken then there's no reason to send an A-RELEASE (because release is negotiated between the two AEs). An abort, on the other hand, is one sided - the local sends it and doesn't care about any responses.

But to answer your question, no, there's no way to set it to release rather than abort. Why do you prefer a release?

@GreasyAvocado
Copy link
Author

GreasyAvocado commented May 3, 2021

Thanks for the info!

The PACS I'm initiating the association with expects the association to be gracefully released, in order to determine the study transfer has completed. At the current situation, where the association is aborted, the study doesn't switch to a "Complete" state in the PACS.
Unfortunately this is how the PACS has to be configured, so I'm trying to find a way to work around it somehow.

@scaramallion
Copy link
Member

I thought about it a bit more and the release negotiation will send an abort anyway if it tries to release but gets no response. The cost is a longer timeout period (network_timeout + acse_timeout).

I just have a sort of concept in my head that release is for "friendly" disconnects while a network timeout is an "unfriendly" one so should result in an abort. It wouldn't be a big deal to add a config option for it.

@GreasyAvocado
Copy link
Author

I agree with what you wrote, that's also how I see it:

release is for "friendly" disconnects while a network timeout is an "unfriendly"

In the meantime we've implemented a timeout mechanism in Python, based on this: https://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish
We now count the time since the association was last active, and properly releases it if it's been idle for 50 seconds (before the 60 seconds timeout of network_timeout).

If it would be possible to achieve the same natively with pynetdicom, by adding a config option, that would be amazing!
It would save us all the timeout logic :)

@scaramallion
Copy link
Member

I've added the Association.network_timeout_response attribute - if you set it to "A-RELEASE" then it'll do the normal association release instead of abort when the network timeout expires.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants