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
PDU primitives reason_str() throwing KeyError #633
Comments
The only change between 1.5.6 and 1.5.7 was a fix for the QR SCP. It's possible that in backporting one of the fixes I've forgotten to take into account Python 2's str usage. But looking through commits the only thing I see that might be related is #563 but that's for A-ABORT/A-P-ABORT. What is the actual value that's being used for the AE title? It must be ASCII encodable, so if they've changed it to something else that could trigger weird behaviour. |
I don't support you could get a copy of the debugging log output? |
Hmm, if the key error is 7, then it seems likely that its trying to hit the "Called AE title not recognised" diagnostic response for a rejected association, but the source must be 1 (or alternatively the source is 7, which is wildly non-conformant). Yeah, the ACSE trigger is: elif hasattr(rsp, 'result') and rsp.result in [0x01, 0x02]:
# 0x01 is rejected (permanent)
# 0x02 is rejected (transient)
LOGGER.error('Association Rejected')
LOGGER.error(
'Result: {}, Source: {}'
.format(rsp.result_str, rsp.source_str)
)
LOGGER.error('Reason: {}'.format(rsp.reason_str)) I'd say the association request is rejected due to an unrecognised Called AE Title but the peer is responding with a non-conformant A-ASSOCIATE-RJ PDU with a Source of 2 but a Reason/Diagnostic value of 7. The other mystery is why using Also I should add a (better) validator for the A-ASSOCIATE-RJ's diagnostic. And make sure exceptions during ACSE negotiations are handled gracefully |
Sorry - I should have said that I also traced it to a (likely) 'Called AE title not recognized' entry in the table. ...this was the reason for my assumption the problem was passing in a string instead of bytes when I specified the called title to associate(). ...but that could be a wrong assumption! I'll do a bit more digging and let you know what I find, but some other key info:
...So I'll also do a bit more digging tonight or tomorrow for you to try and nail down when and why exactly this was happening (sorry haven't done it yet - wanted to file the issue first) |
No problem, let me know what you find out |
Problem
pdu_primitives.reason_str
seeming to throw aKeyError
, rather than text of problem:Expected Behavior
Shouldn't throw a KeyError
(actually maybe should validate type when passing
ae_title
to eitherAE()
orAE.associate()
.Curiously, I hadn't had this problem using version 1.5.6, even though I was passing strings for
ae_title
to bothAE()
andassociate()
...was there a change in moving from 1.5.6 to 1.5.7 that would now start failing if a string was passed instead of a bytes?
Sorry....
sorry! ...this was a bug report from a user who had just ran an updated bit of code from me. So I haven't had a chance yet to try and reproduce.
Steps To Reproduce (presumably...)
The code in question is an exe via pyinstaller, and I'd just given them a new version I'd built after I'd upgraded my side from pynetdicom 1.5.6 -> 1.5.7.
The trigger seemed to be from me calling
AE()
with a string instead of bytes for theae_title
and/or me subsequently likewise using a string instead of bytes when callingassociate
.My code previously ...subsequently changed to pass bytes instead of strings (though haven't had a chance to hear from customer whether this resolved the problem)
Environment
Sorry can't run as required, but running inside a pyinstaller exe on windows 10 with key info as:
The text was updated successfully, but these errors were encountered: