`readable` event not emitted after `net.Socket` reconnects

  • Version: v10.15.1
  • Platform: Windows 10 Pro 64-bit
  • Subsystem: net

If net.Socket loses connection (close is emitted) and the same socket instance is used to reconnect to the same server, no more readable events are emitted (data events are still emitted).

Doesn't work in v10.14/v10.15.1. Works in v8.15.0.

Repro: https://gist.github.com/morkai/fa175bd0104443e6142f3d0e22805653

  1. Run server.js
  2. Run client.js
  3. Client prints client#readable
  4. Kill the server
  5. Run the server again
  6. Client reconnects
  7. Client doesn't print any client#readable lines
  8. Kill the client
  9. Uncomment the data event handler and comment the readable handler in client.js
  10. Run the client
  11. Client prints client#data
  12. Kill the server
  13. Run the server again
  14. Client reconnects
  15. Client resumes printing client#data lines