Hey guys,
I'm not able to get XML QoS files to load in modern C++. We are using version 5.2.3. These work perfectly fine while using the C# APIs. In trying to find a workaround, I found that the XML also will not load if I put it in either $NDDSHOME/resource/xml/NDDS_QOS_PROFILES.xml or <working directory>/USER_QOS_PROFILES.xml. I'm just using the sample code in the user manual almost verbatim.
auto qosParams = dds::core::QosProvider::Default()->default_provider_params(); std::vector<std::string> filePaths; filePaths.push_back("file://avnsil_qos_library.xml"); qosParams.url_profile(filePaths); dds::core::QosProvider::Default()->default_provider_params(qosParams); // <-- This throws a dds::core::Error and crashes the program with a memory error in the CRT
I can check the return from qosParams.url_profile() after I set it, and it looks fine, just like the string I input. Is this a bug, or something I'm doing wrong?
Thanks!
Hi Craig,
You can follow the example on using XML profiles that we posted on the RTI Connext DDS Examples GitHub repository.
To load an XML file with custom QoS defintiions, pass the path to the XML file to the constructor of the QosProvider and use it in the creation of the DomainParticipant. For example:
Fernando.
Thanks Fernando, that's working a lot better for me.
I'm having another problem when I try to confirm that my library has loaded by using qos_profile_libraries(). The call works fine, but it causes the program to crash when exiting the scope of the QosProvider instance. Simply adding the line "auto library_names = qos_provider->qos_profile_libraries();" causes the crash at the end of the scope, even though it returns the values I'm expecting it to. I tried testing with a few other extension methods (QosProviderImpl) and some of them cause the same crash as well. Do I need to do something specific to get those to work?
Thanks,
- Craig
Hi Craig,
Can you post a snippet with the code that makes your application crash? I could not reproduce with a simple example like the following:
Thanks,
Fernando.
Good afternoon Fernando,
We've got a DataDistributionService class that handles the setup and management of our Participants, Publishers, Subscribers and Topics for each application. This is in the constructor where we are creating these objects somewhat like your code in the previous post. I can post the entire method if you would like to see it, but I've experimented with disabling combinations of everything in the method and nothing will make this qos_profile_libraries() call survive the method return.
I can reduce the entire constructor to two lines of code:
and this crashes the program when the method returns. If I comment out the qos_profile_libraries() call, it doesn't crash. The crash is an assertion failed in the operator delete function of dbgdel.cpp:52 in the CRT (_BLOCK_TYPE_IS_VALID(pHead->nBlockUse). So, some type of dynamic memory/heap issue, but I'm unsure how to debug this further. You guys don't include debugging symbols for your code do you? Is there another way to determine which QoS libraries have been loaded?
Also, would this be easier/quicker to solve via email? We have an active maintenance/support contract.
Thanks!
Hi Craig,
I couldn't reproduce with the simple secnario of your constructor. It might be some memory corruption problem. I tried a simple application like the following, combining it with the creation of entities and sample writting, but I did not have any luck.
If you have an active support contract, you can email support@rti.com and they can help you with your problem. Also if you find the answer, please let us know in the forum so that we can learn what things could lead to this kind of problems.
Thanks,
Fernando.