Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 6.0.1 produces Segmentation Fault on Python 3.7 and Alpine 3.14 #737

Closed
SerhiyRomanov opened this issue Jul 31, 2023 · 1 comment

Comments

@SerhiyRomanov
Copy link

We use that package together with Flask and run inside Docker container with UWSGI.

I see normal startup in the logs

[uWSGI] getting INI configuration from /app/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Mon Jul 31 14:07:29 2023] ***
compiled with version: 10.3.1 20210424 on 27 July 2023 09:58:29
os: Linux-6.4.4-100.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 19 17:06:05 UTC 2023
nodename: 350561c53409
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /app/src
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
setuid() to 1000
chdir() to /app/src
your memory page size is 4096 bytes
detected max file descriptor number: 1073741816
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to UNIX address /tmp/api.sock fd 3
Python version: 3.7.13 (default, Apr 20 2022, 03:16:50)  [GCC 10.3.1 20210424]
Python main interpreter initialized at 0x7f13399baaa0
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 166688 bytes (162 KB) for 2 cores
*** Operational MODE: threaded ***

which fails with
!!! uWSGI process 12 got Segmentation Fault !!!
once we reach the code which tries to import yaml

We cannot see a detailed backtrace because of that limitation.
Version 6.0 works without problems

@nitzmahone
Copy link
Member

nitzmahone commented Jul 31, 2023

We've never published PyYAML wheels for Alpine, which means the native code extension build that's failing occurred in your environment upon installation. 6.0.1 and 6.0 are literally exactly the same code (there was just a packaging metadata hint added to block usage of the newest incompatible versions of Cython). It's likely something has changed in your environment since your local 6.0 wheel was built (dev tools, headers, libraries, or the way it was installed).

There's not really anything we can do to help you debug that problem, since the same code (6.0) was clearly already working in your environment. Further, AFAICT, Python 3.7 isn't even packaged for Alpine 3.14, so maybe you built your own?

In any case, it appears you may have a number of complexities in your environment that could be breaking things, but I had no trouble just now building PyYAML with the native libyaml extension using the Alpine-3.14 packaged Python 3.9 and passing its full test suite successfully using the following in a vanilla Alpine 3.14 container:

[mdavis@mdavis-p1 ~]$ podman run -it alpine:3.14 ash
/ # apk add git python3-dev yaml-dev musl-dev gcc && \
git clone https://github.com/yaml/pyyaml && \
python3 -m ensurepip && \
PYYAML_FORCE_CYTHON=1 PYYAML_FORCE_LIBYAML=1 python3 -m pip install pyyaml -v && \
cd pyyaml && \
python3 tests/lib/test_all.py

(output elided)

Successfully installed pyyaml-6.0.1

(output elided)

===========================================================================
TESTS: 2609

You should be able to alter what I did there to use the Python 3.7 you've got installed and replicate the same process. If you're unable, I'd suggest maybe trying without the libyaml extension (eg PYYAML_FORCE_CYTHON=0 PYYAML_FORCE_LIBYAML=0 python3 -m pip install --no-cache pyyaml==6.0.1), since build problems there are almost certainly what's causing the segfault.

In any case, I'm going to close this issue, as it's almost certainly an environment-specific configuration problem- hopefully the info provided can help you back to a working installation of PyYAML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants