LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 09-26-2016, 01:46 PM   #1
newhorizons009
LQ Newbie
 
Registered: Sep 2016
Posts: 14

Rep: Reputation: Disabled
mq_open returns "Too many open files"


Hello All,

I am using mq_open call to open a posix message queue. I am creating with below attributes.

attr.mq_flags = 0;
attr.mq_maxmsg = 50;
attr.mq_msgsize = 8192;

When I do mq_open, it fails with error "Too many open files".

If I change
attr.mq_msgsize = 8192;
to
attr.mq_msgsize = 4000;

It works fine. Any ideas ?

Thanks,
 
Old 09-26-2016, 02:23 PM   #2
rigor
Member
 
Registered: Sep 2011
Posts: 253

Rep: Reputation: Disabled
Generally speaking you'll get an error indicating too many open files when you've exceeded a per process, or system wide, limit on the number of open files ( or something that uses a file descriptor, even if the use of the descriptor is not evident ).

Are you repeatedly calling mq_open, or opening files again and again, without closing them, perhaps in a code loop?
 
1 members found this post helpful.
Old 09-27-2016, 10:59 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,448
Blog Entries: 4

Rep: Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915Reputation: 2915
I suspect that the difference in number is more-or-less a "red herring." That is to say, one setting might conceal the existence of "the underlying bug in your program," but it does not address the bug itself.

Methinks that you should always be nowhere near any such architectural limit on the number of queues. Your program is probably in-error in trying to do so.

Last edited by sundialsvcs; 09-30-2016 at 08:25 AM.
 
Old 09-27-2016, 11:36 PM   #4
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 996
Blog Entries: 11

Rep: Reputation: 359Reputation: 359Reputation: 359Reputation: 359
EMFILE? Check [cat] /proc/sys/fs/mqueue/msgsize_max is 8192 (see mq_overview)
Does it work with attr.mq_maxmsg = 20? (<half total usage [*leaving* mq_msgsize 8192])

uname -rv ; grep msg /proc/self/limits

Last edited by Jjanel; 09-27-2016 at 11:43 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open downloaded "exe" and "bin" files in the LXLE OS rok7751 Linux - General 2 10-16-2015 08:36 AM
[SOLVED] "Insert" & "Delete" key returns "~" in a terminal. sharky Linux - General 15 04-26-2011 08:36 AM
Apache returns "SSH-2.0-OpenSSH_5.1" for many files srunni Linux - Software 5 03-08-2009 04:02 PM
Command "mail" returns "panic: temporary file seek" kenneho Linux - Software 5 12-23-2008 03:27 AM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-29-2004 11:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration