question

Upvotes
Accepted
301 7 22 30

ElementList encoding bug?

For quite some time I have been investigating a weird bug in encoding ElementList with UPA C -- being wrapped, ElementList encoding routines do not finalize encoding of the container.

I was able to narrow the problem to a small code snippet, please see the attached source file: one can see, that every encoding routine call returned 0 or positive value, end the buffer is populated with the encoded value(s), but actual finalization hasn’t happened, therefore during decoding ElementList comes out empty. However, if comment out line #67 and uncomment line #68, the ElementList decoded completely and successfully.

It’s worth to mention:

- the wrap utility works for all other UPA functions, including transport and messages routines. For example, the same implementation of the Encoder class for FieldList works perfectly;

- in the original project/code, even calling rsslEncodeElementListComplete natively(unwrapped) does not solve the problem.

I would really appreciate any assistance in the investigation, because I am out of the ideas.

Thank you in advance.

elektronrefinitiv-realtimeelektron-sdktrepencoding
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Code attachment is missing. Please use "Insert File" button to upload. Thanks.

1 Answer

Upvotes
Accepted
588 10 14 17

I suspect that you’re running into an issue where the elementList structure allocated in the Init function is going out of scope, which is causing your encoding issues.

The elementList structure needs to stay in scope during the entirety of the encoding and decoding of a buffer, as it is referenced several times during the encoding process. The iterators will have keep a pointer to the structure passed in. This structure cannot go out of scope or be changed during encoding or decoding.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.