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.
As stderr is always written to synchronously, therefore in node. js any use of console. error, or other functions that write to stderr, will block your process until the output has all been written. The method is useful for error messages, but excessive use could slow down your process.
Problems occurring in Node. js application deployments can have a range of symptoms, but can generally be categorized into the following: Uncaught exception or error event in JavaScript code. Excessive memory usage, which may result in an out-of-memory error.
log() function from console class of Node. js is used to display the messages on the console. It prints to stdout with newline. Parameter: This function contains multiple parameters which are to be printed.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With