Am 2018-03-02 um 05:14 schrieb Yuya Nishihara:
> On Thu, 1 Mar 2018 11:06:59 +0100, Sascha Nemecek wrote:
>> # HG changeset patch
>> # User Sascha Nemecek <neme...@wienfluss.net>
>> # Date 1519831479 -3600
>> # Wed Feb 28 16:24:39 2018 +0100
>> # Node ID 42ddf4ee4f91d76f19ca0c3efc4c8e4c1c6fa96c
>> # Parent 1bd132a021dd00f96604e33a8fb5306d37e56007
>> Don't close 'fp' (= 'ui.fout') stream to prevent 'ValueError: I/O
>> operation on closed file' (Bug #5807).
>> Regression of changeset 30261:6bed17ba00a1
>> diff -r 1bd132a021dd -r 42ddf4ee4f91 hgext/convert/subversion.py
>> --- a/hgext/convert/subversion.py Wed Feb 21 14:36:42 2018 +0530
>> +++ b/hgext/convert/subversion.py Wed Feb 28 16:24:39 2018 +0100
>> @@ -149,7 +149,7 @@
>> pickle.dump(str(inst), fp, protocol)
>> pickle.dump(None, fp, protocol)
>> - fp.close()
>> + fp.flush()
>> # With large history, cleanup process goes crazy and suddenly
>> # consumes *huge* amount of memory. The output file being closed,
>> # there is no need for clean termination.
> I don't think fp.close() was the source of the problem. Here the process
> _exit()s so no cleanup would be run.
Of course, the problem might lie deeper. Empirically tested, the
fp.close() triggered the reported error output. From my observation, the
fp.close() affected stdout of the convert function and also pdb.
Therefore I came to the conclusion that the fp.close() / ui.fout.close()
was the culprit.
> I suspect that some hidden bug was disclosed by the change 3a4c0905f357,
> "util: always force line buffered stdout when stdout is a tty." Before,
> ui.fout.close() just called fflush() because sys.stdout.close() doesn't
> close the underlying file stream. This no longer applies to the current
> ui.fout as it is created by fdopen(1).
This sounds reasonable to me.
Since I'm not a python developer and lack the insight into the project,
I did not and could not dig deeper. So there might be a better fix than
my humble patch.
PS: Thanks fly to Augie for fixing my damaged patch. I'll try to do
better next time.
Mercurial-devel mailing list