Opened 14 months ago

Last modified 14 months ago

#67046 assigned defect

Python is broken on Leopard: KeyError: '0 is not registered', OSError: [Errno 22] Invalid argument when trying to run some dependents, related failures in tests

Reported by: barracuda156 Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: powerpc, leopard Cc: jmroot (Joshua Root)
Port: python310

Description (last modified by barracuda156)

UPD. As it is seen from tests, Python itself is broken.

Example is with trying to run ptpython, however the error is not in it, since another port, radian, also depending on py-prompt_toolkit, fails identically.

Last login: Mon Mar  6 04:05:32 on ttys000
36-137:~ svacchanda$ ptpython
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/selector_events.py", line 256, in _add_reader
    key = self._selector.get_key(fd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/selectors.py", line 193, in get_key
    raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '0 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ptpython/repl.py", line 135, in run
    text = self.read()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ptpython/python_input.py", line 1045, in read
    result = self.app.run(pre_run=pre_run, in_thread=True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 961, in run
    raise exception
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 939, in run_in_thread
    result = self.run(
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 978, in run
    return loop.run_until_complete(
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 885, in run_async
    return await _run_async(f)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 737, in _run_async
    with self.input.raw_mode(), self.input.attach(
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prompt_toolkit/input/vt100.py", line 176, in _attached_input
    loop.add_reader(fd, callback_wrapper)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/selector_events.py", line 331, in add_reader
    self._add_reader(fd, callback, *args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/selector_events.py", line 258, in _add_reader
    self._selector.register(fd, selectors.EVENT_READ,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/selectors.py", line 523, in register
    self._selector.control([kev], 0, 0)
OSError: [Errno 45] Operation not supported
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/selector_events.py", line 256, in _add_reader
    key = self._selector.get_key(fd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/selectors.py", line 193, in get_key
    raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '0 is not registered'

This repeats in a loop then. Initially I faced the error on 10.6, however it is now confirmed on 10.5.8, so I can open a legitimate ticket.

Attachments (1)

python310_tests_leopard.txt (904.5 KB) - added by barracuda156 14 months ago.
Log from 10.5.8 with tests

Download all attachments as: .zip

Change History (10)

comment:1 Changed 14 months ago by xeron (Ivan Larionov)

I don't have access to neither 10.5 nor 10.6. Using 11.7.4 I can't reproduce the issue.

comment:2 in reply to:  1 Changed 14 months ago by barracuda156

Replying to xeron:

I don't have access to neither 10.5 nor 10.6. Using 11.7.4 I can't reproduce the issue.

Already on 10.6.8 the error does not occur. It is specific either to PPC or to pre-10.6-release macOS (that is, standard case is 10.5.8).

comment:3 Changed 14 months ago by barracuda156

Tests for prompt_toolkit pass on Leopard PPC (and on SL PPC likewise):

--->  Testing py310-prompt_toolkit
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-prompt_toolkit/py310-prompt_toolkit/work/prompt_toolkit-3.0.33" && py.test-3.10 -o addopts='' 
============================= test session starts ==============================
platform darwin -- Python 3.10.10, pytest-7.2.1, pluggy-1.0.0
rootdir: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-prompt_toolkit/py310-prompt_toolkit/work/prompt_toolkit-3.0.33
collected 145 items

tests/test_async_generator.py .                                          [  0%]
tests/test_buffer.py .........                                           [  6%]
tests/test_cli.py ..................................                     [ 30%]
tests/test_completion.py ..................                              [ 42%]
tests/test_document.py ...........                                       [ 50%]
tests/test_filter.py ......                                              [ 54%]
tests/test_formatted_text.py .............                               [ 63%]
tests/test_history.py ....                                               [ 66%]
tests/test_inputstream.py ...........                                    [ 73%]
tests/test_key_binding.py ......                                         [ 77%]
tests/test_layout.py ..                                                  [ 79%]
tests/test_print_formatted_text.py ....                                  [ 82%]
tests/test_regular_languages.py ....                                     [ 84%]
tests/test_shortcuts.py ..                                               [ 86%]
tests/test_style.py .....                                                [ 89%]
tests/test_style_transformation.py .                                     [ 90%]
tests/test_utils.py .                                                    [ 91%]
tests/test_vt100_output.py .                                             [ 91%]
tests/test_widgets.py ..                                                 [ 93%]
tests/test_yank_nth_arg.py ..........                                    [100%]

======================= 145 passed in 110.04s (0:01:50) ========================

Might be bug in Python itself.

Last edited 14 months ago by barracuda156 (previous) (diff)

comment:4 Changed 14 months ago by barracuda156

It is for sure Python itself:

Process SyncManager-83:
Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/managers.py", line 591, in _run_server
    server = cls._Server(registry, address, authkey, serializer)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/managers.py", line 156, in __init__
    self.listener = Listener(address=address, backlog=16)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/connection.py", line 448, in __init__
    self._listener = SocketListener(address, family, backlog)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/connection.py", line 591, in __init__
    self._socket.bind(address)
OSError: AF_UNIX path too long
Warning -- reap_children() reaped child process 17098
Process SyncManager-275:
Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/managers.py", line 591, in _run_server
    server = cls._Server(registry, address, authkey, serializer)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/managers.py", line 156, in __init__
    self.listener = Listener(address=address, backlog=16)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/connection.py", line 448, in __init__
    self._listener = SocketListener(address, family, backlog)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/connection.py", line 591, in __init__
    self._socket.bind(address)
OSError: AF_UNIX path too long
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 3 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/util.py", line 300, in _run_finalizers
    finalizer()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/util.py", line 224, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/synchronize.py", line 87, in _cleanup
    sem_unlink(name)
OSError: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/util.py", line 300, in _run_finalizers
    finalizer()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/util.py", line 224, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/synchronize.py", line 87, in _cleanup
    sem_unlink(name)
OSError: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/util.py", line 300, in _run_finalizers
    finalizer()
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/util.py", line 224, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python310/python310/work/Python-3.10.10/Lib/multiprocessing/synchronize.py", line 87, in _cleanup
    sem_unlink(name)
OSError: [Errno 22] Invalid argument
Warning -- multiprocessing.process._dangling was modified by test_concurrent_futures
  Before: set()
  After:  {<weakref at 0x25024d8; to 'ForkProcess' at 0x236e898>} 
test test_concurrent_futures failed -- multiple errors occurred; run in verbose mode for details

comment:5 Changed 14 months ago by barracuda156

Keywords: powerpc leopard added
Port: python310 added
Summary: Either python or py-prompt_toolkit is broken on Leopard: KeyError: '0 is not registered' when trying to run dependentsPython is broken on Leopard: KeyError: '0 is not registered', OSError: [Errno 22] Invalid argument when trying to run some dependents, related failures in tests

Changed 14 months ago by barracuda156

Attachment: python310_tests_leopard.txt added

Log from 10.5.8 with tests

comment:6 Changed 14 months ago by barracuda156

Description: modified (diff)
Owner: changed from xeron to jmroot

comment:7 Changed 14 months ago by barracuda156

Could someone help with this issue, please?

comment:8 Changed 14 months ago by jmroot (Joshua Root)

No, I don't think I can help you much with this. But I don't know why you think test failures in multiprocessing are related to an error in selectors. The selectors tests passed for you:

:info:test 0:06:03 load avg: 5.23 [312/425/15] test_selectors passed

comment:9 in reply to:  8 Changed 14 months ago by barracuda156

Replying to jmroot:

No, I don't think I can help you much with this. But I don't know why you think test failures in multiprocessing are related to an error in selectors. The selectors tests passed for you:

:info:test 0:06:03 load avg: 5.23 [312/425/15] test_selectors passed

Basically ptpython fails with those errors when been ran, I don’t know the reason for those.

Note: See TracTickets for help on using tickets.