On 14.06.2018 16:50, Julian Foad wrote:
> Branko Čibej wrote:
>> The object lifetime and implicit close are very well defined indeed in
>> CPython, which we use. We don't use "modern Pythons on other virtual
>> machines."
>> If this were indeed the source of the problem, a number of
>> other tests would be failing randomly on that bot, and elsewhere too,
>> I'm sure. But ...
>>
>>> with open(path, mode) as f:
>>> f.write(contents)
>> ... on the other hand, making this suggested change won't hurt [...]
> Done ... and it didn't fix the problem.
>
>> It's quite likely a timing problem between cache flush and file open.
>> For a while I was looking at the shelve code to see if there was a
>> missing sync(), but that actually doesn't make sense in the context of
>> the test suite, since 'svn' is invoked as an external process which ends
>> before the tests continue
> It's the other way around:
> * Python writes to a file,
> * Python calls 'svn' as a subprocess,
> * 'svn' opens the file and doesn't see the change
>
> Could it be that we need to run 'sync' immediately *before* calling 'svn' as a subprocess?
A sync (which forces a write to disk) should not be necessary in cases
like this one, as long as we close the file in Python — that should
ensure a write to the OS buffers. If this were the problem, Subversion
wouldn't work on macOS at all.
I still don't understand why this issue manifests only with the shelving
tests, even though we've used the open().write() pattern in our tests
pretty much since they existed. The bot runs the build and tests on a
RAM disk, but I do the same locally and don't see these issues.
It could be a bug in the system-provided python on that particular
version of macOS ... but again, we should have seen that with other
tests, too.
-- Brane
Received on 2018-06-14 16:57:39 CEST