Title: PEP 475: fnctl functions are not retried if interrupted by a signal (EINTR)
Type: crash Stage: patch review
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: akeskimo, nierob, vstinner
Priority: normal Keywords: patch

Created on 2018-11-08 12:45 by akeskimo, last changed 2018-11-08 14:38 by vstinner.

Pull Requests
URL Status Linked Edit
PR 10413 open nierob, 2018-11-08 14:06
Messages (5)
msg329469 - (view) Author: Aapo Samuli Keskimolo (akeskimo) Date: 2018-11-08 12:45
According to the EINTR interruption should be retried automatically, but somehow it does not work and the exception is raised:

2018-11-05 05:21:35,257 ERROR:storage(23491): Remote storage operation failed (request: '{  'excludeSubModules': None,
   'storageLocation': 'qt/qtdatavis3d/68faa5b00f73096eb096c6acdfce76b052ca20b9/LinuxUbuntu_18_04x86_64LinuxQEMUarm64GCCqtci-linux-Ubuntu-18.04-x86_64-a6
   'type': 3}')
Traceback (most recent call last):
  File "src/", line 507, in handle
  File "src/", line 437, in handle_upload_artifact"upload of %s to %s", uploadType, message.storageLocation)
  File "/usr/lib/python3.6/logging/", line 1306, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/", line 1442, in _log
  File "/usr/lib/python3.6/logging/", line 1452, in handle
  File "/usr/lib/python3.6/logging/", line 1514, in callHandlers
  File "/usr/lib/python3.6/logging/", line 861, in handle
  File "/home/vmbuilder/qt-ci/src/", line 151, in acquire
    fcntl.lockf(self._lock_fd, fcntl.LOCK_EX)
InterruptedError: [Errno 4] Interrupted system call
msg329470 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-08 12:48
You're right, it should, but the fcntl module hasn't been patched. Are you interested to work or on patch, or do you want to me to find someone to do it?
msg329471 - (view) Author: Aapo Samuli Keskimolo (akeskimo) Date: 2018-11-08 12:51
My colleague has made a prospective fix:
msg329472 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-08 12:53

Oh, nice! Please rebase this change on the master branch and reuse "int async_err = 0;" pattern from Modules/posixmodule.c. You must not raise a new exception if PyErr_CheckSignals() raised an exception, something like:

        return (!async_err) ? posix_error() : NULL;
msg329473 - (view) Author: Nierob (nierob) * Date: 2018-11-08 14:06
PR waits for CLA
Date User Action Args
2018-11-08 14:38:16vstinnersetversions: + Python 3.7, Python 3.8
2018-11-08 14:38:09vstinnersettitle: EINTR is not being retried -> PEP 475: fnctl functions are not retried if interrupted by a signal (EINTR)
2018-11-08 14:06:36nierobsetnosy: + nierob
messages: + msg329473
pull_requests: + pull_request9693

keywords: + patch
stage: patch review
2018-11-08 12:53:42vstinnersetmessages: + msg329472
2018-11-08 12:51:33akeskimosetmessages: + msg329471
2018-11-08 12:48:01vstinnersetnosy: + vstinner
messages: + msg329470
2018-11-08 12:45:30akeskimocreate