-
Notifications
You must be signed in to change notification settings - Fork 151
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
Concurrent AVP encoding issue - AvpDataException: Not enough data in buffer! (fixes #1) #2
Conversation
…and, also adding logging and adding condition to skip adding peer to realm if it already exists
Fix issue that peer cannot be added through jmx-console command.
Hi @tomazas, would you have the time to revisit this PR so it can be merged ? It has a few conflicts now, and some of the changes are already covered in other ways (eg, addPeerName duplicate check is already done with jdiameter/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmImpl.java Line 106 in 6e911bf
Ideally a PR should solve a specific problem, this way it's easier to review and merge each fix. Feel free to break into smaller PRs if you feel like. Thanks. |
This PR includes several changes:
Will prepare commits with the valid fixes, in case the first issue is observed again we can revisit and try to fix it a better way. |
…es-in-PeerFSM Feature/fix concurrency issues in peer fsm
Hi all,
We have found 2 concurrency issues with AVP encoding/decoding when doing load tests.
And also a BufferOverflow in the end:
Problem - encoded/decoded Diameter packets get corrupted (missing child AVPs).
Reason - This is due to the fact that the function getGrouped that converts AvpImpl.java rawData to groupedData is called
concurrently
when doing encodeAvpSet(). If this is done in the loop before data.write(raw) operation in encodeAvpSet, then all child AVPs could be left unencoded (not written) to the packet (since avp.getRaw().length becomes 0). And since a correct AVP length is written here, the packet gets corrupted.2.We also obtained a
NullpointerException
in SessionImpl.java, when doing a release, due to the fact that container concurrently was set tonull
via setContainer, so this was also fixed. However, don't know what the "// FIXME" is for, but I guess it relates to the same problem.With this pull I propose a possible fix for this issue. Also to encapsulate more the existing data in AvpImpl.java, i.e. make rawData/groupedData not accessible from outside. ALSO to forbid to swap between rawData/groupedData in runtime, i.e. to not change created AVP.