Skip to content

Crash in urllib/request.py proxy_bypass_macosx_sysconf #105912

@Tristan971

Description

@Tristan971

Crash report

Python process crashes with a SIGABRT signal at the OS level (showing the standard software crash prompt of macOS, most of the time), and a python fatal error other times (the latter being shown here).

Unfortunately I don't have a minimal reproducer on hand.

However it looks exceptionally like a return of #72529 in the offending cause, as well as the workaround (setting the environment variable no_proxy to * fixes it too).

Which might share the same root cause (here: https://bugs.python.org/issue31818) at first glance.

Error messages

objc[79432]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[79432]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Fatal Python error: Aborted

Current thread 0x00000001f66e1e00 (most recent call first):
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 2636 in proxy_bypass_macosx_sysconf
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 2660 in proxy_bypass
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/utils.py", line 814 in should_bypass_proxies
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/utils.py", line 830 in get_environ_proxies
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/sessions.py", line 761 in merge_environment_settings
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/sessions.py", line 579 in request
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/adapters.py", line 331 in request
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/adapters.py", line 372 in request
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/adapters.py", line 110 in get
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/api/auth_methods/token.py", line 278 in lookup_self
  File "/Users/tristan/.ansible/collections/ansible_collections/community/hashi_vault/plugins/module_utils/_auth_method_token.py", line 104 in authenticate
  File "/Users/tristan/.ansible/collections/ansible_collections/community/hashi_vault/plugins/module_utils/_authenticator.py", line 95 in authenticate
  File "/Users/tristan/.ansible/collections/ansible_collections/community/hashi_vault/plugins/lookup/hashi_vault.py", line 273 in run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 1032 in _lookup
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/jinja2/runtime.py", line 290 in call
  File "<template>", line 13 in root
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 1156 in do_template
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 886 in template
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 930 in template
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/playbook/base.py", line 650 in post_validate
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/playbook/task.py", line 285 in post_validate
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 515 in _execute
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 158 in run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/process/worker.py", line 163 in _run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/process/worker.py", line 124 in run
  File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 149 in <lambda>
  File "/Users/tristan/foo/bar/ansible/mitogen/mitogen/core.py", line 647 in _profile_hook
  File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 148 in wrap_worker__run
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 314 in _bootstrap
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 71 in _launch
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 19 in __init__
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 281 in _Popen
  File "/opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 121 in start
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/process/worker.py", line 91 in start
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/plugins/strategy/__init__.py", line 393 in _queue_task
  File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 291 in _queue_task
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/plugins/strategy/linear.py", line 315 in run
  File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 321 in <lambda>
  File "/Users/tristan/foo/bar/ansible/mitogen/mitogen/core.py", line 647 in _profile_hook
  File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 320 in run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/task_queue_manager.py", line 321 in run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/playbook_executor.py", line 190 in run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/cli/playbook.py", line 137 in run
  File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/bin/ansible-playbook", line 128 in <module>

Extension modules: markupsafe._speedups, yaml._yaml, _cffi_backend, charset_normalizer.md (total: 4)
ERROR! A worker was found in a dead state

Your environment

$ python -VV      
Python 3.11.4 (main, Jun  7 2023, 00:34:59) [Clang 14.0.3 (clang-1403.0.22.14.1)]

on macOS 13.4 on arm (M1)

Note that I had the same issue on 3.10.12 and on some version (that I can't recall) of 3.9 before; long meant to report the bug but hadn't yet bothered

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-mactype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions