On Tue, Mar 24, 2015 at 4:10 AM, Victor Stinner <victor.stin...@gmail.com>
wrote:

> 2015-03-24 2:44 GMT+01:00 Guido van Rossum <gu...@python.org>:
> > For seekable() I couldn't find any dynamic implemetations,
>
> The first call to io.FileIO.seekable() calls lseek(0, SEEK_CUR).
>

Oops. :(


> It's safer to expect that any file method can block on I/O.
>

Yup.


> If you doubt that syscalls can block, try unbuffered FileIO on a NFS
> share with metadata cache disabled ("mount -o noac" on Linux). Unplug
> the network cable and enjoy :-)
>
> I checked yesterday with fstat(): the syscall blocks until the network
> cable is plugged again. At least on Linux, it's not possible to
> interrupt fstat() with a signal like CTRL+c :-(


That's a sad state of the world. NFS just sucks in so many ways... This
also means that if you use a thread pool for this, it might fill up with
tasks that won't make progress, and eventually your thread pool will block
all tasks (unless it's not really a thread pool :-). I guess we need
timeouts on everything and eventually just kill the process. :-(

-- 
--Guido van Rossum (python.org/~guido)

Reply via email to