title: Why Node.js stop working?
body: <p>I installed node.js on my server and it's working. But it stops after a while with this error:</p>
  
  <pre><code>events.js:77
          throw er; // Unhandled 'error' event
                ^
  Error: Connection lost: The server closed the connection.
      at Protocol.end (/var/www/node/node_modules/mysql/lib/protocol/Protocol.js:73:13)
      at Socket.onend (stream.js:79:10)
      at Socket.EventEmitter.emit (events.js:122:20)
      at _stream_readable.js:910:16
      at process._tickCallback (node.js:373:11)
  error: Forever detected script exited with code: 8
  error: Forever restarting script for 14 time
  </code></pre>
  
  <p>The I run node.js on port <code>8000</code> with <code>socket.io</code>, <code>node-mysql</code> and <code>mc</code>.</p>
  
  <p>The file path to the <code>events.js</code> is <code>/node/lib/events.js</code>.</p>
  
  <p>If I use <code>forever</code> I can run it continuously but the error still comes up. It's just restart the script. Not the best solution (better than nothing, but maybe the worst solution).</p>
  
  <p>I'm gonna give a try to the <code>uncaughtException</code> but still not the best solution. This code:</p>
  
  <pre><code>process.on('uncaughtException', function (err) {
    console.log('Caught exception: ' + err);
  });
  </code></pre>
  
  <p>Please help me out if you can. Thanks.</p>