8

I have a Node.js app, that runs on a Windows Server 2008. I'm facing a weird problem here.

My app does more than one async tasks. Sending data to socket.io, MySQL, HTTP connections, TCP connections etc.

My Node app becomes unresponsive especially on the socket.io end, and only starts responding back again after any key press on the console. Is this a known issue? Any bypasses around such a behavior?

Note: I am using console.log heavily to keep track of the current operation and errors in process.

4

2 回答 2

7

我做了一些背景调查,得出以下结论。

Windows Server 2008 上的 Powershell 控制台在单击时会进入“暂停”模式。如果您单击其他地方,它会再次释放。 http://www.vistax64.com/powershell/112032-script-pauses-when-you-click-powershell-text-window.html

如果你注意到,console.log是异步的。但是console.warn并且console.error正在阻塞。这些不是异步的。

控制台暂停可能会阻止部分/大部分 Node.js 操作。特别是。因为默认调试级别的 Socket.io 将报告的不仅仅是console.log.

于 2013-05-21T10:40:09.270 回答
0

其他人建议的解决方案对我不起作用,但使用Cmder启动脚本解决了它。绝对看起来是控制台应用程序问题,而不是 node.js 问题。

于 2021-07-13T00:14:27.423 回答