As far as I can see, shutdown() on macOS may return ENOTCONN if the other side gracefully terminated connection (i.e. called shutdown(SHUT_RDWR) + close). Both sockets are TCP on 127.0.0.1. Not sure if this is conforming to POSIX, but this happens. The same code does not produce ENOTCONN on Linux.
We should probably get eio_posix to ignore this error on shutdown.
https://stackoverflow.com/questions/900042/what-causes-the-enotconn-error?noredirect=1#comment120088266_16008267 says:
We should probably get eio_posix to ignore this error on shutdown.
(from https://github.com/talex5/capnp-rpc/pull/2)