Relative Path for QoSProvider XML Files

9 posts / 0 new
Last post
Offline
Last seen: 1 year 7 months ago
Joined: 05/20/2015
Posts: 11
Relative Path for QoSProvider XML Files

Hey guys,

I have tried every format I can think of, but I always get an error (DDS_QosProvider_load_profiles_from_url_groupI:ERROR: opening profiles group files) when attempting to put a relative path in the URL groups for a QosProvider (this is in the Modern C++ API).  Absolute paths work fine with the file:/// prefix.  But there don't seem to be any examples in the docs using relative paths.  How do I specify a relative path in 6.0.1?

In 5.2.3 we could use the following group of relative search paths and it worked great for finding the qos file running executables in multiple locations within the directory structure.

"[avnsil_qos_library.xml|../../../../dds_qos/avnsil_qos_library.xml|../../../../../dds_qos/avnsil_qos_library.xml|../../../../../../dds_qos/avnsil_qos_library.xml|./plugins/avnsil_qos_library.xml]"

Thanks,

- Craig Wilson

Howard's picture
Offline
Last seen: 1 day 10 hours ago
Joined: 11/29/2012
Posts: 565

Hi Craig,

I'm not sure what the exact syntax was accepted in 5.2.3, but if you want to use URI groups, then you will need to use "file://" to identify file paths.  The file path that comes after "file://" (note double slash not triple) can be relative or absolute...absolute paths start with a "/" or "drive:/".

So using your example:

"[file://avnsil_qos_library.xml | file://../../../../dds_qos/avnsil_qos_library.xml| file://../../../../../dds_qos/avnsil_qos_library.xml | file://../../../../../../dds_qos/avnsil_qos_library.xml | file://./plugins/avnsil_qos_library.xml]"

should work...and load the first file that it finds.

Offline
Last seen: 1 year 7 months ago
Joined: 05/20/2015
Posts: 11

Hey Howard,

This works as expected under Windows, but I'm getting unexpected/buggy behavior under Linux (CentOS 7) using DDS 6.0.1.  If using the following example URI group string:

"[file://avnsil_qos_library.xml | file://../../../../dds_qos/avnsil_qos_library.xml| file://../../../../../dds_qos/avnsil_qos_library.xml | file://../../../../../../dds_qos/avnsil_qos_library.xml]"

I will get an error "DDS_QosProvider_load_profiles_from_url_groupI:ERROR: opening profiles group files" unless the xml file is present in the last entry in the list.  It doesn't seem to matter if the xml file is present in any or all of the previous three specified locations, if the file is not present in the final location, it will not be loaded.  This renders the search path functionality unusable.

Is this a known issue?

Thank you,

- Craig Wilson

 

Howard's picture
Offline
Last seen: 1 day 10 hours ago
Joined: 11/29/2012
Posts: 565

Hi Craig,

So, yes, I can confirm that if you have a URL group, and only the last entry in the group exists, then the following error is printed:

DDS_QosProvider_load_profiles_from_url_groupI:ERROR: opening profiles group files [...]

For example, if I set

set NDDS_QOS_PROFILES="file://./a.xml | file://./b.xml | file://./c.xml | file://./d.xml"

and the only file that exists is "./d.xml", then the error will be encountered.

This is most certainly a bug...not sure if it's known or not, but will file it with the dev team.  HOWEVER, there is a workaround...just put a dummy file as the last file in the group.   The actual search path should preceed the dummy. For example,

set NDDS_QOS_PROFILES="file://./a.xml | file://./b.xml | file://./c.xml | file://./d.xml | file://NEVER_EXISTS.xml"

then Connext DDS 6.0.1 will try to find and load one of the first 4 files.  If it ever tries to load NEVER_EXISTS.xml, that means it didn't find any of the first 4 files...and will produced an error.

Hope that works for you.  Thanks for reporting the bug.

Offline
Last seen: 1 year 7 months ago
Joined: 05/20/2015
Posts: 11

Hey Howard,

The workaround doesn't seem to fix my issue.  On my system, the bug presents itself as: if the last entry in the list exists, it will load fine.  If the last entry in the list does not exist, it will throw the error, regardless of if any preceding entries in the list exist or not. So if I add the dummy entry to the end of the list, it simply always fails.

If it makes a difference, I am not using the environment variable method to set the URI group.  I am using a dds::core::StringSeq to set the url_profile() method of a QosProviderParams variable in code.

- Craig

 

Howard's picture
Offline
Last seen: 1 day 10 hours ago
Joined: 11/29/2012
Posts: 565

So, the bug that I found seems to be only related to environment variable NDDS_QOS_PROFILES.

This line of code has no problem:

   dds::core::QosProvider qos_provider("[file://a.xml | file://b.xml | file://c.xml | file://d.xml]");

If ONLY "a.xml" or "b.xml" or "c.xml" or "d.xml" exists, no errors.  Only if none exist is an error.

What is the code that you're using?

Offline
Last seen: 1 year 7 months ago
Joined: 05/20/2015
Posts: 11

So, I can use the same line of code as you and get the same bug that I've been seeing.

dds::core::QosProvider qos_provider("[file://./avnsil_qos_library.xml | file://../../../../dds_qos/avnsil_qos_library.xml | file://./NEVER_EXISTS.xml]");

The first two files exist and load fine if listed individually or together.  When I add the NEVER_EXISTS.xml to the end of the list, it always fails to load, with the same error.

DDS_QosProvider_load_profiles_from_url_groupI:ERROR: opening profiles group files '[file://./avnsil_qos_library.xml | file://../../../../dds_qos/avnsil_qos_library.xml | file://./NEVER_EXISTS.xml]'
 DDS_QosProvider_load_profiles_from_url_sequenceI:ERROR: loading profiles
 DDS_QosProvider_load_profiles_from_policyI:ERROR: loading profiles
 DDS_QosProvider_load_profilesI:ERROR: loading profiles
 terminate called after throwing an instance of 'dds::core::Error'
   what(): reload profiles

 

Howard's picture
Offline
Last seen: 1 day 10 hours ago
Joined: 11/29/2012
Posts: 565

So what version of Connext DDS are you using?

I've attached my test code (compiled with 6.0.1).  If you use the file "a.xml", you can see that with this single file, renamed to "b", "c", and "d", the only time you see an error is when none of "a", "b", "c" or "d" exists.

Can you modify this code to produce the error that you're seeing?  You might have to create the makefiles for the platform that you're using...I'm on Windows.

 

File Attachments: 
Howard's picture
Offline
Last seen: 1 day 10 hours ago
Joined: 11/29/2012
Posts: 565

So, we looked into this a bit more, it seems that double quotes in the string will cause the problem that I found (not necessarily the problem that you were reporting).

on Windows, if you use the command line to set NDDS_QOS_PROFILES, for example:

set NDDS_QOS_PROFILES="file://./a.xml | file://./b.xml | file://./c.xml | file://./d.xml"

The environment variable actually has the begin and end quotes in the string.  '"file://./a.xml | file://./b.xml | file://./c.xml | file://./d.xml"'

If you use the Environment Variable dialog box in Windows to set the value to

file://./a.xml | file://./b.xml | file://./c.xml | file://./d.xml

then NDDS_QOS_PROFILES will not have any quotes.

With quotes, the error that if it's the last file in the group that exists, the error is produced.  Without quotes, it works...as expected.

I was also able to reproduce this in code.  If I use:

    dds::core::QosProvider qos_provider("[file://a.xml | file://b.xml | file://c.xml | file://d.xml]");

this works...the string itself has no quotes.  But if I use this

    dds::core::QosProvider qos_provider("\"[file://a.xml | file://b.xml | file://c.xml | file://d.xml]\"");

I get the exact same error as using the environment variable...if d.xml is the only file that exists, an error is printed. 

Not sure how this is related to what your issue is...