1

I created a message_server in the qnx environment, and the "library_error" always appeared :

#include <boost/interprocess/ipc/message_queue.hpp>

int main() {
    boost::interprocess::message_queue mq(boost::interprocess::open_or_create, "my_queue", 100, 10);
    mq.remove("my_queue");
}

In log file:

terminate called after throwing an instance of 'boost::interprocess::interprocess_exception'
  what():  boost::interprocess_exception::library_error

2 Answers 2

0

First, note that you SHOULD not remove the queue while you have it open. Assuming, for the sake of this answer that you donot actually do that in your real code, and the exception is raised in the message_queue constructor.

You should start by handling the exception and finding out the cause:

try {
    boost::interprocess::message_queue mq(boost::interprocess::open_or_create, "my_queue", 100, 10);
} catch (boost::interprocess::interprocess_exception const& ex) {
    std::cout << ex.what() << std::endl;
}

However, in your case, it looks like the message is going to be "boost::interprocess_exception::library_error". Sadly, that means that there is no useful message (see exceptions.hpp):

     else if(str){
        m_str = str;
     }
     else{
        m_str = "boost::interprocess_exception::library_error";
     }

In that case, I'd suggest hooking up your trusty debugger and seeing at what point the exception is raised. E.g. in gdb you could do:

(gdb) start
(gdb) catch throw
(gdb) run

And you will can get the backtrace at the time the exception is raised.

If that doesn't help, consider checking the OS support required, and to rule out permission issues.

Sign up to request clarification or add additional context in comments.

3 Comments

My program runs on the 8295 chip. I use the COM port to connect the PC and the chip for debugging. The gdb environment is difficult to build.
Alternatively you can modify the header and have it save the stacktrace at that point using Boost Stacktrace. That's assuming you have addr2line or libbacktrace for your platform. That way you avoid the need for a debugger. However, it seems like the other answer suggests that features might need to be enabled, so I'd look at that first.
Anyways: here's some background info on using Boost Stacktrace with the various backend configs stackoverflow.com/a/78433803/85371
0

Is the error restricted to accessing message queues through boost? If not, make sure you have a message queue server running on your QNX system.

$ pidin -p mqueue

The use of POSIX message queues on QNX requires a stand-alone server, called mqueue (the same way that the use of pipes requires the pipe server). If it is not running on your system then any call to mq_*() (which is what boost is probably doing) will fail.

Add mqueue to your system and run it.

4 Comments

# pidin -p mqueue pid tid name prio STATE Blocked Currently only boost has problems
Do you mean to say other software is actively using the same kind of message queues successfully? Or just all other - non-mq - software is running normally?
All other - non-mq - software is running normally
I have a question: Does BOOST necessarily need mqueue to run properly?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.