string too long

10 posts / 0 new
Last post
Offline
Last seen: 4 years 8 months ago
Joined: 09/29/2019
Posts: 8
string too long

Hi, I have a problem on DDS.

I set string lenth in idl is 65536, but when I publish data, it said: string too long, truncated to 1024.

Here is my idl struct setting, 

struct datamsg {
string<8> ID;
string<128> file_name;
string<65536> data;
long timestamp;
};

please tell me how to fix it, thanks.

Karen

Organization:
Keywords:
Offline
Last seen: 4 months 2 weeks ago
Joined: 09/23/2018
Posts: 63

As a quick sanity check, can you create a default HelloWorld Example using the contents of your IDL file? This experiment will help determine how to proceed.

HelloWorld.idl:
struct datamsg {
string<8> ID;
string<128> file_name;
string<65536> data;
long timestamp;
};

Generate the example framework:
"%NDDSHOME%"\bin\rtiddsgen -language C++ -example x64Win64VS2017 HelloWorld.idl (Windows)

If you run the resultant publisher and subscriber, with the created USER_QOS_PROFILES.xml Qos File, do you get the string too long message?

Pasting in the exact message helps.

Offline
Last seen: 4 years 8 months ago
Joined: 09/29/2019
Posts: 8

Hello gary, thanks for your reply.

I generate the example framework with HelloWorld.idl and use default QOS file to run.

Same get this string too long message.

Offline
Last seen: 4 years 8 months ago
Joined: 09/29/2019
Posts: 8

The following is the output of new generated subscriber:

Received data

ID: "0"
file_name: "test_data"
data: warning: string too long, truncated to 1024   <- the problem is show here
"Yeeeeeeeeeeeeeeeeeeeeeeeeeeee...
timestamp: 0

Karen

Offline
Last seen: 4 months 2 weeks ago
Joined: 09/23/2018
Posts: 63

Are you on a Windows, Mac or Linux target?

I assume you ran the  rtiddsgen as I mentioned earlier?  (i.e. no additional flags, etc.)

Instead of 65,536,  if you drop the string size to something like 50,000 do you still get that error?    

The reason I ask is because I am trying to determine if it is a transport size limit we need to experiment with or one of the default DDS QoS we need to increase.

 

This article may help.

https://community.rti.com/forum-topic/long-string-length

 

Addition:    What version of DDS are you using 5.3.1,  6.0.1, etc?     

 

Offline
Last seen: 4 years 8 months ago
Joined: 09/29/2019
Posts: 8

My environment is on windows10, DDS version is 6.0.1

For reduce size of string to 50000, even 2048, it doesn't work.

And I find this manual and try it: https://community.rti.com/static/documentation/connext-dds/5.2.3/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/Content/UsersManual/Managing_Memory_for_Built_in_Types.htm , not working too...

Offline
Last seen: 4 months 2 weeks ago
Joined: 09/23/2018
Posts: 63

Since I have Windows 10 and 6.0.1,   I will review my steps:

1.) Setup NDDSHOME, etc.   (console #1)

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\vcvars32.bat"
call "C:\rti_connext_dds-6.0.1\resource\scripts\rtisetenv_x64Win64VS2017.bat"

2.) Create HelloWorld.idl

I start with a completely empty directory with the exception of a HelloWorld.idl file containing:

struct datamsg {

string<8> ID;
string<128> file_name;
string<65536> data;
long timestamp;
};

3.)  Generate the example    (console #1)

"%NDDSHOME%"\bin\rtiddsgen -language C++ -example x64Win64VS2017 HelloWorld.idl

4.) Compile with  VS2017  (console #2)

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\vcvars32.bat"
call "C:\rti_connext_dds-6.0.1\resource\scripts\rtisetenv_x64Win64VS2017.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE\wdexpress.exe"

Retarget the SLN file with VS2017 and compile.

5.) Create a publisher in console #1:

call "C:\rti_connext_dds-6.0.1\resource\scripts\rtisetenv_x64Win64VS2017.bat"

.\objs\x64Win64VS2017\HelloWorld_publisher.exe

6.) Create a subscriber in console #3:

call "C:\rti_connext_dds-6.0.1\resource\scripts\rtisetenv_x64Win64VS2017.bat"

.\objs\x64Win64VS2017\HelloWorld_subscriber.exe


What are you doing differently?

 

There are some QoS settings that we can experiment with but I'm wondering why it works for me and not for you given that we seem to have

identical setups.

 

 

 

 

 

Offline
Last seen: 4 months 2 weeks ago
Joined: 09/23/2018
Posts: 63

Hi Karen,

I think I have confused the issue by thinking that this is a DDS QoS issue where the string you were publishing was too large to be sent over RTPS.

This may not be the case -- this might be a simple case of the string is too large to print to the screen.

I assume your message with  "Yeeeeeeeeeeeeeeeeeeeeee"  in it was you setting the string to a value?   

 

As an experiment,  leave the string size large in the IDL file but initialize the string to something small in your publisher --      e.g.    "This is a test".   

 

Do you still get the error message?

 

Offline
Last seen: 4 years 8 months ago
Joined: 09/29/2019
Posts: 8

Hello Gary.

You got the point ! The problem is just a display limit. I print the lenth of my data with the publish of len (1500), the result is correct !

I'm sorry this is my fault. Thank you.

Offline
Last seen: 4 months 2 weeks ago
Joined: 09/23/2018
Posts: 63

No Problem ....  I learned a lot on this issue so will be adding this to my notes.