Get an error 'Error: accept EMFILE' while using mongojs
I just made a simple server which receives data from client via http
protocols and store them into the mongodb. But the server always crashes
with this error:
-----------------------------------------------------------------
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: accept EMFILE
at errnoException (net.js:769:11)
at TCP.onconnection (net.js:1017:24)
-----------------------------------------------------------------
source code is like this:
-----------------------------------------------------------------
app.get('/log', function(req, res) {
var db = require("mongojs").connect("mydb");
var collection = db.collection(req.query.id);
collection.save(req.query, function(err, saved) {
var result = (err || !saved) ? err + " : log not saved " :
req.query;
console.log(result);
res.send(result);
});
});
-----------------------------------------------------------------
The server finds a collection by an id argument which is received by a
client - most of the time, the id is identical - and it stores the whole
data which is represented by json format.
A significant thing is, in this case, whenever the requests are received,
the count of the file's descriptor that are used by this process always
gets bigger. I verified it using this shell command:
-----------------------------------------------------------------
ls -l /proc/<process id>/fd|wc -l
-----------------------------------------------------------------
If I remove the lines that are dealt with mongojs, nothing happens.
I know that a file descriptor is always used by a process when it opens a
file or connects somewhere. But I guess this should not happen because this
is not the case for the concurrent condition.
If this is a bug, could you please recommend a work around for this issue?
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en