I run a testing server for software that depends on the massive usage of mqueues (POSIX messages queues). I increased limits to a reasonable level and got it working a long time ago. However, the number of tests (and their mqueues) keeps rising and the tests are starting to fail at creating new mqueues, although the limits don’t seem to be exhausted.
$ cat /proc/sys/fs/mqueue/queues_max # maximum mqueue count
65535
$ sudo mount -t mqueue none /mnt
$ ls -1 /mnt | wc -l # current mqueue count
8445
$ ulimit -q # maximum bytes in mqueues
819200
$ du -s /mnt # current mqueues size
0 /mnt
After a failing call to mq_open()
, errno
is set to 24 which means (according to /usr/include/asm-generic/errno-base.h
):
#define EMFILE 24 /* Too many open files */
Therefore I checked the limit for open files but it seems to be not exhausted, too.
$ ulimit -n # file descriptors limit
1024
$ lsof -u $(whoami) | wc -l # currently open files
306
Are these checks correct? Is there anything more I should check?
I have looked at How to check ulimit usage but the usage checks seem to be specific to particular limits and mqueues are not mentioned there.
Since the behavior of mqueues has been changing over time due to bugs, my kernel version is 4.1.13-rt15+
.
I built the kernel myself using the appropriate real-time patch with no further modifications. I have not switched the kernel recently (when the problem started to appear).