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

Auto generated code for Inherited structure type IDL doesn't seem to work #12

Closed
vireshshirol opened this issue Dec 13, 2019 · 4 comments · Fixed by #13
Closed

Auto generated code for Inherited structure type IDL doesn't seem to work #12

vireshshirol opened this issue Dec 13, 2019 · 4 comments · Fixed by #13

Comments

@vireshshirol
Copy link

This is a copy of the following comment:
eProsima/Fast-DDS#903 (comment)
Raising it as new as the other thread was closed already.

Hi ,
I was trying to check the sample code workign for inherited struct types in the IDL.
Though the subscriber seems to receive the data from other applications, the publisher crashes in CDR serialize(int32) with NoMemoryException.

I was wondering if it was related to the incomplete support for XCDR in serialization library.
Could you please confirm if the sample generated for the following IDL is due to this issue?

struct Msg {
@key long userID;
//@id 0
string message; //@id 1

};
//@extensibility EXTENSIBLE_EXTENSIBILITY

struct MsgExtended : Msg {
long dummy; //@id 2
};
//@extensibility EXTENSIBLE_EXTENSIBILITY
HelloWorld_IDL.txt

I made further changes in the test code (and some debug logs in Cdr.cpp too)to check if things would work but without any luck.
As the sample code itself crashes ,I am atttaching only the IDL .
Please let me know if any additional info is required.
The installation was from master. (i.e. compiled from source)

Thank you,
Viresh

Update:
Additional info:
Changes to Sample code made were:
a> change the topicKind to WITH_KEY from NO_KEY
b>Add sample data to the MsgExtended structure before publishing.

I think the keylessTopic might work but the intention was to achieve keyed topic . Ther applications in the system are using key and RTI admin console reported topic consistency error for mismatch between OSPL and FastRTPS application.

@richiware
Copy link
Member

I've tested your IDL and the generated example works for me. Indeed, changing topicKind to WITH_KEY and filling the MsgExtended structure. To make sure. Did you use the last code of fastrtpsgen? Are you setting an std::string larger than 255 characters?

@vireshshirol
Copy link
Author

Hi,
Thank you for the confirmation. I will check the following points in the test environments and inform you,
a>latest code of fastrtpsgen
b>std::string larger than 255 chars --->This i am sure i didn't. But let me confirm.

Regards,
Viresh

@Chatrapath
Copy link

Hi, Viresh and I are work to gether. In addition to what Viresh is reporting, we made one additional change. The change is to use the type name as base type name for registering the topic. We still used the derived type message structure for publishing the messages. We made thsi change to acheive communication between derived type publisher and base type subscriber to evaluate type extensibility. Initially, when we simply use the ild file generated code, it works. But the suscriber example generated from the base type ild file doesn't receive messages from the derivce pblisher. From examples and experiments done with RTI Connext code to acheive the same(Derived Pub->Base Sub), we made the change of type name to base type name for registering the topic. After this change, as soon as the publisher recognises a subscriber, it crashes with segmentation fault.

To answer your other questions, the fastrtpsgen is latest version and the string is about 30 characters long.

@omovomo
Copy link

omovomo commented Jan 15, 2020

Hi, Seems there copypasta error in the code for generate :: getKeyMaxCdrSerializedSize for inherited type. Look at this:

size_t NetData::position::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
	size_t current_align = current_alignment;

    current_alignment += NetData::basic_msg::getKeyMaxCdrSerializedSize(current_alignment); 
    ^^^^^^^^^^ - must be current_align

    return current_align;
}

@MiguelCompany MiguelCompany transferred this issue from eProsima/Fast-DDS Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants