Author ronaldoussoren
Recipients Giovanni Pizzi, ned.deily, ronaldoussoren
Date 2020-07-15.07:15:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594797350.89.0.135976676058.issue41291@roundup.psfhosted.org>
In-reply-to
Content
If it is reproducable in C this is likely a bug in macOS, and should be reported to them. 

I get the same behaviour as you with the test script, even if I add calls to fhandle.flush and os.fsync to force the content to stable storage.

Interestingly enough I sometimes get other behaviour that shouldn't happen:

Traceback (most recent call last):
  File "/Users/ronald/Downloads/concurrency-tests/test-conc-read.py", line 33, in <module>
    fhandle.flush()
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "concurrency-tests/test-conc-read.py", line 34, in <module>
    os.fsync(fhandle.fileno())
OSError: [Errno 22] Invalid argument


This is with the change I wrote about earlier:

    except FileNotFoundError:
        print(i, ">> DELETED <<")
        # Recreate the file
        time.sleep(0.001) # Wait a bit
        with open(dest_fname, 'wb') as fhandle:
            fhandle.write(b'CONTENT')
            fhandle.flush()
            os.fsync(fhandle.fileno())

This shouldn't happen, "fhandle" is open at this point and hence the low-level file descriptor should still be valid.
History
Date User Action Args
2020-07-15 07:15:50ronaldoussorensetrecipients: + ronaldoussoren, ned.deily, Giovanni Pizzi
2020-07-15 07:15:50ronaldoussorensetmessageid: <1594797350.89.0.135976676058.issue41291@roundup.psfhosted.org>
2020-07-15 07:15:50ronaldoussorenlinkissue41291 messages
2020-07-15 07:15:50ronaldoussorencreate