नहीं बना सकता है मैं एक पायथन मॉड्यूल का उपयोग कर रहा हूं जो संदेशक्यूज़ प्राप्त करने के लिए पॉज़िक्स वास्तविक समय एक्सटेंशन को लपेटता है।10 से अधिक mqueues
यह रिपोर्टिंग OSError: This process already has the maximum number of files open
मैं MQ सीमा और rlimit में देखा है और जाँच की है कि वे सभी बहुत अधिक सेट कर रहे हैं इससे पहले कि अजगर कोड
#!/usr/bin env python
import uuid
import posix_ipc
import time
def spawn():
return posix_ipc.MessageQueue("/%s" % uuid.uuid4(), flags=posix_ipc.O_CREAT)
i = 0
while True:
i += 1
spawn()
print(i)
इस बारे में 10 MQS बनाएगा है। जैसे
fs.file-max = 2097152
fs.mqueue.msg_max = 1000
fs.mqueue.queues_max = 1000
और यहां तक कि विशेषाधिकार प्राप्त उपयोगकर्ताओं के लिए भी यह केवल 10 कतार बनायेगा।
बराबर सी सीधे वास्तविक समय एक्सटेंशन का उपयोग कर के रूप में
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <mqueue.h>
#define handle_error(msg) \
do { perror(msg); exit(EXIT_FAILURE); } while (0)
int main(int argc, char **argv)
{
mqd_t mq;
struct mq_attr attr;
char buffer[1024 + 1];
int must_stop = 0;
/* initialize the queue attributes */
attr.mq_flags = 0;
attr.mq_maxmsg = 10;
attr.mq_msgsize = 1024;
attr.mq_curmsgs = 0;
/* create the message queue */
int count = 0;
char name[5];
while (1) {
sprintf(name, "/%d", count);
mq = mq_open(name, O_CREAT | O_RDONLY, 0644, &attr);
if (mq == (mqd_t) -1)
handle_error("mq_open");
count++;
}
return 0;
}
इस प्रकार है (साथ gcc -lrt test.c
संकलन) लेकिन यह केवल मुझे 20 MQS खुला हो जाता है एक समय में। वास्तव में मैं एक समय में कुछ सौ शायद एक हजार खुला होना चाहता हूं।
किसी को भी कोई विचार या सुझाव मिले?
संपादित करें: सी संस्करण में बेहतर त्रुटि जांच। अभी भी अधिकतम
सी कार्यक्रम त्रुटि की जांच सही नहीं है - _errno_ जाँच करता है, तो 'mq_open' रिटर्न' (mqd_t) -1' । – pilcrow
@pilcrow इसे फिक्स्ड –