title: Where does the '{tcp_error, Socket, etimedout}' message of an active socket come from?
body: <p>Our (Linux) server used the option <code>{active, once}</code> with it's sockets, and there were <code>{tcp_error, Socket, etimedout}</code> messages poping up. I know this may be caused by bad network conditions, but there was something strange about it.</p>
  
  <p>TCP keepalive was enabled system-wide on our machine, and the actual option values were:</p>
  
  <pre><code>net.ipv4.tcp_keepalive_time = 1200
  net.ipv4.tcp_keepalive_probes = 9
  net.ipv4.tcp_keepalive_intvl = 75
  </code></pre>
  
  <p>Which means the sockets would timeout in at least 20 minutes, I believe. But strangely, our processes received <code>{tcp_error, Socket, etimedout}</code> in less than 10 seconds.</p>
  
  <p>I was wondering, counld it be triggered by the <code>gen_tcp:send(...)</code> operations? And then I found it impossible because the send operations were all synchronous, they'd fail instantly.</p>
  
  <p>So, my question is, where did the <code>etimedout</code> message come from? Or what triggered it exactly? I goofed around the C source of Erlang VM, especially <code>inet_drv.c</code>, but no conclusion yet.</p>
  
  <p>Thanks.</p>