Segfault with ubuntu 20.04
peter-quix opened this issue · comments
Tell us about the bug
On ubuntu 20.04 with the latest python3 (3.8.10) installed, when an exception is set via the python C API in the c# codebase, segfault occurs.
Example code to produce segfault:
from quixstreams import QuixStreamingClient
client = QuixStreamingClient("some-invalid-token") # this will throw an exception using python C API in c#, but segfaults
What did you expect to see?
No Segfault, instead a python exception thrown about invalid token.
Screenshots
If applicable, add screenshots to help explain your problem.
What tools and platforms are you using (e.g. iOS, Chrome, Desktop)
Ubuntu 20.04 (such as windows WSL, google collab)
Anything else we should know?
Works fine in other distributions or when python is compiled from source.
An example docker image where the issue can be reproduced:
FROM ubuntu:focal-20230301
ENV DEBIAN_FRONTEND="noninteractive"
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
RUN apt-get update && \
apt-get install -y curl build-essential checkinstall && \
apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
RUN apt-get install -y python3-dev
RUN python3 -m pip install quixstreams==0.5.0
One where it works:
FROM ubuntu:focal-20230301
ARG PYVER=3.8.10
ENV DEBIAN_FRONTEND="noninteractive"
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
RUN apt-get update && \
apt-get install -y curl build-essential checkinstall && \
apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
WORKDIR python
RUN curl https://www.python.org/ftp/python/$PYVER/Python-$PYVER.tgz --output python-$PYVER.tgz
RUN tar xzf python-$PYVER.tgz
WORKDIR /python/Python-$PYVER
RUN ./configure --enable-optimizations --enable-shared
RUN make install
RUN echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" > ~/.bashrc
RUN . ~/.bashrc && python3 -m pip install quixstreams==0.5.0