Skip to content

Instantly share code, notes, and snippets.

@mranney
Created December 6, 2013 23:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mranney/7834026 to your computer and use it in GitHub Desktop.
Save mranney/7834026 to your computer and use it in GitHub Desktop.
dtrace -n 'syscall::writev:entry /execname == "node" && arg2 > 16/ { printf("iovcnt: %d", arg2); }' -n 'syscall::writev:return /execname == "node" && arg1 == -1 && errno == 22/ { printf("%s %s %d\\n", curpsinfo->pr_psargs, probefunc, errno); jstack(100, 8000); }'
1 10260 writev:entry iovcnt: 57
1 10261 writev:return node --nouse-idle-notification /voxer/server/node_router/node_router.js /voxer/ writev 22\n
libc.so.1`__writev+0x15
node`uv__write.part.5+0x18f
node`uv_write2+0x1b9
node`uv_write+0x35
node`_ZN4node10StreamWrap6WritevERKN2v89ArgumentsE+0x678
node`_ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE+0x157
<< internal code >>
(anon) as Socket._write at net.js line 595
(anon) as Socket.writev at net.js line 557
afterConnect at net.js line 828
<< internal >>
<< entry >>
node`_ZN2v88internalL6InvokeEbNS0_6HandleINS0_10JSFunctionEEENS1_INS0_6ObjectEEEiPS5_Pb+0x101
node`_ZN2v88internal9Execution4CallENS0_6HandleINS0_6ObjectEEES4_iPS4_Pbb+0xc9
node`_ZN2v88Function4CallENS_6HandleINS_6ObjectEEEiPNS1_INS_5ValueEEE+0xf0
node`_ZN4node12MakeCallbackEN2v86HandleINS0_6ObjectEEENS1_INS0_8FunctionEEEiPNS1_INS0_5ValueEEE+0x11e
node`_ZN4node12MakeCallbackEN2v86HandleINS0_6ObjectEEENS1_INS0_6StringEEEiPNS1_INS0_5ValueEEE+0x69
node`_ZN4node7TCPWrap12AfterConnectEP12uv_connect_si+0xff
node`uv__stream_io+0xc9
node`ev_invoke_pending+0x63
node`uv__run+0x94
node`uv_run+0x17
node`_ZN4node5StartEiPPc+0x1c7
node`main+0x1b
node`_start+0x83
@mranney
Copy link
Author

mranney commented Dec 6, 2013

SmartOS has IOV_MAX at 16 and Linux has 1024. Note how when writev() tries to do 57 writes at once that it blows up.

The win was using DTrace to search all node processes on the entire machine for large iovcnt and writev returning EINVAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment