piwheels / packages

Issue tracker for piwheels package issues
https://github.com/piwheels/packages/issues
20 stars 5 forks source link

bcrypt 4.0.0 and 4.0.1 give "Illegal instruction" on Rasp Pi Zero #406

Closed mas94uk closed 8 months ago

mas94uk commented 8 months ago

Package name

bcrypt

Package version

4.0.0, 4.0.1

PyPI URL

https://pypi.org/project/bcrypt/

piwheels URL

https://www.piwheels.org/project/bcrypt/

Python version

I am aware this is the issue tracker for a Python package index specifically for Raspberry Pi

I have checked for duplicate issues

I am the maintainer

More information

Pi Zero has Raspian Buster, Python 3.7.3. uname -m gives armv6l so 32bit.

To reproduce:

$ python3 -m venv test
$ source test/bin/activate
(test) $ python3 -m pip install bcrypt==4.0.1
(test) $ python3
>>> import bcrypt
Illegal instruction

Problem happens with bcrypt 4.0.1 and 4.0.0, but does not happen with 3.2.2.

Full log (running with python3 -v):

>>> import bcrypt
# /home/user/Scratch/bcrypt_bug/test/lib/python3.7/site-packages/bcrypt/__pycache__/__init__.cpython-37.pyc matches /home/user/Scratch/bcrypt_bug/test/lib/python3.7/site-packages/bcrypt/__init__.py
# code object from '/home/user/Scratch/bcrypt_bug/test/lib/python3.7/site-packages/bcrypt/__pycache__/__init__.cpython-37.pyc'
# /usr/lib/python3.7/__pycache__/__future__.cpython-37.pyc matches /usr/lib/python3.7/__future__.py
# code object from '/usr/lib/python3.7/__pycache__/__future__.cpython-37.pyc'
import '__future__' # <_frozen_importlib_external.SourceFileLoader object at 0xb6664e50>
# /usr/lib/python3.7/__pycache__/hmac.cpython-37.pyc matches /usr/lib/python3.7/hmac.py
# code object from '/usr/lib/python3.7/__pycache__/hmac.cpython-37.pyc'
# /usr/lib/python3.7/__pycache__/warnings.cpython-37.pyc matches /usr/lib/python3.7/warnings.py
# code object from '/usr/lib/python3.7/__pycache__/warnings.cpython-37.pyc'
import 'warnings' # <_frozen_importlib_external.SourceFileLoader object at 0xb6676750>
import '_operator' # <class '_frozen_importlib.BuiltinImporter'>
# extension module '_hashlib' loaded from '/usr/lib/python3.7/lib-dynload/_hashlib.cpython-37m-arm-linux-gnueabihf.so'
# extension module '_hashlib' executed from '/usr/lib/python3.7/lib-dynload/_hashlib.cpython-37m-arm-linux-gnueabihf.so'
import '_hashlib' # <_frozen_importlib_external.ExtensionFileLoader object at 0xb656d250>
# /usr/lib/python3.7/__pycache__/hashlib.cpython-37.pyc matches /usr/lib/python3.7/hashlib.py
# code object from '/usr/lib/python3.7/__pycache__/hashlib.cpython-37.pyc'
import '_blake2' # <class '_frozen_importlib.BuiltinImporter'>
import '_sha3' # <class '_frozen_importlib.BuiltinImporter'>
import 'hashlib' # <_frozen_importlib_external.SourceFileLoader object at 0xb656d4d0>
import 'hmac' # <_frozen_importlib_external.SourceFileLoader object at 0xb6676150>
# /home/user/Scratch/bcrypt_bug/test/lib/python3.7/site-packages/bcrypt/__pycache__/__about__.cpython-37.pyc matches /home/user/Scratch/bcrypt_bug/test/lib/python3.7/site-packages/bcrypt/__about__.py
# code object from '/home/user/Scratch/bcrypt_bug/test/lib/python3.7/site-packages/bcrypt/__pycache__/__about__.cpython-37.pyc'
import 'bcrypt.__about__' # <_frozen_importlib_external.SourceFileLoader object at 0xb656d7b0>
Illegal instruction

Backtrace from gdb:

Program received signal SIGILL, Illegal instruction.
0xb636b120 in pyo3::gil::ReferencePool::update_counts () from /home/user/Scratch/bcrypt_bug/test2/lib/python3.7/site-packages/bcrypt/_bcrypt.abi3.so
(gdb) bt
#0  0xb636b120 in pyo3::gil::ReferencePool::update_counts () from /home/user/Scratch/bcrypt_bug/test2/lib/python3.7/site-packages/bcrypt/_bcrypt.abi3.so
#1  0xb63578a0 in PyInit__bcrypt () from /home/user/Scratch/bcrypt_bug/test2/lib/python3.7/site-packages/bcrypt/_bcrypt.abi3.so
#2  0x0023ae74 in _PyImport_LoadDynamicModuleWithSpec ()
#3  0x0023b3d4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

So I removed the piwheels line from /etc/pip.conf, so that pip install bcrypt would compile it locally. (This required installing a newer rustc than the distro had.) The resulting build works -- in that I can import bcrypt without a crash.

(I originally raised this issue on bcrypt .)

bennuttall commented 8 months ago

I've deleted the builds - hopefully a rebuild will fix it. It'll take a while to get through all those builds but I'll keep an eye on it and will shout when it's ready.

mas94uk commented 8 months ago

I've just checked and it seems to be OK now -- thanks!