0

我创建了一个在本地机器上运行良好的插件stubbydb 。但是在使用詹金斯在远程服务器上运行时,我遇到了以下错误。

2016-03-16T10:58:10.745Z - error: uncaughtException: write EPIPE date=Wed Mar 16 2016 10:58:10 GMT+0000 (GMT), pid=23729, uid=501, gid=500, cwd=/home/deployment, execPath=/usr/local/node/node-v5.2.0/bin/node, version=v5.2.0, argv=[/usr/local/node/node-v5.2.0/bin/node, /usr/local/node/node-default/bin/stubbydb, -d, /tmp/soa-simulator, -p, 7777, -s, /tmp/soa-simulator/], rss=22597632, heapTotal=12671264, heapUsed=8094384, loadavg=[1.7158203125, 0.68505859375, 0.27392578125], uptime=5615485, trace=[column=11, file=util.js, function=Object.exports._errnoException, line=856, method=exports._errnoException, native=false, column=20, file=util.js, function=exports._exceptionWithHostPort, line=879, method=_exceptionWithHostPort, native=false, column=14, file=net.js, function=WriteWrap.afterWrite, line=764, method=afterWrite, native=false], stack=[Error: write EPIPE,     at Object.exports._errnoException (util.js:856:11),     at exports._exceptionWithHostPort (util.js:879:20),     at WriteWrap.afterWrite (net.js:764:14)]

2016-03-16T10:58:36.696Z - error: uncaughtException: This socket is closed. date=Wed Mar 16 2016 10:58:36 GMT+0000 (GMT), pid=23729, uid=501, gid=500, cwd=/home/deployment, execPath=/usr/local/node/node-v5.2.0/bin/node, version=v5.2.0, argv=[/usr/local/node/node-v5.2.0/bin/node, /usr/local/node/node-default/bin/stubbydb, -d, /tmp/soa-simulator, -p, 7777, -s, /tmp/soa-simulator/], rss=25243648, heapTotal=12671264, heapUsed=8775480, loadavg=[1.443359375, 0.7080078125, 0.291015625], uptime=5615511, trace=[column=19, file=net.js, function=Socket._writeGeneric, line=641, method=_writeGeneric, native=false, column=8, file=net.js, function=Socket._write, line=695, method=_write, native=false, column=12, file=_stream_writable.js, function=doWrite, line=293, method=null, native=false, column=5, file=_stream_writable.js, function=writeOrBuffer, line=279, method=null, native=false, column=11, file=_stream_writable.js, function=Socket.Writable.write, line=208, method=Writable.write, native=false, column=40, file=net.js, function=Socket.write, line=619, method=write, native=false, column=16, file=console.js, function=Console.log, line=37, method=log, native=false, column=12, file=/usr/local/node/node-v5.2.0/lib/node_modules/stubby-db/js/stubbyDB.js, function=, line=29, method=null, native=false, column=13, file=events.js, function=emitNone, line=68, method=null, native=false, column=7, file=events.js, function=IncomingMessage.emit, line=167, method=emit, native=false], stack=[Error: This socket is closed.,     at Socket._writeGeneric (net.js:641:19),     at Socket._write (net.js:695:8),     at doWrite (_stream_writable.js:293:12),     at writeOrBuffer (_stream_writable.js:279:5),     at Socket.Writable.write (_stream_writable.js:208:11),     at Socket.write (net.js:619:40),     at Console.log (console.js:37:16),     at IncomingMessage.<anonymous> (/usr/local/node/node-v5.2.0/lib/node_modules/stubby-db/js/stubbyDB.js:29:12),     at emitNone (events.js:68:13),     at IncomingMessage.emit (events.js:167:7)]

所以直到詹金斯的工作正在运行 stubbydb 响应。但是一旦詹金斯的工作完成。它停止工作。console.log()并在声明中给出错误。

如果我登录到服务器并console.log("something")在节点控制台上执行。我看没有错误。此外,如果我在登录后直接运行 stubbydb 而不是 jenkins。它工作正常。

可能是什么原因?我应该避免写入控制台吗?

4

2 回答 2

0

Try doing this ...

FunctionThrowingException().on("error", function(){
       //Handle exception here
});

on the function that is throwing the exception. I had this issue once, but with another application of Node. Handling the exception should do the job.

P.S. This is not the exact solution, as you have not provided the full code. So, just take this idea and go through your code. Should Help.

于 2016-03-16T14:05:08.303 回答
0

我找不到应用程序有什么问题。问题自动解决。它似乎与詹金斯工作或服务器设置有关。但是我已经删除了所有默认的 console.log 并按需进行日志记录。因此,如果有人遇到同样的问题,只需关闭日志记录。

于 2016-05-16T10:30:23.923 回答