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
Python 3.9.10 (main, Mar 1 2022, 21:02:54)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.get('https://serpapi.com', {"api_key":VALID_API_KEY, "engine": "google_jobs", "q": "Barista"})
Fatal Python error: Segmentation fault
Current thread 0x0000ffff8e999010 (most recent call first):
File "/usr/local/lib/python3.9/ssl.py", line 1173 in send
File "/usr/local/lib/python3.9/ssl.py", line 1204 in sendall
File "/usr/local/lib/python3.9/http/client.py", line 1001 in send
File "/usr/local/lib/python3.9/http/client.py", line 1040 in _send_output
File "/usr/local/lib/python3.9/http/client.py", line 1280 in endheaders
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 395 in request
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 496 in _make_request
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790 in urlopen
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 486 in send
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 703 in send
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 589 in request
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59 in request
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 73 in get
File "<stdin>", line 1 in <module>
Segmentation fault
This is not specific to one engine, it also applies to google_images if I swap the engine.
Dockerfile:
FROM python:3.9.10-slim-buster
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
# OLD: RUN apt-get update && apt-get upgrade -y && apt-get install gcc -y && apt-get install apt-utils -y
# Install build-essential for celery worker otherwise it says gcc not found
RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Additional dependencies
&& apt-get install -y telnet netcat \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY ./compose/local/flask/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
# COPY ./compose/local/flask/celery/worker/start /start-celeryworker
# RUN sed -i 's/\r$//g' /start-celeryworker
# RUN chmod +x /start-celeryworker
# COPY ./compose/local/flask/celery/beat/start /start-celerybeat
# RUN sed -i 's/\r$//g' /start-celerybeat
# RUN chmod +x /start-celerybeat
# COPY ./compose/local/flask/celery/flower/start /start-flower
# RUN sed -i 's/\r$//g' /start-flower
# RUN chmod +x /start-flower
COPY . .
# COPY entrypoint.sh /usr/local/bin/
# ENTRYPOINT ["entrypoint.sh"]
The above trace came from bashing into my docker instance and running requests.get after importing it like so:
docker exec -it flask_app bash
The host machine runs this fine, but uses LibreSSL 2.8.3 / Python 3.8.16 - based on other tickets/issues here it seems like there's possibly something on the SSL side of the backend that's triggering this - would appreciate some insight
Actually I re-read the requirements and the minimum version for serpapi is Python 3.7, downgraded to Python 3.7.17 and it seems to work (had to also pin importlib-metadata==4.13.0 for celery but that's a separate story) so it's probably the openssl version between Python 3.7 and Python 3.8 which if the minimum becomes Python 3.8 and this is verified, might potentially need to be addressed unless I overlooked something.
medero
changed the title
Fatal Python error: Segmentation fault when calling requests.get(URL, params) with docker python-3.8.2-slim-buster/openssl 1.1.1d and python-3.9.10-slim-buster/openssl 1.1.1d
Python 3.8+, Fatal Python error: Segmentation fault when calling requests.get(URL, params) with docker python-3.8.2-slim-buster/openssl 1.1.1d and python-3.9.10-slim-buster/openssl 1.1.1d
Nov 25, 2023
Here's the trace:
This is not specific to one engine, it also applies to google_images if I swap the engine.
Dockerfile:
docker-compose.yml:
And requirements.txt though I didn't update requirements.txt after trying 3.9.10 from the original 3.8.2:
The above trace came from bashing into my docker instance and running requests.get after importing it like so:
docker exec -it flask_app bash
The host machine runs this fine, but uses LibreSSL 2.8.3 / Python 3.8.16 - based on other tickets/issues here it seems like there's possibly something on the SSL side of the backend that's triggering this - would appreciate some insight
Someone ran into this on SO and the selected answer was updating the timeout: https://stackoverflow.com/questions/74774784/cheerypy-server-is-timing-out but no guarantee this is the same issue, just a reference.
The text was updated successfully, but these errors were encountered: