1. Russ Cox
  2. plan9port
  3. Issues


Issue #120 new

acme: external program dies unexpectedly & silently

Jacek Masiulaniec
created an issue

In a blank window, execute in turn:

yes | nc -l 2020
nc localhost 2020 | wc

The client dies after reading between 1K and 5K (OSX) or 374K (Linux).

When started from win, the client keeps reading as it should.

Reproducible using tip on: OSX 10.7.5, Ubuntu 64 2012.10.

Comments (4)

  1. Jacek Masiulaniec reporter

    Since I've got it reproduced on Linux, I could use strace to figure it out. Turns out this is normal, somewhat assymetric, nc behavior.

    nc the client, having its fd 0 set to /dev/null, receives EOF at read(2), and communicates to the other end that no more data will flow in this particular direction via the shutdown(2) system call.

    nc the server, receives the shutdown in the form of EOF at read(2) time. However, it interprets it as a client going away completely, i.e. cease of data in any direction. So it issues a full close(2).

    nc the client exits due to EOF at read(2).

    nc the server could have continued to pass data in the other (still open) direction, as the client was there willing to process it.

    The work-around is to pass nc the client the -d flag.

  2. Log in to comment