title: A strange behavior about the console.log in node
body: <p>I am learning EventEmitter. 
  and I have a simple stupid test. (node --version v8.4.0 on win10)</p>
  
  <pre><code>const EventEmitter = require('events');
  
  const emiter1 = new EventEmitter()
  const emiter2 = new EventEmitter()
  
  // let cnt = 1
  
  emiter1.on('ping', () =&gt; {
      // console.log('ping' + cnt++)
      emiter2.emit('pong')
  })
  
  emiter2.on('pong', () =&gt; {
      // console.log('pong' + cnt++)
      emiter1.emit('ping')
  })
  
  emiter1.emit('ping')
  </code></pre>
  
  <p>I expect it will become a infinity function call, because <code>emit()</code> is a sync function.</p>
  
  <p>Here is the output.:</p>
  
  <pre><code>$ node em.js
  C:\tmp\em.js:13
      emiter2.on('pong', () =&gt; {
                      ^
  
  RangeError: Maximum call stack size exceeded
      at EventEmitter.emiter2.on (C:\electron-workspace\tmp\em.js:13:24)
      at emitNone (events.js:105:13)
      at EventEmitter.emit (events.js:207:7)
      at EventEmitter.emiter1.on (C:\electron-workspace\tmp\em.js:10:17)
      at emitNone (events.js:105:13)
      at EventEmitter.emit (events.js:207:7)
      at EventEmitter.emiter2.on (C:\electron-workspace\tmp\em.js:15:17)
      at emitNone (events.js:105:13)
      at EventEmitter.emit (events.js:207:7)
      at EventEmitter.emiter1.on (C:\electron-workspace\tmp\em.js:10:17)
  </code></pre>
  
  <p>Great! Just as I expected.
  But after I uncomment the <code>cnt</code> and <code>console.log</code>, I got a strange behavior. 
  The program finished without an error, and stop at <code>cnt==1600</code> (sometime is 1598, 1599)</p>
  
  <pre><code>$ node em.js
  ping1
  pong2
  ping3
  pong4
  ...
  ...
  pong1596
  ping1597
  pong1598
  ping1599
  pong1600
  
  $
  </code></pre>
  
  <p>I run <code>node em.js 1&gt; out.txt 2&gt; err.txt</code> and both <code>console.log</code> and <code>console.err</code> are correct just as I expect. But I'm still wondering why the err didn't print out directly in my shell?
  Is there a reasonable explanation? thanks in advance.</p>