This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author smurfix
Recipients smurfix
Date 2021-05-23.17:18:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1621790293.8.0.271052485401.issue44219@roundup.psfhosted.org>
In-reply-to
Content
Opening a file calls `isatty` which calls an ioctl with the GIL held.

GDB:
```
#0  __GI___tcgetattr (fd=18, termios_p=termios_p@entry=0x7f618a5df920)
    at ../sysdeps/unix/sysv/linux/tcgetattr.c:38
#1  0x00007f618bd1ca0c in __isatty (fd=<optimized out>) at ../sysdeps/posix/isatty.c:27
#2  0x000000000062b746 in _Py_device_encoding (fd=<optimized out>) at ../Python/fileutils.c:62
#3  0x000000000060bf90 in _io_TextIOWrapper___init___impl (write_through=0, line_buffering=0, 
    newline=0x0, errors='strict', encoding=<optimized out>, 
    buffer=<_io.BufferedWriter at remote 0x7f618986aeb0>, self=0x7f618985a860)
    at ../Modules/_io/textio.c:1149
...
```

Please don't do that.

In my case, the file in question is implemented as a FUSE mount which is served by the same process (different thread of course). Thus holding the GIL at this point causes a rather interesting deadlock.

Tested with 3.9.
History
Date User Action Args
2021-05-23 17:18:13smurfixsetrecipients: + smurfix
2021-05-23 17:18:13smurfixsetmessageid: <1621790293.8.0.271052485401.issue44219@roundup.psfhosted.org>
2021-05-23 17:18:13smurfixlinkissue44219 messages
2021-05-23 17:18:13smurfixcreate