Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ffi.def_extern() was not called in the current subinterpreter #3282

Closed
djc opened this issue Nov 24, 2016 · 13 comments
Closed

@ffi.def_extern() was not called in the current subinterpreter #3282

djc opened this issue Nov 24, 2016 · 13 comments

Comments

@djc
Copy link
Contributor

djc commented Nov 24, 2016

I'm not sure this is a problem in cryptography, but I think it might be related.

Over the past few days, I've had problems with my Apache 2.4.23 server, where it failed to correctly serve HTML files from disk over HTTPS. Restarting it solves the problem temporarily.

This Apache installation makes use of mod_wsgi (with Python 2.7.10) to run a number of WSGI applications, some of which use cryptography. In the Apache error logs, I found a lot of messages like this:

extern "Python": function Cryptography_rand_bytes() called, but @ffi.def_extern() was not called in the current subinterpreter.  Returning 0.
extern "Python": function Cryptography_rand_status() called, but @ffi.def_extern() was not called in the current subinterpreter.  Returning 0.

I somewhat recently upgraded from cryptography 1.3.4 to 1.5.2, so this might be related.

Any suggestions on what might be wrong here?

@reaperhulk
Copy link
Member

reaperhulk commented Nov 24, 2016

Yep this is a cryptography issue. It will be resolved when we merge #3229 (which will happen hopefully soon-ish and release as part of 1.7 in 2-3 weeks).

You can stop the error msg by using a single global instance in mod_wsgi rather than subinterpreters by setting WSGIApplicationGroup to %{GLOBAL}, but that may not be practical for your situation.

@reaperhulk
Copy link
Member

(Resolved by 1.7)

@akostadinov
Copy link

Is this in a released version or still only in HEAD?

@reaperhulk
Copy link
Member

It's in 1.7+, which was released last month.

@krogsbell
Copy link

But I still get the annoying error:
extern "Python": function Cryptography_rand_status() called, but @ffi.def_extern() was not called in the current subinterpreter. Returning 0.

Running Ubuntu 16.04 LTS, Kodi 17.0 - but the error was with Kodi 16.1 as well

@tiran
Copy link
Contributor

tiran commented Feb 13, 2017

@krogsbell You are not running cryptography 1.7. Either your system or Kodi use an old version of cryptography.

@krogsbell
Copy link

Right I was running 1.2.3

With these two commands:

sudo pip install --upgrade pip
sudo pip install cryptography --upgrade

I get:
Successfully installed appdirs-1.4.0 cffi-1.9.1 cryptography-1.7.2 enum34-1.1.6 idna-2.2 ipaddress-1.0.18 packaging-16.8 pyasn1-0.2.2 pycparser-2.17 pyparsing-2.1.10 setuptools-34.2.0

But testing with:
apt-cache policy python-cryptography python-openssl

I still get:
python-cryptography:
Installed: 1.2.3-1ubuntu0.1
Candidate: 1.2.3-1ubuntu0.1

Will a reboot solve this?

@krogsbell
Copy link

Removing python 2.7 - No good idea - Kodi do not run without ;-(

@Deus-Rex
Copy link

Also experiencing this problem with Kodi while not having 1.7 available. Is there any solution to upgrading the package on Ubuntu 16.10?

@zordtk
Copy link

zordtk commented Feb 21, 2017

You can install the package from Ubuntu Zesty https://launchpad.net/ubuntu/zesty/amd64/python-cryptography/1.7.1-2 no conflicts and seems to work just fine

@EzeLamar
Copy link

Work for me update cryptography!
sudo pip install cryptography --upgrade

@supremesyntax
Copy link

supremesyntax commented Apr 9, 2018

installed kodi from ppa in ubuntu 16.04.4 and got the above error.

sudo apt install python-pip
pip install --upgrade pip
pip install cryptography --upgrade

did the job for me

EDIT:
little off topic but in case someone gets here because of kodi:
to get the youtube addon running do:
pip install --upgrade pyopenssl

@zicmama
Copy link

zicmama commented Sep 17, 2018

I run in all this problems and solutions...
I had to launch
sudo apt install --reinstall python-openssl
to correct
Error Contents: 'module' object has no attribute 'SSL_ST_INIT'

Knowledge sharing is wonderful

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

10 participants