Reputation: 1384
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.
Upvotes: 11
Views: 2502
Reputation: 11
I faced the same problem in a Windows Machine with my Node.js server running on PowerShell.
I solved it disabling Quick Edit Mode and Insert options in the Properties panel of PowerShell. It seems like pause the process when you click on the terminal with those two options enabled.
Hope this helps you, bro.
Upvotes: 1
Reputation: 552
Solutions that other people have suggested didn't work for me, but using Cmder to start the script solved it. Definitely appears to be a console application problem, rather than a node.js problem.
Upvotes: 0
Reputation: 1384
I did a bit of a background check and came to the following conclusions.
The Powershell console on Windows Server 2008 goes on a 'pause' mode when clicked on it. It is released again if you click elsewhere. http://www.vistax64.com/powershell/112032-script-pauses-when-you-click-powershell-text-window.html
If you notice, console.log
is async. But console.warn
and console.error
are blocking. These are not async.
The console pause might block some/most part of the Node.js operations. Esp. as Socket.io at default debugging level will report with more than just console.log
.
Upvotes: 7