Python Segmentation Fault
For some reason my python images start to give “Segmentation fault”.
I have used them for a pretty long time, and now it is happening.
Original issue on Github: https://github.com/docker-library/python/issues/211
The Dockerfile
:
FROM python:3.6.2-alpine3.6
LABEL maintainer="sobolevn@wemake.services"
ARG DJANGO_ENV=production
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIPENV_SHELL_COMPAT=true \
PIPENV_COLORBLIND=true \
PIPENV_NOSPIN=true
# System deps:
RUN apk update \
&& apk --no-cache add musl-dev postgresql-dev gcc \
git curl bash build-base gettext linux-headers \
&& mkdir /code
# Creating folders, and files for a project:
WORKDIR /code
ADD . /code
# Project initialization:
RUN pip install pipenv && test "$DJANGO_ENV" == production && pipenv install --system --deploy || pipenv install --dev --system --deploy
ENTRYPOINT ["sh", "/code/docker/django/entrypoint.sh"]
It build fine, than when I start my django app, this line causes a segfault:
from rest_framework import routers
Steps to reproduce
- Copy this template: https://github.com/wemake-services/wemake-django-template
pipenv install django-rest-framework
- Add in to
INSTALLED_APPS
- Add
from rest_framework import routers
tourls.py
- Run
docker-compose up
Created by @sobolevn
(from redmine: issue id 8134, created on 2017-11-12)
- Changesets:
- Revision 2026e125 by Natanael Copa on 2017-11-14T17:05:56Z:
main/python3: increase thread stack size
we segfault before we hit the sys.getrecurslimit(), which is bad. Some
testing showed that to be able to reach the default
sys.getrecurslimit(), which is 1000, we need at least a 453k stack on
x86_64. We set it to 1MB so we have a bit extra.
It is also worth to note that upstream set stacksize to 4MB on freebsd
and 5MB on OSX.
ref #8134
https://github.com/docker-library/python/issues/211