I've read everything on this issue on this and other forums I can find and have tried every problem solving measure recommended, but to no avail. I have a short, simple utility that creates a POSIX message queue with specified max_msg and maxmsg_size values. This utility works just fine on a test instance (AWS) of Ubuntu 20.04.06 LTS, but fails on another instance of the same release with identical message queue system configurations:
/proc/sys/fs/mqueue/msg_default = 10
/proc/sys/fs/mqueue/msg_max = 32000
/proc/sys/fs/mqueue/msgsize_default = 8192
/proc/sys/fs/mqueue/msgsize_max = 8192
/proc/sys/fs/mqueue/queues_max = 256
There are currently no message queues on the problem system, but the /dev/mqueue directory has been created with the correct permissions and mounted.
The relevant bit of code (with actual error logging omitted):
struct mq_attr mq_attr = { 0, 0, 0, 0 };
mq_attr.mq_flags = 0;
mq_attr.mq_maxmsg = 100;
mq_attr.mq_msgsize = 138;
mq_attr.mq_curmsgs = 0;
if ( mq_open( qfname.c_str() // From a command-line arg
, (O_RDWR | O_CREAT | O_EXCL)
, (S_IRUSR | S_IWUSR)
, &mq_attr ) != 0 )
{
// Error logging here
}
The process has no other files open and is being run as the same user on both systems. No other programs are experiencing any issues with file opens on the problem system. I'm stumped.
I've tried reducing both the maxmsg and msgsize values to 1, but with no effect.