[PATCH] chg: handle EOF reading data block

Yuya Nishihara yuya at tcha.org
Thu Jul 21 10:29:51 EDT 2016

On Wed, 20 Jul 2016 16:47:20 +0100, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2016-07-21 00:18:35 +0900:
> > When parent and child processes write to ui.fout/ferr, they have different
> > stdio buffers and duplicated fds. So two writes won't be serialized even if
> > we do write(header + data) instead of write(header) + write(data).  
> I'm aware of that but I'm not sure if it is the cause. Mercurial uses
> threads to do batch updating and that may cause issues as well.

batch updating is driven by worker processes, which can cause problems on
plain commandserver, but that's okay for chg because the worker processes
can directly write to client's stdio.

> Even if
> we only have a single thread, it could also be problematic if exceptions
> are raised during writing.

Good point. write(header + data) will be more reliable against errors such
as KeyboardInterrupt.

More information about the Mercurial-devel mailing list