Pipe buffer size and broken pipes
It looks like on most Unix kernels, the 64K is the limit, so when exceeding 65536 bytes, we get
return _write(fd, buf) OSError: [Errno 32] Broken pipe <Greenlet at 0x7f6652e0deb0: <function <lambda> at 0x7f664e9570c8>> failed with OSError
Also, it looks like it's only guaranteed to be atomic/thread-safe up to 4K, though I'm not sure about that in general case.
64K (or is it 4K?) is pretty limiting, I wonder if it's possible to manually split the
bindata into chunks of configurable size (defaulting to 64K on Unix and maybe some other value on Windows) and pass them through in a smart way using gevent's cooperative blocking but in a way that both read/write operations remain atomic? OS pipes are still fast enough to allow for this without a huge performance hit, imo.