docker-library / pypy

Docker Official Image packaging for pypy
http://pypy.org/
MIT License
69 stars 46 forks source link

Incompatibility introduced in 7.3.1 #46

Closed JCavallo closed 2 years ago

JCavallo commented 3 years ago

I previoulsy worked with an unofficial alpine image (Pypy 7.3.0) to package a uwsgi application, and decided to switch to the official (Pypy 7.3.1) image.

I had a problem when switching because of https://github.com/docker-library/pypy/commit/61bb08218bb796dc8aece3328f66a39ffaeda394 which changes the location of all files inside the image.

Updating the uwsgi configuration to the new paths did not help.

It may be a problem inside uwsgi (especially since pypy3 support is rather fragile), however it could also be a regression so I wanted to report here.

The only information I got about the problem looks like this (stracing the uwsgi process):

stat("/opt/pypy//lib_pypy", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/opt/pypy/lib_pypy/x", 0x55b239982120) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/pypy/lib_pypy/pyvenv.cfg", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/pypy/lib_pypy/python36.zip", 0x55b239982120) = -1 ENOENT (No such file or directory)
stat("/opt/pypy/lib_pypy/lib-python/3", 0x55b239982120) = -1 ENOENT (No such file or directory)
lstat("/opt/pypy/lib_pypy", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/opt/pypy/pyvenv.cfg", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/pypy/python36.zip", 0x55b239982120) = -1 ENOENT (No such file or directory)
stat("/opt/pypy/lib-python/3", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/opt/pypy/lib_pypy", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(2, "debug: OperationError:\n", 23debug: OperationError:
) = 23
write(2, "debug:  operror-type: ModuleNotF"..., 42debug:  operror-type: ModuleNotFoundError
) = 42
write(2, "debug:  operror-value: No module"..., 44debug:  operror-value: No module named 'os'
) = 44
write(2, "unable to set pypy home to \"/opt"..., 40unable to set pypy home to "/opt/pypy/"
) = 40
getpid()                                = 1041
exit_group(1)                           = ?
+++ exited with 1 +++

Do not hesitate to close this if irrelevant.

wglambert commented 3 years ago

Do you still encounter the issue using the version before the change pypy:3.6-7.3.0?

JCavallo commented 3 years ago

@wglambert No, using the official 7.3.0 version works as intended. That's why I reported the issue as related specifically to version 7.3.1

Sorry I wasn't clear enough

tianon commented 3 years ago

Sorry for the delay here -- is there a really minimal example we can use to reproduce? I'm unfortunately not very familiar with uwsgi. :innocent:

JCavallo commented 3 years ago

No problem.

I reproduced by running the following commands inside a 3.6-7.3.0 container:

root@0787c616e556:/# pip install uwsgi
root@0787c616e556:/# uwsgi -T --http-socket :8000 --pypy-home /opt/pypy/bin/pypy3 --pypy-lib /opt/pypy/bin/libpypy3-c.so

This causes the error above:

unable to set pypy home to "/opt/pypy/bin/pypy3"

tianon commented 3 years ago

Ah, interesting. Looking at https://uwsgi-docs.readthedocs.io/en/latest/PyPy.html, I think --pypy-home should just be set to /opt/pypy?

Here's the results of my slightly adjusted test:

$ docker pull pypy:3
3: Pulling from library/pypy
Digest: sha256:df5733286236667bba1d312da7166afd99285c4279947c92ae12df6f864fa576
Status: Image is up to date for pypy:3
docker.io/library/pypy:3

$ docker run -it --rm pypy:3 bash
root@cce564c459d6:/# pip install uwsgi
Collecting uwsgi
  Downloading uWSGI-2.0.19.1.tar.gz (803 kB)
     |████████████████████████████████| 803 kB 7.3 MB/s 
Building wheels for collected packages: uwsgi
  Building wheel for uwsgi (setup.py) ... done
  Created wheel for uwsgi: filename=uWSGI-2.0.19.1-pp36-pypy36_pp73-linux_x86_64.whl size=519300 sha256=44f9ee3c32cd4a9e0e8efb61f04a76c262f4f288b6fea3a0c16d90af2ad468b7
  Stored in directory: /root/.cache/pip/wheels/dc/19/02/f60965a89e11274f20b4538d304410073d294f2f8f2706cf0d
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.19.1
WARNING: You are using pip version 20.2.4; however, version 20.3 is available.
You should consider upgrading via the '/opt/pypy/bin/pypy3 -m pip install --upgrade pip' command.

root@cce564c459d6:/# uwsgi -T --http-socket :9090 --pypy-home /opt/pypy --pypy-lib /opt/pypy/bin/libpypy3-c.so
*** Starting uWSGI 2.0.19.1 (64bit) on [Mon Nov 30 18:21:50 2020] ***
compiled with version: 8.3.0 on 30 November 2020 18:20:21
os: Linux-5.7.0-0.bpo.2-amd64 #1 SMP Debian 5.7.10-1~bpo10+1 (2020-07-30)
nodename: cce564c459d6
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 12
current working directory: /
detected binary path: /opt/pypy/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :9090 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
debug: OperationError:
debug:  operror-type: SyntaxError
debug:  operror-value: ("Missing parentheses in call to 'print'", ('c callback', 332, 15, '        print "PyPy WARNING: unable to load logging.config"\n', 0))
casabre commented 3 years ago

Any news here? I am utilizing a slightly different approach with venv but in the end, I am running into the same issue.

casabre commented 3 years ago
debug:  operror-type: SyntaxError
debug:  operror-value: ("Missing parentheses in call to 'print'", ('c callback', 332, 15, '        print "PyPy WARNING: unable to load logging.config"\n', 0))

Seems that the problem is already fixed on master but not here 2.0.19.1

casabre commented 3 years ago

Raised an issue upstream.

tianon commented 2 years ago

Closing in favor of the (more appropriate) uwsgi discussions. :+1: