Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Segmentation fault when running Flask development server in Alpine Linux #1003

Closed
rossgray opened this issue May 17, 2017 · 4 comments
Closed

Comments

@rossgray
Copy link

Hi,

I am getting a segmentation fault when using Raven with the Flask development server on Alpine Linux. Oddly, this issue only appears to occur when I install a recent version of the requests library (>= v2.13.0) (even if I don't import that library in my code). This issue is only specific to Alpine - it works fine on other Python Docker images. The issue occurs on versions of Raven >= 5.4.0.

I think the segmentation fault is related to some imports within the Raven library.
When I change the following lines it fixes the problem:
https://github.com/getsentry/raven-python/blob/master/raven/conf/remote.py#L18-L19

from:

from raven.transport.threaded import ThreadedHTTPTransport
from raven.transport.http import HTTPTransport

to:

from raven.transport import ThreadedHTTPTransport
from raven.transport import HTTPTransport

i.e. remove the submodule, which isn't needed since in transport/__init__.py there is:

from raven.transport.http import *  # NOQA

I have created a test project to reproduce this issue:
https://github.com/ingresso-group/flask-raven-debug

Environment:

  • python:3.6-alpine Docker image
  • Python 3.6.1
  • Flask 0.12
  • Werkzeug 0.12.1
  • Raven 6.0.0
@beaugunderson
Copy link

There are two additional open issues that involve python:3.6-alpine and threading:

I think the root cause for this issue and the other two is the same (and I'm offering a $100 bounty for docker-library/python#211)

@beaugunderson
Copy link

beaugunderson commented Jul 14, 2017

@rossgray based on my research from those other issues I'm confident that this is an issue with musl's smaller default stack size; you can try this workaround or try upgrading to requests>=2.18.1, which does not suffer from the segfault in my experience (but you may still experience it if you use other dependencies, especially ones that include ultrajson).

@beaugunderson
Copy link

@rossgray
Copy link
Author

Thank you @beaugunderson ! I can confirm that upgrading to requests 2.18.1 resolves the issue (at least for now)

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

No branches or pull requests

2 participants