ENOBUFS - How to catch/deal with it?

2,199 views
Skip to first unread message

Jeremy Darling

unread,
Mar 26, 2012, 8:22:24 AM3/26/12
to nodejs, Hook.io
From everything that I've read this primarily deals with Windows and its ability to cache network communications.  I have a hook.io app that with occasionally bomb out with the ENOBUFS exception and for all of my efforts I can't figure out how to catch and deal with this error.

I realize that the exception is raised when the OS can no longer buffer up incoming/outgoing messages.  What I'm wondering is if there is a way to deal with it?  Can I write all incoming messages to a DB (MongoDB is our current DB) and minimalize this issue?  On outgoing is there a way to catch the issue, wait for the buffer to catch up, and then retry some how (again maybe a DB cache)?  How are others dealing with this when they see it?

try/catch doesn't seem to get notified and instead the app just exits writing basic details to the console.  This also appears to strand memory from what I can tell.  Of course it could also be the OS trying to catch up and basically giving up.

Any help greatly appreciated, I've copied both the Hook.io and Node.js groups in hopes that someone has/knows a work around or solution.

 - Jeremy

PS: An "easy" way to duplicate this (although in a completely different manor) is to have a hook that when called emits multiple calls to another hook, this in turn calls the caller a number of times as well.  This basically just sets up a quick scenario and is not what is happening in our production code.

Ben Noordhuis

unread,
Mar 26, 2012, 9:48:44 AM3/26/12
to nod...@googlegroups.com, Hook.io

Jeremy, on what platform are you seeing that? You don't explicitly say
it (or I failed to grasp a subtlety) but you mention Windows?

Jeremy Darling

unread,
Mar 26, 2012, 9:52:14 AM3/26/12
to nod...@googlegroups.com
I've tried on all of the following and see it (at different levels) on each:

Windows 7 - 32 bit
Windows 7 - 64 bit
Windows XP - 32 bit
Windows 2008 Server - 64 bit

All with different ram and drive setups but it seems to match the 50Mb limits I've seen posted on a few different MS boards.

 - Jeremy


--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Bert Belder

unread,
Mar 26, 2012, 2:05:29 PM3/26/12
to nodejs
Do you have a test case that does not rely on hook.io?

Jeremy Darling

unread,
Mar 26, 2012, 3:00:42 PM3/26/12
to nod...@googlegroups.com
I'll see if I can't create one that just uses EventEmitter, though I have to admit that my skills are not so (as the kids say) mad :)

- Jeremy

Bert Belder

unread,
Mar 27, 2012, 9:38:29 AM3/27/12
to nodejs
In theory ENOBUFS could happen when queuing up a really big amount of
socket write()s, or opening a very large number of sockets on windows.
It is more likely to happen if the amount of physical memory in your
machine is small, or if you are running a 32-bit OS. However I tried
and I was unable to make it happen. So if you can come up with a test
case, please.

- Bert
Reply all
Reply to author
Forward
0 new messages