[Fixed]-Uwsgi segmentation fault when serving a django application

41👍

This error occurs when uwsgi and psycopg are compiled against two different openssl versions.
You have two solution.

  • disable ssl of django database configuration (the other answer’s solution)
  • Install psyocpg2 from source instead of wheel

to install psyocpg2 from source you have to uninstall previous one and try this

pip uninstall psycopg2
pip install --no-binary :all: psycopg2
👤Karoid

2👍

Pyuwsgi can be used instead of building uWSGI from source. It is a wheel, but excludes the SSL plugin so it should workaround the incompatibility.

👤Pete

1👍

The issue is related to the connection to PostgreSQL with uWSGI.

Try to disable SSL if feasible in your

# Database
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'mydb',
        'USER': 'myuser',
        'PASSWORD': 'mypassword',
        'HOST': 'localhost',
        'PORT': '',
        'OPTIONS': {
            'sslmode': 'disable'
        }
    }
}

1👍

I have the same problem. It turns out to be caused by the Python package grpcio (1.34.0). Downgrading to grpcio==1.30.0 solved the problem. This solution is provided by https://github.com/grpc/grpc/issues/23796

Using pipenv (should be the same with pip), my exact commands to fix it were:

$ pipenv uninstall grpcio
$ pipenv   install grpcio==1.30.0

Leave a comment