Bug 1907439

Summary: python-img2pdf fails to build with Python 3.10: Fatal Python error: Segmentation fault
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-pikepdfAssignee: Elliott Sales de Andrade <quantum.analyst>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, mhroncok, python-sig, quantum.analyst, thrnciar, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-09 10:27:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1890881    

Description Tomáš Hrnčiar 2020-12-14 14:16:06 UTC
python-img2pdf fails to build with Python 3.10.0a3.

+ /usr/bin/python3 -m pytest src/img2pdf_test.py -k 'not test_png_icc and not test_tiff_ccitt_nometa2'
Fatal Python error: Segmentation fault

Current thread 0x00007fae2c668740 (most recent call first):
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1125 in create_module
  File "<frozen importlib._bootstrap>", line 581 in module_from_spec
  File "<frozen importlib._bootstrap>", line 684 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1005 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1026 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1077 in _handle_fromlist
  File "/usr/lib64/python3.10/site-packages/pikepdf/__init__.py", line 15 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 832 in exec_module
  File "<frozen importlib._bootstrap>", line 698 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1005 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1026 in _find_and_load
  File "/builddir/build/BUILD/img2pdf-0.4.0/src/img2pdf_test.py", line 10 in <module>
  File "/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 170 in exec_module
  File "<frozen importlib._bootstrap>", line 698 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1005 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1026 in _find_and_load
  File "<frozen importlib._bootstrap>", line 1049 in _gcd_import
  File "/usr/lib64/python3.10/importlib/__init__.py", line 126 in import_module
  File "/usr/lib/python3.10/site-packages/_pytest/pathlib.py", line 520 in import_path
  File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 552 in _importtestmodule
  File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 484 in _getobj
  File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 288 in obj
  File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 500 in _inject_setup_module_fixture
  File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 487 in collect
  File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 324 in <lambda>
  File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 294 in from_call
  File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 324 in pytest_make_collect_report
  File "/usr/lib/python3.10/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.10/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/usr/lib/python3.10/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.10/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 441 in collect_one_node
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 768 in genitems
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 568 in _perform_collect
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 516 in perform_collect
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 306 in pytest_collection
  File "/usr/lib/python3.10/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.10/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/usr/lib/python3.10/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.10/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 295 in _main
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 240 in wrap_session
  File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 289 in pytest_cmdline_main
  File "/usr/lib/python3.10/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/usr/lib/python3.10/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/usr/lib/python3.10/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/usr/lib/python3.10/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/usr/lib/python3.10/site-packages/_pytest/config/__init__.py", line 157 in main
  File "/usr/lib/python3.10/site-packages/_pytest/config/__init__.py", line 180 in console_main
  File "/usr/lib/python3.10/site-packages/pytest/__main__.py", line 7 in <module>
  File "/usr/lib64/python3.10/runpy.py", line 87 in _run_code
  File "/usr/lib64/python3.10/runpy.py", line 197 in _run_module_as_main
/var/tmp/rpm-tmp.SEJA9P: line 41: 11383 Segmentation fault      (core dumped) PYTHONPATH=src /usr/bin/python3 -m pytest src/img2pdf_test.py -k 'not test_png_icc and not test_tiff_ccitt_nometa2'

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01826928-python-img2pdf/

For all our attempts to build python-img2pdf with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-img2pdf/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Georg Sauthoff 2020-12-14 16:22:43 UTC
Since the segfault occurs during import of pikepdf (at what time img2pdf_test.py only has imported pretty standard python packages) the root cause of this issue seems to lie outside of img2pdf:


+ /usr/bin/python3 -m pytest src/img2pdf_test.py -k 'not test_png_icc and not test_tiff_ccitt_nometa2'
Fatal Python error: Segmentation fault
Current thread 0x00007fae2c668740 (most recent call first):
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1125 in create_module
  File "<frozen importlib._bootstrap>", line 581 in module_from_spec
  File "<frozen importlib._bootstrap>", line 684 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1005 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1026 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1077 in _handle_fromlist
  File "/usr/lib64/python3.10/site-packages/pikepdf/__init__.py", line 15 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 832 in exec_module
  File "<frozen importlib._bootstrap>", line 698 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1005 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1026 in _find_and_load
  File "/builddir/build/BUILD/img2pdf-0.4.0/src/img2pdf_test.py", line 10 in <module>


That means either there is an issue in the pikepdf module initialization or there is a bug in the general python import code.


So what about re-assigning this issue then?

Comment 2 Georg Sauthoff 2021-01-03 17:47:02 UTC
Elliot, can you take a look here regarding pikepdf?

Comment 3 Elliott Sales de Andrade 2021-01-09 00:56:01 UTC
I'm not sure how it could be pikepdf itself. It seems more likely to be something about the Python/C++ interface from pybind11. Can you get a backtrace?

Comment 4 Miro Hrončok 2021-01-09 10:27:12 UTC
I see succesful builds in https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-img2pdf/ -- let's assume this was a transient issue. Sorry for the noise.