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.

classification
Title: resource: RLIMIT_xxx and RUSAGE_xxx constants are missing on macOS 10.15.4
Type: Stage: resolved
Components: macOS, Tests Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren, shihai1991, vstinner
Priority: normal Keywords:

Created on 2020-04-01 22:29 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (9)
msg365521 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-01 22:29
Failure seen on the macOS job on a PR:

https://github.com/python/cpython/pull/19252/checks?check_run_id=552502971
of https://github.com/python/cpython/pull/19252/files

Reformatted error:

AssertionError: Regex didn't match:

"Fatal Python error: _enter_buffered_busy: could not acquire lock for <(_io\\.)?BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads"

not found in

'Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/Users/runner/runners/2.165.2/work/cpython/cpython/Lib/test/support/__init__.py", line 2913, in __enter__
    self.old_value = resource.getrlimit(resource.RLIMIT_CORE)
AttributeError: module \'resource\' has no attribute \'RLIMIT_CORE\'
'

It seems like resource.RLIMIT_CORE is not available on this macOS machine.
msg365524 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-01 22:34
> https://github.com/python/cpython/pull/19252/checks?check_run_id=552502971

test.pythoninfo says:

os.uname: posix.uname_result(sysname='Darwin', nodename='Mac-1307.local', release='19.4.0', version='Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64', machine='x86_64')

platform.platform: macOS-10.15.4-x86_64-i386-64bit
msg365525 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-01 22:41
Other errors on the same build:

13 tests failed:
    test_capi test_cmd_line test_exceptions test_faulthandler test_gc
    test_io test_repl test_resource test_selectors test_subprocess
    test_sys test_tempfile test_tracemalloc

test_subprocess: AttributeError: module 'resource' has no attribute 'RLIMIT_NOFILE'

test_selectors.test_above_fd_setsize(): AttributeError: module 'resource' has no attribute 'RLIMIT_NOFILE'

test_resource.test_getrusage(): AttributeError: module 'resource' has no attribute 'RUSAGE_SELF'

Many tests failed because of SuppressCrashReport issue (missing resource.RLIMIT_CORE).
msg365526 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-01 22:43
Yesterday, macOS job was fine with test.pythoninfo:

os.uname: posix.uname_result(sysname='Darwin', nodename='Mac-1303.local', release='19.3.0', version='Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64', machine='x86_64')

platform.platform: macOS-10.15.3-x86_64-i386-64bit


So something changed in<sys/resource.h> header between macOS 10.15.3 and macOS 10.15.4.
msg365547 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-02 01:02
I upgraded my macbook to macOS 10.15.4:

$ ./python.exe -m test.pythoninfo|grep -E 'uname|platform'

os.uname: posix.uname_result(sysname='Darwin', nodename='macbook', release='19.4.0', version='Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64', machine='x86_64')

platform.platform: macOS-10.15.4-x86_64-i386-64bit


I get resource attributes:

$ ./python.exe
Python 3.9.0a5+ (heads/master:e27916b, Apr  2 2020, 02:58:34) 
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
>>> import resource
>>> resource.RLIMIT_CORE
4
>>> resource.RLIMIT_NOFILE
8
>>> resource.RUSAGE_SELF
0


I'm not sure what's wrong with the macOS job. It doesn't seem to use a "framework" build, but:

./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev
make -j4
msg365573 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-04-02 07:22
There's nothing wrong with the Azure CI job, AFAICT.  The issue seems to be in the changes made by the PR itself.  Testing on 10.15.4 from master HEAD, test_resource passes as always.  But after applying the PR under test in the CI, PR 19252 from Issue1635741, the test fails.  It wasn't obvious to me from a quick glance what the problem is but it's late here :)
msg365575 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-02 09:17
> There's nothing wrong with the Azure CI job, AFAICT.  The issue seems to be in the changes made by the PR itself.

The PR modify the resource module. Oh. OOOOH. I see :-D
msg365576 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-04-02 09:49
> The PR modify the resource module. Oh. OOOOH. I see :-D
Do I miss something?
msg365577 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-02 10:11
Ignore this issue, it's a typo in the PR ;-)
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84325
2020-04-02 10:11:11vstinnersetstatus: open -> closed
resolution: not a bug
messages: + msg365577

stage: resolved
2020-04-02 09:49:10shihai1991setmessages: + msg365576
2020-04-02 09:17:07vstinnersetmessages: + msg365575
2020-04-02 07:22:54ned.deilysetmessages: + msg365573
2020-04-02 04:50:31shihai1991setnosy: + shihai1991
2020-04-02 01:02:30vstinnersetmessages: + msg365547
2020-04-01 22:57:25vstinnersettitle: test.support.SuppressCrashReport fails on macOS 10.15.4 -> resource: RLIMIT_xxx and RUSAGE_xxx constants are missing on macOS 10.15.4
2020-04-01 22:43:32vstinnersettitle: test.support.SuppressCrashReport fails on macOS -> test.support.SuppressCrashReport fails on macOS 10.15.4
nosy: + ned.deily, ronaldoussoren

messages: + msg365526

components: + macOS
2020-04-01 22:41:03vstinnersetmessages: + msg365525
2020-04-01 22:34:53vstinnersetmessages: + msg365524
2020-04-01 22:29:54vstinnercreate