You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module: be less strange about extension key lifetimes
We just got a CI failure:
2025-01-12T16:37:45.5888665Z Fatal Python error: Segmentation fault
2025-01-12T16:37:45.5889018Z
2025-01-12T16:37:45.5889270Z Thread 0x00007f3e0ae006c0 (most recent call first):
2025-01-12T16:37:45.5890898Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 534 in read
2025-01-12T16:37:45.5893372Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 567 in from_io
2025-01-12T16:37:45.5895355Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 1160 in _thread_receiver
2025-01-12T16:37:45.5897310Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 341 in run
2025-01-12T16:37:45.5899179Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 411 in _perform_spawn
2025-01-12T16:37:45.5900143Z
2025-01-12T16:37:45.5900589Z Current thread 0x00007f3e0c3dfb80 (most recent call first):
2025-01-12T16:37:45.5901534Z File "/home/runner/work/xcffib/xcffib/xcffib/__init__.py", line 554 in _setup_extensions
2025-01-12T16:37:45.5902549Z File "/home/runner/work/xcffib/xcffib/xcffib/__init__.py", line 546 in _init_x
2025-01-12T16:37:45.5903523Z File "/home/runner/work/xcffib/xcffib/xcffib/__init__.py", line 533 in __init__
2025-01-12T16:37:45.5904555Z File "/home/runner/work/xcffib/xcffib/xcffib/testing.py", line 133 in _connect_to_xvfb
2025-01-12T16:37:45.5905560Z File "/home/runner/work/xcffib/xcffib/xcffib/testing.py", line 83 in setUp
2025-01-12T16:37:45.5906470Z File "/home/runner/work/xcffib/xcffib/test/conftest.py", line 39 in setUp
2025-01-12T16:37:45.5907373Z File "/home/runner/work/xcffib/xcffib/xcffib/testing.py", line 116 in __enter__
2025-01-12T16:37:45.5908315Z File "/home/runner/work/xcffib/xcffib/test/conftest.py", line 25 in xcffib_test
2025-01-12T16:37:45.5909756Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/fixtures.py", line 891 in call_fixture_func
2025-01-12T16:37:45.5911860Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/fixtures.py", line 1140 in pytest_fixture_setup
2025-01-12T16:37:45.5913712Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
2025-01-12T16:37:45.5915445Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
2025-01-12T16:37:45.5916992Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
2025-01-12T16:37:45.5918405Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/fixtures.py", line 1091 in execute
2025-01-12T16:37:45.5919707Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/fixtures.py", line 617 in _get_active_fixturedef
2025-01-12T16:37:45.5921851Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/fixtures.py", line 532 in getfixturevalue
2025-01-12T16:37:45.5923730Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/fixtures.py", line 697 in _fillfixtures
2025-01-12T16:37:45.5925572Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/python.py", line 1630 in setup
2025-01-12T16:37:45.5927343Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 514 in setup
2025-01-12T16:37:45.5929435Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 160 in pytest_runtest_setup
2025-01-12T16:37:45.5931936Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
2025-01-12T16:37:45.5933720Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
2025-01-12T16:37:45.5935753Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
2025-01-12T16:37:45.5937515Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 242 in <lambda>
2025-01-12T16:37:45.5939298Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 341 in from_call
2025-01-12T16:37:45.5941233Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 241 in call_and_report
2025-01-12T16:37:45.5943079Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 126 in runtestprotocol
2025-01-12T16:37:45.5944982Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/runner.py", line 113 in pytest_runtest_protocol
2025-01-12T16:37:45.5946847Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
2025-01-12T16:37:45.5948594Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
2025-01-12T16:37:45.5950400Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
2025-01-12T16:37:45.5952062Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/xdist/remote.py", line 195 in run_one_test
2025-01-12T16:37:45.5953854Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/xdist/remote.py", line 174 in pytest_runtestloop
2025-01-12T16:37:45.5955648Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
2025-01-12T16:37:45.5957196Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
2025-01-12T16:37:45.5958246Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
2025-01-12T16:37:45.5959947Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/main.py", line 337 in _main
2025-01-12T16:37:45.5961876Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/main.py", line 283 in wrap_session
2025-01-12T16:37:45.5963765Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/_pytest/main.py", line 330 in pytest_cmdline_main
2025-01-12T16:37:45.5965619Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
2025-01-12T16:37:45.5967366Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
2025-01-12T16:37:45.5969132Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
2025-01-12T16:37:45.5971008Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/xdist/remote.py", line 393 in <module>
2025-01-12T16:37:45.5972833Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 1291 in executetask
2025-01-12T16:37:45.5974827Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 341 in run
2025-01-12T16:37:45.5976255Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 411 in _perform_spawn
2025-01-12T16:37:45.5977369Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 389 in integrate_as_primary_thread
2025-01-12T16:37:45.5978630Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 1273 in serve
2025-01-12T16:37:45.5979632Z File "/home/runner/work/xcffib/xcffib/xcffib-test-abi.teoYalBIO9/lib/python3.10/site-packages/execnet/gateway_base.py", line 1806 in serve
2025-01-12T16:37:45.5980450Z File "<string>", line 8 in <module>
2025-01-12T16:37:45.5980812Z File "<string>", line 1 in <module>
https://github.com/tych0/xcffib/actions/runs/12735265435/job/35493822666
which represents *another* race that has probably been around forever that
we are only now finding.
I'm not exactly sure what is going on here, but it seems likely that some
CFFI lifetime thing has gone awry, and the memory was re-used and caused
some kind of seg fault.
But we don't need all the fancy cffi lifetime gunk here: we have a 1:1
mapping for an owner of the xcb_extension_t: the xcffib.ExtensionKey
object. So let's stash the key there as a one-time allocation when the
extension object is created at module import. This way the object will be
pinned, and we hopefully won't get any of these strange seg faults.
Signed-off-by: Tycho Andersen <[email protected]>
0 commit comments