-
Notifications
You must be signed in to change notification settings - Fork 519
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
C++ Segmentation fault printing XML sub group (parent message prints fine) #807
Comments
Printing is designed to be done on the whole messages only. |
Thanks for your reply. Unfortunately logging was only one side effect. If I remove the print and try to retrieve the OrderUpdateAction, or the ReferenceID, I still get corrupt bytes. (I will edit my original post to highlight this) |
@cpp77 If you can provide a full example then we can look at it. |
Code attached. Instructions:
I reproduce with the MDP3 file from Sunday 14th June 2020: You will see the application terminate with:
Thank you in advance. |
Can you boil this down to a smaller example? This code goes beyond the use of SBE. Best to submit a test case as a patch. |
Hi, unfortunately I don't think I can make a smaller example because the problem only occurs on that particular template. So I need to read the file, read each packet, skip over the other templates until I encounter the MDIncrementalRefreshBook46. I could create a file containing only the bytes of the problematic message (but then I could introduce an artifact). Let me know what you need. I'm happy to provide (if i can). |
If you cannot isolate to a simple test then I would have to spend time understanding your code and data which could take up quite a bit of my day. I could do this if you were on a support contract as a customer, otherwise I've no idea how well you know how to use SBE. |
On a quick scan I can see you are not using the version support correctly. |
Hi, that is possible but given the attributes are all correct (below) surely the problem lies with the next part of the code?
If I had abused SBE, I would expect the bytes to be corrupt and the above values be wrong? So surely the problem must be limited to the below code:
|
Can you at least post your SBE schema? |
Sure, I have attached Schema. It should be the production one from the CME ftp |
This is too large a scope. If it cannot be narrowed down to a repeatable example or test then we cannot further investigate without a support contract. |
This potential issue regards decoding one particular application message. Therefore to reach the message type one must iterate through the file, decoding each PCAP header, packet header and SBE header. This is what the code I attached 2 weeks ago did. I can't see how this can be narrowed down but I'm genuinely open to suggestions? |
Does it work if you have that single message encoded in a buffer on its own? |
Closing due to no follow up or isolated testcase. |
I eventually discovered the problem whilst processing another message and getting the same issue. It never occurred that getters would need to be called in a particular order (to match the XML schema). Some getter methods change the state of the buffer, so if the getters aren't called in the correct order later getters read corrupted data. This requirement puts a lot of emphasis on the client. We're processing 10-12 different messages, each with between 10 and 50 fields, meaning we have to check a lot of methods are called in the correct order. I think it would be better if the getters were const and simply return strong types by casting the bytes without modifying any state. This way the ordering wouldn't matter. This should be possible as I wrote my own MDIncrementalRefreshBook46 class when I didn't know the cause of this issue. @mjpt777 Thank you for your prompt responses throughout. |
For the getters of strings and groups to be const SBE would be necessary to build up an index for the variable length items. This would have a significant cost. If you choose to use something so fast then you need to accept how it works. |
"For the getters of strings and groups to be const SBE would be necessary to build up an index for the variable length items" RE strings, from the CME XML schema:
Surely the length of a string is just the difference between offsets? RE groups:
All the offsets and sizes are known. I'm unsure why an index needed? |
Fields are fixed length but the repeating
This is like saying "just". :-) Take the time to understand the implementation and investigate what happens with the position when progressing over repeating group, which can be nested, and var data. |
I'm processing an MDIncrementalRefreshBook46 message. It contains two XML sub-groups: NoMDEntries followed-by NoOrderIDEntries.
I create the
MDIncrementalRefreshBook46
object and print it. I then iterate through the second XML sub-group and read the referenceID and OrderUpdateAction:The parent message prints fine:
but if I try to retrieve the referenceID I get a null/0 (should be 1) and when reading the OrderUpdateAction I get an invalid value and an exception throw in OrderUpdateAction::get().
This could be misuse on my part, but I can't see what I'm doing wrong?
The text was updated successfully, but these errors were encountered: