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

operror-type: AssertionError with PyPy plugin on 2.0.4 #628

Closed
btegs opened this issue May 15, 2014 · 13 comments
Closed

operror-type: AssertionError with PyPy plugin on 2.0.4 #628

btegs opened this issue May 15, 2014 · 13 comments

Comments

@btegs
Copy link

btegs commented May 15, 2014

When using uWSGI 2.0.4 standalone and loading the PyPy plugin on Ubuntu 14.04, I get a debug: operror-type: AssertionError when loading any script. I got PyPy 2.2.1 from the repositories via a simple "apt-get install pypy" Here are my steps:

1.) I downloaded from http://projects.unbit.it/downloads/uwsgi-2.0.4.tar.gz, extracted, changed to the uwsgi-2.0.4, and opened up a terminal.

2.) I ran "UWSGI_BIN_NAME=/home/teg/uwsgi_test/uwsgi make PROFILE=nolang" to create a uwsgi executable but not include the default Python. Otherwise I get an issue about loading both Python and PyPy and how it is evil.

3.) While still in the uwsgi-2.0.4 directory in the terminal, I ran "python2.7 uwsgiconfig.py --plugin plugins/pypy" to create a pypy_plugin.so file for which I copied to /home/teg/uwsgi_test/

4.) Changed directories to /home/teg/uwsgi_test/ opened up a terminal, and ran "wget http://projects.unbit.it/downloads/pypy/libpypy-c-x86_64_20130524.so" to get the required file.

5.) Created this .ini file and named conf.ini:
[uwsgi]
plugins = /home/teg/uwsgi_test/pypy
http = :8080
chdir = home/teg/uwsgi_test/
processes = 2
master=true
disable-logging = false
catch-exceptions = false
post-buffering = 8192
vacuum = true
listen = 120
pypy-home = /usr/bin
pypy-lib = /home/teg/uwsgi_test/libpypy-c-x86_64_20130524.so

6.) Created a simple hello.py with this code and put in the /uwsgi_test/ directory:
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return ["Hello World"]

7.) Ran the script via "/home/teg/uwsgi_test/uwsgi --ini conf.ini --pypy-wsgi hello.py" in the terminal.

8.) Got this error:
[uWSGI] getting INI configuration from conf.ini
*** Starting uWSGI 2.0.4 (64bit) on [Thu May 15 13:43:23 2014] ***
compiled with version: 4.8.2 on 15 May 2014 12:05:24
os: Linux-3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014
nodename: ubuntu1
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /home/teg/uwsgi_test
detected binary path: /home/teg/uwsgi_test/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 126913
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8080 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:38360 (port auto-assigned) fd 3
debug: OperationError:
debug: operror-type: AssertionError
debug: operror-value:

Is this a common error that many of you are of or is it a configuration issue? It only seems to affect PyPy and not standard Python when following the docs. There is also someone else with this issue at https://serverfault.com/questions/592413

@btegs
Copy link
Author

btegs commented May 15, 2014

I also tried changing the pypy-home to /usr/lib/pypy and got the same issue.

As an extra test, I downloaded https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-2.2.1-linux_x86_64-portable.tar.bz2 and had the pypy-home reference "/pypy-2.2.1-linux_x86_64-portable/" in that directory. Same issue.

For further testing, I built the standard Python plugin from scratch via "python uwsgiconfig.py --plugin plugins/python" updated the .ini file by removing the pypy- references, and changed the plugin reference from pypy python (python_plugin.so) and it works perfectly.

@unbit
Copy link
Owner

unbit commented May 16, 2014

that libraries are too old (a year ago). You should rebuild a new libpypy-c.so (we are working on it) or you should use the "alternative" approach described at the end of the docs

@btegs
Copy link
Author

btegs commented May 19, 2014

Thanks for the response.

Btw when I install PyPy from the Ubuntu repos, it has a lib_pypy folder in /usr/lib/pypy/ and the portable one I linked to also has a lib_pypy folder. Is there a reason that uWSGI cannot use these folders instead of having to require a separate .so file?

@unbit
Copy link
Owner

unbit commented May 20, 2014

lib_pypy dir has nothing to do with libpypy-c, it is basically the path holding the system python modules, while libpypy-c contains the whole pypy vm (ready to be embedded). Best thing you can do (if you cannot follow the alternative approach) is to build libpypy-c by yourself (about 1 hour of time)

@unbit
Copy link
Owner

unbit commented Jun 19, 2014

newer libpypy-c (64bit) is available. In addition to this arch linux started packaging it too.

@unbit unbit closed this as completed Jun 19, 2014
@velochy
Copy link

velochy commented Jul 8, 2014

I'm still seeing the exact same problem, even with the new file.
Setup slightly different: Ubuntu 14.04, pip and pypy installed via apt, then virtualenv created with /usr/bin/pypy to /home/deploy/project and uwsgi pip-installed into it. Then downloaded http://projects.unbit.it/downloads/pypy/libpypy-c-x86_64.so to /home/deploy/project/libpypy-c.so.

INI-file:
[uwsgi]
chmod-socket = 777

uid=deploy

socket = /tmp/uwsgi.sock
master = true
processes = 4
gevent = 1000

max-worker-lifetime = 6000

logto = /home/deploy/project/uwsgi.log

chdir = /home/deploy/project
virtualenv = /home/deploy/project
pypy-home = /home/deploy/project/bin
pypy-lib = /home/deploy/project/libpypy-c.so

pypy-wsgi = server:app
touch-reload = %p
auto-procname = true
procname-prefix-spaced = [project]

Log output:

*** Starting uWSGI 2.0.6 (64bit) on [Tue Jul 8 08:36:01 2014] ***
compiled with version: 4.8.2 on 08 July 2014 07:17:49
os: Linux-2.6.32-042stab084.12 #1 SMP Tue Nov 26 20:18:08 MSK 2013
nodename: vps31286
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/deploy/project
detected binary path: /home/deploy/project/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 255951
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
setuid() to 1000
debug: OperationError:
debug: operror-type: AssertionError
debug: operror-value:

I'd be happy to provide any additional debug output, just let me know what parts would help.

@tochev
Copy link

tochev commented Sep 28, 2014

I have the same problem with the new file and also with a locally compiled version (although that gives a slightly different output).

Ubuntu 12.04 64-bit, pypy is binary downloaded from the pypy website, I tried with pypy compiled by ./rpython/bin/rpython -Ojit --shared --gcrootfinder=shadowstack pypy/goal/targetpypystandalone.

$ uname -a
Linux precise64 3.2.0-67-generic #101-Ubuntu SMP Tue Jul 15 17:46:11 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ python --version
Python 2.7.8 (f5dcc2477b97, Sep 18 2014, 11:33:30)
[PyPy 2.4.0 with GCC 4.6.3]

$ pip --version
pip 1.5.6 (python 2.7)

$ ./bin/uwsgi --version
2.0.7

$ cat test.wsgi
def application(e, sr):
    sr('200 Ok', [('Content-Type', 'text/plain')])
    return "Hello"

# libpypy-c-x86_64_website.so = http://projects.unbit.it/downloads/pypy/libpypy-c-x86_64.so
$ ./bin/uwsgi --pypy-wsgi-file test.wsgi --pypy-lib libpypy-c-x86_64_website.so --master --socket 127.0.0.1:8000
*** Starting uWSGI 2.0.7 (64bit) on [Sun Sep 28 14:39:45 2014] ***
compiled with version: 4.6.3 on 28 September 2014 14:37:54
os: Linux-3.2.0-67-generic #101-Ubuntu SMP Tue Jul 15 17:46:11 UTC 2014
nodename: precise64
machine: x86_64
clock source: unix
detected number of CPU cores: 2
current working directory: /data/tmp/pypytest/portal
detected binary path: /data/tmp/pypytest/portal/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 63753
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8000 fd 3
debug: OperationError:
debug:  operror-type: AssertionError
debug:  operror-value: 

# libpypy-c_build_2.4.0.so = compiled from source (release-2.4.0) 
$ ./bin/uwsgi --pypy-wsgi-file test.wsgi --pypy-lib libpypy-c_build_2.4.0.so --master --socket 127.0.0.1:8000
*** Starting uWSGI 2.0.7 (64bit) on [Sun Sep 28 14:39:45 2014] ***
compiled with version: 4.6.3 on 28 September 2014 14:37:54
os: Linux-3.2.0-67-generic #101-Ubuntu SMP Tue Jul 15 17:46:11 UTC 2014
nodename: precise64
machine: x86_64
clock source: unix
detected number of CPU cores: 2
current working directory: /data/tmp/pypytest/portal
detected binary path: /data/tmp/pypytest/portal/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 63753
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8000 fd 3
RPython traceback:
  File "rpython_jit_metainterp_compile.c", line 22748, in send_loop_to_backend
  File "rpython_jit_backend_x86_assembler.c", line 2183, in Assembler386_assemble_loop
  File "rpython_jit_backend_x86_assembler.c", line 5382, in Assembler386__assemble
  File "rpython_jit_backend_x86_regalloc.c", line 1964, in RegAlloc_walk_operations
  File "rpython_jit_backend_x86_assembler.c", line 33571, in Assembler386_threadlocalref_get

# The same error is shown when using the master branch

@bradharms
Copy link

I'm also getting this issue, though it wasn't happening originally and only just started yesterday. Makes no difference which wsgi.py I use. Using the .so from the docs: http://projects.unbit.it/downloads/pypy/libpypy-c-x86_64.so

@tochev
Copy link

tochev commented Oct 10, 2014

@unbit will you reopen the issue or should a new one be created?

@unbit
Copy link
Owner

unbit commented Oct 10, 2014

@fijal is working on having official libpypy, i'll post updates here

@unbit unbit reopened this Oct 10, 2014
@theonewolf
Copy link

Also hitting this issue.

debug: OperationError:
debug:  operror-type: AssertionError
debug:  operror-value: ```

@unbit
Copy link
Owner

unbit commented Nov 21, 2014

The latest official nightly builds of pypy have libpypy built-in by default. We are fixing latest things. 2.0.9 should be easy to use with pypy

@xrmx
Copy link
Collaborator

xrmx commented Nov 5, 2015

This should be fixed, see http://uwsgi-docs.readthedocs.org/en/latest/PyPy.html . Closing.

@xrmx xrmx closed this as completed Nov 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants