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.

Title: test_fcntl failing on macOS CI
Type: behavior Stage: resolved
Components: macOS, Tests Versions: Python 3.9, Python 3.8, Python 3.7
Status: closed Resolution: duplicate
Dependencies: Superseder: Add open_file_descriptor parameter to fcntl.lockf() (use the new F_OFD_SETLK flag)
View: 22367
Assigned To: Nosy List: alexandre.vassalotti, corona10, ned.deily, ronaldoussoren, steve.dower
Priority: normal Keywords: patch

Created on 2019-11-13 22:34 by steve.dower, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17154 corona10, 2019-11-16 16:42
Messages (3)
msg356565 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-11-13 22:34

Traceback (most recent call last):
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/unittest/", line 60, in testPartExecutor
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/unittest/", line 659, in run
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/unittest/", line 616, in _callTestMethod
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/test/", line 149, in test_lockf_exclusive
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 283, in _Popen
    return Popen(process_obj)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 32, in __init__
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 19, in __init__
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'TestFcntl.test_lockf_exclusive.<locals>.try_lockf_on_other_process'
msg356754 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-11-16 16:42
This issue was reported from victor

And I attached the patch for this on GH 17154.
Please take a look at the patch also.

I apologize for the trouble as the original test code author.
msg356838 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2019-11-18 02:16
This cause of failure PR 17010 was due to change of start methods as follows:
Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.

So I updated the test through PR 17154 and I check that my local mac machine works well. (I did not check it on my local mac machine when I submitted PR 17010 since open description lock was Linux feature, this was my mistake)

And thanks to the tip from Michael Felt, I update the test to skip on the AIX machine. So I expect that when PR 17154 is landed, everything will go well.
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 82971
2019-11-18 06:57:11ned.deilysetstatus: open -> closed
superseder: Add open_file_descriptor parameter to fcntl.lockf() (use the new F_OFD_SETLK flag)
resolution: duplicate
stage: patch review -> resolved
2019-11-18 02:16:42corona10setmessages: + msg356838
2019-11-16 16:44:56corona10setversions: + Python 3.7, Python 3.8, Python 3.9
2019-11-16 16:42:36corona10setnosy: + corona10
messages: + msg356754
pull_requests: + pull_request16697

keywords: + patch
stage: needs patch -> patch review
2019-11-13 22:34:24steve.dowercreate