Discussion:
[uWSGI] PyPy issue
Etienne Robillard
2018-02-08 14:17:21 UTC
Permalink
Hi,

I'm trying to run uWSGI 2.0.15 with PyPy 5.9 to bootstrap a native
django app.

Here's my uwsgi.ini :

[uwsgi]
chdir=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
module=benchmark.wsgi:application
master=True
pidfile=/tmp/uwsgi-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi.log
socket=127.0.0.1:8000
pypy-home=/usr/local/pypy

Command line:

$ /usr/local/pypy/bin/uwsgi --ini uwsgi.ini

Traceback:

From cffi callback <function uwsgi_pypy_wsgi_handler at 0xb377d390>:
Traceback (most recent call last):
  File "c callback", line 472, in uwsgi_pypy_wsgi_handler
TypeError: 'NoneType' object is not callable
[pid: 5698|app: -1|req: -1/2] 127.0.0.1 () {36 vars in 444 bytes} [Thu
Feb  8 09:11:04 2018] GET /benchmark/ => generated 0 bytes in 2 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)


Any ideas what I'm doing wrong? I compiled and installed uwsgi with pypy
5.9.


Thanks in advance,


Etienne
Etienne Robillard
2018-02-08 19:40:35 UTC
Permalink
I've digged the problem a little deeper.

My uwsgi.ini now looks like this:

[uwsgi]
plugins=pypy
chdir=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
master=True
pidfile=/tmp/uwsgi-master.pid
vacuum=True
max-requests=5000
socket=127.0.0.1:8000
pypy-home=/usr/local/pypy
pypy-wsgi=benchmark.wsgi:application

Traceback:

ENVIRON:
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
ENVIRON: XDG_MENU_PREFIX=xfce-
ENVIRON: LANG=en_CA.utf8
ENVIRON: DISPLAY=:0.0
ENVIRON:
OLDPWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite/benchmark
ENVIRON: COLORTERM=rxvt
ENVIRON: XDG_VTNR=7
ENVIRON: SSH_AUTH_SOCK=/tmp/ssh-sarMdiJdtI4D/agent.775
ENVIRON: GLADE_CATALOG_PATH=:
ENVIRON: XDG_SESSION_ID=2
ENVIRON: XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/erob
ENVIRON: USER=erob
ENVIRON: GLADE_MODULE_PATH=:
ENVIRON: DESKTOP_SESSION=lightdm-xsession
ENVIRON:
PWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
ENVIRON: HOME=/home/erob
ENVIRON: SSH_AGENT_PID=1042
ENVIRON: QT_ACCESSIBILITY=1
ENVIRON: XDG_SESSION_TYPE=x11
ENVIRON:
XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
ENVIRON: XDG_SESSION_DESKTOP=lightdm-xsession
ENVIRON: GLADE_PIXMAP_PATH=:
ENVIRON: DESKTOP_STARTUP_ID=xfce4-panel/exo-open/1069-0-marina_TIME100892
ENVIRON: TERM=rxvt
ENVIRON: SHELL=/bin/bash
ENVIRON: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
ENVIRON: XDG_CURRENT_DESKTOP=XFCE
ENVIRON: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
ENVIRON: SHLVL=1
ENVIRON: COLORFGBG=0;15
ENVIRON: XDG_SEAT=seat0
ENVIRON: LANGUAGE=en_CA:en
ENVIRON: WINDOWID=44040194
ENVIRON: GDMSESSION=lightdm-xsession
ENVIRON: LOGNAME=erob
ENVIRON:
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iOI2an0AiX,guid=b2939762a51bb6d7f7fca2a75a7c46b9
ENVIRON: XDG_RUNTIME_DIR=/run/user/1000
ENVIRON: QT_XCB_FORCE_SOFTWARE_OPENGL=1
ENVIRON: XAUTHORITY=/home/erob/.Xauthority
ENVIRON: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
ENVIRON: XDG_CONFIG_DIRS=/etc/xdg
ENVIRON: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
ENVIRON:
SESSION_MANAGER=local/marina:@/tmp/.ICE-unix/1052,unix/marina:/tmp/.ICE-unix/1052
ENVIRON: _=/usr/local/pypy/bin/uwsgi
ENVIRON: UWSGI_RELOADS=0
max space for custom process name = 2925
[uwsgi-logger] registered "syslog"
[uwsgi-logger] registered "rsyslog"
[uwsgi-logger] registered "socket"
[uwsgi-logger] registered "redislog"
[uwsgi-logger] registered "mongodblog"
[uwsgi-logger] registered "file"
[uwsgi-logger] registered "fd"
[uwsgi-logger] registered "stdio"
[uwsgi-cheaper-algo] registered "busyness"
executable name: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
tmp = /
[uWSGI] getting INI configuration from uwsgi.ini
[uWSGI DEBUG] loading plugin pypy
pypy plugin already available
optind:3 argc:3
[uwsgi-cheaper-algo] registered "spare"
[uwsgi-cheaper-algo] registered "backlog"
[uwsgi-cheaper-algo] registered "manual"
*** Starting uWSGI 2.0.15 (32bit) on [Thu Feb  8 14:30:22 2018] ***
***
*** You are running a DEBUG version of uWSGI, please disable debug in
your build profile and recompile it ***
***
compiled with version: 6.3.0 20170516 on 08 February 2018 09:02:54
os: Linux-4.9.0-5-686-pae #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
nodename: marina
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory:
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
writing pidfile to /tmp/uwsgi-master.pid
detected binary path: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
chdir() to
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
your processes number limit is 11955
your memory page size is 4096 bytes
detected max file descriptor number: 1024
cores allocated...
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
Initialized PyPy with Python 2.7.13 (84a2f3e6a7f8, Oct 03 2017, 12:58:57)
[PyPy 5.9.0 with GCC 4.6.3]
PyPy Home: /usr/local/pypy/pypy2-v5.9.0-linux32
[uWSGI DEBUG] uwsgi socket 256 SO_RCVBUF size: 87380
[uWSGI DEBUG] uwsgi socket 256 SO_SNDBUF size: 16384
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 127976 bytes (124 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 7227)
spawned uWSGI worker 1 (pid: 7229, cores: 1)
adding 6 to signal poll
[uWSGI DEBUG] PATH_INFO=/benchmark/
[uWSGI DEBUG] SERVER_NAME=localhost
[uWSGI DEBUG] SCRIPT_NAME=
[uWSGI DEBUG] HTTP_HOST=localhost
From cffi callback <function uwsgi_pypy_wsgi_handler at 0xb386a3d0>:
Traceback (most recent call last):
  File "c callback", line 472, in uwsgi_pypy_wsgi_handler
  File
"/usr/local/pypy/pypy2-v5.9.0-linux32/site-packages/Django-1.11.7-py2.7.egg/django/core/handlers/wsgi.py",
line 156, in __call__
    request = self.request_class(environ)
  File
"/usr/local/pypy/pypy2-v5.9.0-linux32/site-packages/Django-1.11.7-py2.7.egg/django/core/handlers/wsgi.py",
line 97, in __init__
    self.method = environ['REQUEST_METHOD'].upper()
KeyError: u'REQUEST_METHOD'
[pid: 7229|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 444 bytes} [Thu
Feb  8 19:30:34 2018] GET /benchmark/ => generated 0 bytes in 4 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
goodbye to uWSGI.
VACUUM: pidfile removed.

My python module looks like this:

import os
import django

#from django.core.wsgi import get_wsgi_application
from django.core.handlers.wsgi import WSGIHandler

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benchmark.settings")
django.setup()

application = WSGIHandler()

Any ideas why the environ object doesn't have REQUEST_METHOD ?

Etienne
Post by Etienne Robillard
Hi,
I'm trying to run uWSGI 2.0.15 with PyPy 5.9 to bootstrap a native
django app.
[uwsgi]
chdir=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
module=benchmark.wsgi:application
master=True
pidfile=/tmp/uwsgi-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi.log
socket=127.0.0.1:8000
pypy-home=/usr/local/pypy
$ /usr/local/pypy/bin/uwsgi --ini uwsgi.ini
  File "c callback", line 472, in uwsgi_pypy_wsgi_handler
TypeError: 'NoneType' object is not callable
[pid: 5698|app: -1|req: -1/2] 127.0.0.1 () {36 vars in 444 bytes} [Thu
Feb  8 09:11:04 2018] GET /benchmark/ => generated 0 bytes in 2 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
Any ideas what I'm doing wrong? I compiled and installed uwsgi with
pypy 5.9.
Thanks in advance,
Etienne
_______________________________________________
uWSGI mailing list
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Krzysztof Warzecha
2018-02-08 20:28:44 UTC
Permalink
Hello,
Post by Etienne Robillard
[uwsgi]
...
socket=127.0.0.1:8000
Is there any web server in the front of the uwsgi? If this is nginx,
are you sure you are using "uwsgi_pass" instead of, for example,
"proxy_pass"?


Could you replace socket= with http-socket= and query it with curl, like that?

curl -v http://127.0.0.1:8000/benchmark
--
Krzysztof Warzecha
Etienne Robillard
2018-02-08 21:12:16 UTC
Permalink
Hi Krzysztof,
Post by Krzysztof Warzecha
Hello,
Post by Etienne Robillard
[uwsgi]
...
socket=127.0.0.1:8000
Is there any web server in the front of the uwsgi? If this is nginx,
are you sure you are using "uwsgi_pass" instead of, for example,
"proxy_pass"?
Yes. I configured nginx like this:

 location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:8000;
    }

/etc/nginx/uwsgi_params:

uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;
uwsgi_param  REMOTE_USER    $remote_user;
uwsgi_param  SCRIPT_NAME    "";

uwsgi_cache_valid 200 302 10m;
Post by Krzysztof Warzecha
Could you replace socket= with http-socket= and query it with curl, like that?
curl -v http://127.0.0.1:8000/benchmark
Thats interesting. When using the http-socket param, i get the following
messages:

add uwsgi var: REQUEST_METHOD = GET
add uwsgi var: REQUEST_URI = /benchmark/
add uwsgi var: PATH_INFO = /benchmark/
add uwsgi var: QUERY_STRING =
add uwsgi var: SERVER_PROTOCOL = HTTP/1.1
add uwsgi var: SCRIPT_NAME =
add uwsgi var: SERVER_NAME = marina
add uwsgi var: SERVER_PORT = 8000
add uwsgi var: REMOTE_ADDR = 127.0.0.1

I suspect uWSGI doesn't properly pick up magic nginx variables when
using PyPy.

Etienne
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Krzysztof Warzecha
2018-02-08 22:21:19 UTC
Permalink
OK then. I have few more debugging tips, but no solution yet. Let's
see what nginx is sending to uwsgi. Please configure uwsgi with:

[uwsgi]
socket=127.0.0.1:8000

And please use strace (strace -p $PID -p $PID_2 ... -p $PID_N -vvfftt
-o /tmp/strace -s 5000) or tcpdump to confirm if nginx is or is not
sending the REQUEST_METHOD header.

For the record, this is how the code for populating wsgi environ looks like:

https://github.com/unbit/uwsgi/blob/2.0.15/plugins/pypy/pypy_setup.py#L451-L472


Could you confirm that it works if you replace socket=... with
http-socket=... in the uwsgi config and uwsgi_pass with proxy_pass
(with appropriate include ...) in the nginx conf?


If you configure your uwsgi with cpython instead of pypy, does it work
with similar configuration?
--
Krzysztof Warzecha
Etienne Robillard
2018-02-09 10:29:14 UTC
Permalink
Hi Krzysztof,

I found something highly relevant to my issue:
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html

So I followed Roberto's suggestion and removed my __pycache__ dir but
the issue is persisting.

What do you think? Should i attempt to patch pypy_setup.py ?



Etienne
Post by Krzysztof Warzecha
OK then. I have few more debugging tips, but no solution yet. Let's
[uwsgi]
socket=127.0.0.1:8000
And please use strace (strace -p $PID -p $PID_2 ... -p $PID_N -vvfftt
-o /tmp/strace -s 5000) or tcpdump to confirm if nginx is or is not
sending the REQUEST_METHOD header.
https://github.com/unbit/uwsgi/blob/2.0.15/plugins/pypy/pypy_setup.py#L451-L472
Could you confirm that it works if you replace socket=... with
http-socket=... in the uwsgi config and uwsgi_pass with proxy_pass
(with appropriate include ...) in the nginx conf?
If you configure your uwsgi with cpython instead of pypy, does it work
with similar configuration?
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Krzysztof Warzecha
2018-02-09 10:54:31 UTC
Permalink
Hello,
Post by Etienne Robillard
Hi Krzysztof,
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html
So I followed Roberto's suggestion and removed my __pycache__ dir but the
issue is persisting.
What do you think? Should i attempt to patch pypy_setup.py ?
Yes, this looks like sensible next step.

But just to be sure, before you do that, confirm that your nginx is
correctly sending REQUEST_METHOD header to 127.0.0.1:8000.
--
Krzysztof Warzecha
Etienne Robillard
2018-02-09 11:40:25 UTC
Permalink
Hi,

I confirm nginx is really sending the REQUEST_METHOD header with
nginx/uwsgi:

04:33:37.008721 read(6, "\0\274\1\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\3\0GET\f\0CONTENT_TYPE\0\0\16\0CONTENT_LENGTH\0\0\v\0REQUEST_URI\v\0/benchmark/\t\0PATH_INFO\v\0/benchmark/\r\0DOCUMENT_ROOT!\0/home/erob/www/isotopesoftware.ca\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\t\000127.0.0.1\v\0REMOTE_PORT\5\00041286\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\t\0localhost\v\0REMOTE_USER\0\0\v\0SCRIPT_NAME\0\0\7\0HTTP_TE\22\0deflate,gzip;q=0.3\17\0HTTP_CONNECTION\t\0TE, close\t\0HTTP_HOST\t\0localhost\17\0HTTP_USER_AGENT!\0lwp-request/6.15 libwww-perl/6.15", 4100) = 448

So I tried to hack pypy_setup.py by using iov.iov_len as a replacement for wsgi_req.var_cnt and here's the result:

environ = {}
 iov = wsgi_req.hvec
for i in range(0, iov.iov_len, 2):

        environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)

Now the traceback is somewhat different. Progress! :-)

ENVIRON:
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:

ENVIRON: PYTHONHOME=/usr

ENVIRON: XDG_MENU_PREFIX=xfce-

ENVIRON: LANG=en_CA.utf8

ENVIRON: DISPLAY=:0.0

ENVIRON: OLDPWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy

ENVIRON: COLORTERM=rxvt

ENVIRON: XDG_VTNR=7

ENVIRON: SSH_AUTH_SOCK=/tmp/ssh-sarMdiJdtI4D/agent.775

ENVIRON: GLADE_CATALOG_PATH=:

ENVIRON: XDG_SESSION_ID=2

ENVIRON: XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/erob

ENVIRON: USER=erob

ENVIRON: GLADE_MODULE_PATH=:

ENVIRON: DESKTOP_SESSION=lightdm-xsession

ENVIRON:
PWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite

ENVIRON: HOME=/home/erob

ENVIRON: SSH_AGENT_PID=1042

ENVIRON: QT_ACCESSIBILITY=1

ENVIRON: XDG_SESSION_TYPE=x11

ENVIRON:
XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share

ENVIRON: XDG_SESSION_DESKTOP=lightdm-xsession

ENVIRON: GLADE_PIXMAP_PATH=:

ENVIRON: DESKTOP_STARTUP_ID=xfce4-panel/exo-open/1069-0-marina_TIME100892

ENVIRON: TERM=rxvt

ENVIRON: SHELL=/bin/bash

ENVIRON: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0

ENVIRON: XDG_CURRENT_DESKTOP=XFCE

ENVIRON: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1

ENVIRON: SHLVL=1

ENVIRON: COLORFGBG=0;15

ENVIRON: XDG_SEAT=seat0

ENVIRON: LANGUAGE=en_CA:en

ENVIRON: WINDOWID=44040194

ENVIRON: GDMSESSION=lightdm-xsession

ENVIRON: LOGNAME=erob

ENVIRON:
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iOI2an0AiX,guid=b2939762a51bb6d7f7fca2a75a7c46b9

ENVIRON: XDG_RUNTIME_DIR=/run/user/1000

ENVIRON: QT_XCB_FORCE_SOFTWARE_OPENGL=1

ENVIRON: XAUTHORITY=/home/erob/.Xauthority

ENVIRON: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0

ENVIRON: XDG_CONFIG_DIRS=/etc/xdg

ENVIRON: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

ENVIRON:
SESSION_MANAGER=local/marina:@/tmp/.ICE-unix/1052,unix/marina:/tmp/.ICE-unix/1052

ENVIRON: _=/usr/local/pypy/bin/uwsgi

ENVIRON: UWSGI_RELOADS=0

max space for custom process name = 2917

[uwsgi-logger] registered "syslog"

[uwsgi-logger] registered "rsyslog"

[uwsgi-logger] registered "socket"

[uwsgi-logger] registered "redislog"

[uwsgi-logger] registered "mongodblog"

[uwsgi-logger] registered "file"

[uwsgi-logger] registered "fd"

[uwsgi-logger] registered "stdio"

[uwsgi-cheaper-algo] registered "busyness"

executable name: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi

tmp = /

[uWSGI] getting INI configuration from uwsgi.ini

optind:3 argc:3

[uwsgi-cheaper-algo] registered "spare"

[uwsgi-cheaper-algo] registered "backlog"

[uwsgi-cheaper-algo] registered "manual"

*** Starting uWSGI 2.0.15 (32bit) on [Fri Feb  9 06:30:17 2018] ***

***

*** You are running a DEBUG version of uWSGI, please disable debug in
your build profile and recompile it ***

***

compiled with version: 6.3.0 20170516 on 09 February 2018 06:25:44

os: Linux-4.9.0-5-686-pae #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)

nodename: marina

machine: i686

clock source: unix

pcre jit disabled

detected number of CPU cores: 2

current working directory:
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite

writing pidfile to /tmp/uwsgi-master.pid

detected binary path: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi

chdir() to
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite

your processes number limit is 11955

your memory page size is 4096 bytes

detected max file descriptor number: 1024

cores allocated...

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

Initialized PyPy with Python 2.7.13 (84a2f3e6a7f8, Oct 03 2017, 12:58:57)

[PyPy 5.9.0 with GCC 4.6.3]

PyPy Home: /usr/local/pypy/pypy2-v5.9.0-linux32

[uWSGI DEBUG] uwsgi socket 256 SO_RCVBUF size: 87380

[uWSGI DEBUG] uwsgi socket 256 SO_SNDBUF size: 16384

your server socket listen backlog is limited to 100 connections

your mercy for graceful operations on workers is 60 seconds

mapped 127976 bytes (124 KB) for 1 cores

*** Operational MODE: single process ***

*** no app loaded. going in full dynamic mode ***

*** uWSGI is running in multiple interpreter mode ***

spawned uWSGI master process (pid: 14858)

spawned uWSGI worker 1 (pid: 14861, cores: 1)

adding 6 to signal poll

[uWSGI DEBUG] PATH_INFO=/benchmark/

[uWSGI DEBUG] SERVER_NAME=localhost

[uWSGI DEBUG] SCRIPT_NAME=

[uWSGI DEBUG] HTTP_HOST=localhost

{'QUERY_STRING': '', 'REQUEST_METHOD': 'GET', 'CONTENT_TYPE': '',
'CONTENT_LENGTH': '', 'REQUEST_URI':'/benchmark/', 'PATH_INFO':
'/benchmark/'}

Internal Server Error:/benchmark/

Traceback (most recent call last):

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner

    response = get_response(request)

  File "/home/erob/ncvs/django/django/utils/deprecation.py", line 138,
in __call__

    response = self.process_request(request)

  File "/home/erob/ncvs/django/django/middleware/common.py", line 57,
in process_request

    host = request.get_host()

  File "/home/erob/ncvs/django/django/http/request.py", line 97, in
get_host

    host = self._get_raw_host()

  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host

    host = self.META['SERVER_NAME']

KeyError: u'SERVER_NAME'

Internal Server Error:/benchmark/

Traceback (most recent call last):

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner

    response = get_response(request)

  File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__

    response = self.get_response(request)

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner

    response = response_for_exception(request, exc)

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception

    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception

    return debug.technical_500_response(request, *exc_info)

  File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response

    html = reporter.get_traceback_html()

  File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html

    return t.render(c)

  File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render

    return self._render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render

    return self.nodelist.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render

    bit = node.render_annotated(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated

    return self.render(context)

  File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render

    return nodelist.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render

    bit = node.render_annotated(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated

    return self.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render

    output = self.filter_expression.resolve(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve

    obj = self.var.resolve(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve

    value = self._resolve_lookup(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup

    current = current()

  File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri

    host=self._get_raw_host(),

  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host

    host = self.META['SERVER_NAME']

KeyError: u'SERVER_NAME'

Internal Server Error:/benchmark/

Traceback (most recent call last):

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner

    response = get_response(request)

  File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__

    response = self.get_response(request)

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner

    response = response_for_exception(request, exc)

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception

    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception

    return debug.technical_500_response(request, *exc_info)

  File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response

    html = reporter.get_traceback_html()

  File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html

    return t.render(c)

  File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render

    return self._render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render

    return self.nodelist.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render

    bit = node.render_annotated(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated

    return self.render(context)

  File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render

    return nodelist.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render

    bit = node.render_annotated(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated

    return self.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render

    output = self.filter_expression.resolve(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve

    obj = self.var.resolve(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve

    value = self._resolve_lookup(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup

    current = current()

  File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri

    host=self._get_raw_host(),

  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host

    host = self.META['SERVER_NAME']

KeyError: u'SERVER_NAME'

From cffi callback <function uwsgi_pypy_wsgi_handler at 0xb379fbd0>:

Traceback (most recent call last):

  File "c callback", line 478, in uwsgi_pypy_wsgi_handler

  File "./benchmark/wsgi.py", line 20, in application

    return WSGIHandler()(environ, start_response)

  File "/home/erob/ncvs/django/django/core/handlers/wsgi.py", line 157,
in __call__

    response = self.get_response(request)

  File "/home/erob/ncvs/django/django/core/handlers/base.py", line 124,
in get_response

    response = self._middleware_chain(request)

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner

    response = response_for_exception(request, exc)

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception

    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())

  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception

    return debug.technical_500_response(request, *exc_info)

  File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response

    html = reporter.get_traceback_html()

  File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html

    return t.render(c)

  File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render

    return self._render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render

    return self.nodelist.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render

    bit = node.render_annotated(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated

    return self.render(context)

  File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render

    return nodelist.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render

    bit = node.render_annotated(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated

    return self.render(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render

    output = self.filter_expression.resolve(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve

    obj = self.var.resolve(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve

    value = self._resolve_lookup(context)

  File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup

    current = current()

  File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri

    host=self._get_raw_host(),

  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host

    host = self.META['SERVER_NAME']

KeyError: u'SERVER_NAME'

[pid: 14861|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 444 bytes} [Fri
Feb  9 11:30:23 2018] GET/benchmark/ => generated 0 bytes in 1729 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

SIGINT/SIGQUIT received...killing workers...

worker 1 buried after 1 seconds

goodbye to uWSGI.

VACUUM: pidfile removed.
Post by Krzysztof Warzecha
Hello,
Post by Etienne Robillard
Hi Krzysztof,
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html
So I followed Roberto's suggestion and removed my __pycache__ dir but the
issue is persisting.
What do you think? Should i attempt to patch pypy_setup.py ?
Yes, this looks like sensible next step.
But just to be sure, before you do that, confirm that your nginx is
correctly sending REQUEST_METHOD header to 127.0.0.1:8000.
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Etienne Robillard
2018-02-09 12:44:26 UTC
Permalink
OK. I got a working patch:

for i in range(0, iov.iov_len, 1):
      environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)

if not 'SERVER_NAME' in environ:
    environ['SERVER_NAME'] = uwsgi.hostname
if not 'SERVER_PORT' in environ:
     environ['SERVER_PORT'] = 80

It's ugly but it works! :-)

As a side-effect, i needed to add my hostname to ALLOWED_HOSTS.

Not really sure why SERVER_NAME and SERVER_PORT are not included in the
environ dict.

What do you think?

Etienne
Post by Etienne Robillard
Hi,
I confirm nginx is really sending the REQUEST_METHOD header with
04:33:37.008721 read(6, "\0\274\1\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\3\0GET\f\0CONTENT_TYPE\0\0\16\0CONTENT_LENGTH\0\0\v\0REQUEST_URI\v\0/benchmark/\t\0PATH_INFO\v\0/benchmark/\r\0DOCUMENT_ROOT!\0/home/erob/www/isotopesoftware.ca\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\t\000127.0.0.1\v\0REMOTE_PORT\5\00041286\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\t\0localhost\v\0REMOTE_USER\0\0\v\0SCRIPT_NAME\0\0\7\0HTTP_TE\22\0deflate,gzip;q=0.3\17\0HTTP_CONNECTION\t\0TE, close\t\0HTTP_HOST\t\0localhost\17\0HTTP_USER_AGENT!\0lwp-request/6.15 libwww-perl/6.15", 4100) = 448
environ = {}
 iov = wsgi_req.hvec
        environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
Now the traceback is somewhat different. Progress! :-)
ENVIRON: PYTHONHOME=/usr
ENVIRON: XDG_MENU_PREFIX=xfce-
ENVIRON: LANG=en_CA.utf8
ENVIRON: DISPLAY=:0.0
ENVIRON: OLDPWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy
ENVIRON: COLORTERM=rxvt
ENVIRON: XDG_VTNR=7
ENVIRON: SSH_AUTH_SOCK=/tmp/ssh-sarMdiJdtI4D/agent.775
ENVIRON: XDG_SESSION_ID=2
ENVIRON: XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/erob
ENVIRON: USER=erob
ENVIRON: DESKTOP_SESSION=lightdm-xsession
PWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
ENVIRON: HOME=/home/erob
ENVIRON: SSH_AGENT_PID=1042
ENVIRON: QT_ACCESSIBILITY=1
ENVIRON: XDG_SESSION_TYPE=x11
XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
ENVIRON: XDG_SESSION_DESKTOP=lightdm-xsession
ENVIRON: DESKTOP_STARTUP_ID=xfce4-panel/exo-open/1069-0-marina_TIME100892
ENVIRON: TERM=rxvt
ENVIRON: SHELL=/bin/bash
ENVIRON: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
ENVIRON: XDG_CURRENT_DESKTOP=XFCE
ENVIRON: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
ENVIRON: SHLVL=1
ENVIRON: COLORFGBG=0;15
ENVIRON: XDG_SEAT=seat0
ENVIRON: LANGUAGE=en_CA:en
ENVIRON: WINDOWID=44040194
ENVIRON: GDMSESSION=lightdm-xsession
ENVIRON: LOGNAME=erob
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iOI2an0AiX,guid=b2939762a51bb6d7f7fca2a75a7c46b9
ENVIRON: XDG_RUNTIME_DIR=/run/user/1000
ENVIRON: QT_XCB_FORCE_SOFTWARE_OPENGL=1
ENVIRON: XAUTHORITY=/home/erob/.Xauthority
ENVIRON: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
ENVIRON: XDG_CONFIG_DIRS=/etc/xdg
ENVIRON: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
ENVIRON: _=/usr/local/pypy/bin/uwsgi
ENVIRON: UWSGI_RELOADS=0
max space for custom process name = 2917
[uwsgi-logger] registered "syslog"
[uwsgi-logger] registered "rsyslog"
[uwsgi-logger] registered "socket"
[uwsgi-logger] registered "redislog"
[uwsgi-logger] registered "mongodblog"
[uwsgi-logger] registered "file"
[uwsgi-logger] registered "fd"
[uwsgi-logger] registered "stdio"
[uwsgi-cheaper-algo] registered "busyness"
executable name: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
tmp = /
[uWSGI] getting INI configuration from uwsgi.ini
optind:3 argc:3
[uwsgi-cheaper-algo] registered "spare"
[uwsgi-cheaper-algo] registered "backlog"
[uwsgi-cheaper-algo] registered "manual"
*** Starting uWSGI 2.0.15 (32bit) on [Fri Feb  9 06:30:17 2018] ***
***
*** You are running a DEBUG version of uWSGI, please disable debug in
your build profile and recompile it ***
***
compiled with version: 6.3.0 20170516 on 09 February 2018 06:25:44
os: Linux-4.9.0-5-686-pae #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
nodename: marina
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
writing pidfile to /tmp/uwsgi-master.pid
detected binary path: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
chdir() to
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
your processes number limit is 11955
your memory page size is 4096 bytes
detected max file descriptor number: 1024
cores allocated...
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
Initialized PyPy with Python 2.7.13 (84a2f3e6a7f8, Oct 03 2017, 12:58:57)
[PyPy 5.9.0 with GCC 4.6.3]
PyPy Home: /usr/local/pypy/pypy2-v5.9.0-linux32
[uWSGI DEBUG] uwsgi socket 256 SO_RCVBUF size: 87380
[uWSGI DEBUG] uwsgi socket 256 SO_SNDBUF size: 16384
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 127976 bytes (124 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14858)
spawned uWSGI worker 1 (pid: 14861, cores: 1)
adding 6 to signal poll
[uWSGI DEBUG] PATH_INFO=/benchmark/
[uWSGI DEBUG] SERVER_NAME=localhost
[uWSGI DEBUG] SCRIPT_NAME=
[uWSGI DEBUG] HTTP_HOST=localhost
{'QUERY_STRING': '', 'REQUEST_METHOD': 'GET', 'CONTENT_TYPE': '',
'/benchmark/'}
Internal Server Error:/benchmark/
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
    response = get_response(request)
  File "/home/erob/ncvs/django/django/utils/deprecation.py", line 138,
in __call__
    response = self.process_request(request)
  File "/home/erob/ncvs/django/django/middleware/common.py", line 57,
in process_request
    host = request.get_host()
  File "/home/erob/ncvs/django/django/http/request.py", line 97, in
get_host
    host = self._get_raw_host()
  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
    host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error:/benchmark/
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
    response = get_response(request)
  File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
    response = self.get_response(request)
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
    response = response_for_exception(request, exc)
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
    html = reporter.get_traceback_html()
  File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
    return t.render(c)
  File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
    return self._render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
    return self.nodelist.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
    bit = node.render_annotated(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
    return self.render(context)
  File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
    return nodelist.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
    bit = node.render_annotated(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
    return self.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
    output = self.filter_expression.resolve(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
    obj = self.var.resolve(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
    value = self._resolve_lookup(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
    current = current()
  File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
    host=self._get_raw_host(),
  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
    host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error:/benchmark/
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
    response = get_response(request)
  File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
    response = self.get_response(request)
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
    response = response_for_exception(request, exc)
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
    html = reporter.get_traceback_html()
  File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
    return t.render(c)
  File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
    return self._render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
    return self.nodelist.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
    bit = node.render_annotated(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
    return self.render(context)
  File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
    return nodelist.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
    bit = node.render_annotated(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
    return self.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
    output = self.filter_expression.resolve(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
    obj = self.var.resolve(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
    value = self._resolve_lookup(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
    current = current()
  File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
    host=self._get_raw_host(),
  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
    host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
  File "c callback", line 478, in uwsgi_pypy_wsgi_handler
  File "./benchmark/wsgi.py", line 20, in application
    return WSGIHandler()(environ, start_response)
  File "/home/erob/ncvs/django/django/core/handlers/wsgi.py", line 157,
in __call__
    response = self.get_response(request)
  File "/home/erob/ncvs/django/django/core/handlers/base.py", line 124,
in get_response
    response = self._middleware_chain(request)
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
    response = response_for_exception(request, exc)
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
    response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
  File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
    html = reporter.get_traceback_html()
  File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
    return t.render(c)
  File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
    return self._render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
    return self.nodelist.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
    bit = node.render_annotated(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
    return self.render(context)
  File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
    return nodelist.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
    bit = node.render_annotated(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
    return self.render(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
    output = self.filter_expression.resolve(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
    obj = self.var.resolve(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
    value = self._resolve_lookup(context)
  File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
    current = current()
  File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
    host=self._get_raw_host(),
  File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
    host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
[pid: 14861|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 444 bytes} [Fri
Feb  9 11:30:23 2018] GET/benchmark/ => generated 0 bytes in 1729 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
goodbye to uWSGI.
VACUUM: pidfile removed.
Post by Krzysztof Warzecha
Hello,
Post by Etienne Robillard
Hi Krzysztof,
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html
So I followed Roberto's suggestion and removed my __pycache__ dir but the
issue is persisting.
What do you think? Should i attempt to patch pypy_setup.py ?
Yes, this looks like sensible next step.
But just to be sure, before you do that, confirm that your nginx is
correctly sending REQUEST_METHOD header to 127.0.0.1:8000.
--
Etienne Robillard
https://www.isotopesoftware.ca/
_______________________________________________
uWSGI mailing list
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Krzysztof Warzecha
2018-02-12 10:35:47 UTC
Permalink
I'm glad you got that working. That's a 32-bit system, isn't it? Looks
like you got bit by this bug:
https://github.com/unbit/uwsgi/issues/1129
Post by Etienne Robillard
environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
environ['SERVER_NAME'] = uwsgi.hostname
environ['SERVER_PORT'] = 80
It's ugly but it works! :-)
As a side-effect, i needed to add my hostname to ALLOWED_HOSTS.
Not really sure why SERVER_NAME and SERVER_PORT are not included in the
environ dict.
What do you think?
Etienne
Hi,
I confirm nginx is really sending the REQUEST_METHOD header with
04:33:37.008721 read(6,
"\0\274\1\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\3\0GET\f\0CONTENT_TYPE\0\0\16\0CONTENT_LENGTH\0\0\v\0REQUEST_URI\v\0/benchmark/\t\0PATH_INFO\v\0/benchmark/\r\0DOCUMENT_ROOT!\0/home/erob/www/isotopesoftware.ca\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\t\000127.0.0.1\v\0REMOTE_PORT\5\00041286\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\t\0localhost\v\0REMOTE_USER\0\0\v\0SCRIPT_NAME\0\0\7\0HTTP_TE\22\0deflate,gzip;q=0.3\17\0HTTP_CONNECTION\t\0TE,
close\t\0HTTP_HOST\t\0localhost\17\0HTTP_USER_AGENT!\0lwp-request/6.15
libwww-perl/6.15", 4100) = 448
So I tried to hack pypy_setup.py by using iov.iov_len as a replacement for
environ = {}
iov = wsgi_req.hvec
environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
Now the traceback is somewhat different. Progress! :-)
ENVIRON: PYTHONHOME=/usr
ENVIRON: XDG_MENU_PREFIX=xfce-
ENVIRON: LANG=en_CA.utf8
ENVIRON: DISPLAY=:0.0
ENVIRON: OLDPWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy
ENVIRON: COLORTERM=rxvt
ENVIRON: XDG_VTNR=7
ENVIRON: SSH_AUTH_SOCK=/tmp/ssh-sarMdiJdtI4D/agent.775
ENVIRON: XDG_SESSION_ID=2
ENVIRON: XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/erob
ENVIRON: USER=erob
ENVIRON: DESKTOP_SESSION=lightdm-xsession
PWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
ENVIRON: HOME=/home/erob
ENVIRON: SSH_AGENT_PID=1042
ENVIRON: QT_ACCESSIBILITY=1
ENVIRON: XDG_SESSION_TYPE=x11
XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
ENVIRON: XDG_SESSION_DESKTOP=lightdm-xsession
ENVIRON: DESKTOP_STARTUP_ID=xfce4-panel/exo-open/1069-0-marina_TIME100892
ENVIRON: TERM=rxvt
ENVIRON: SHELL=/bin/bash
ENVIRON: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
ENVIRON: XDG_CURRENT_DESKTOP=XFCE
ENVIRON: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
ENVIRON: SHLVL=1
ENVIRON: COLORFGBG=0;15
ENVIRON: XDG_SEAT=seat0
ENVIRON: LANGUAGE=en_CA:en
ENVIRON: WINDOWID=44040194
ENVIRON: GDMSESSION=lightdm-xsession
ENVIRON: LOGNAME=erob
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iOI2an0AiX,guid=b2939762a51bb6d7f7fca2a75a7c46b9
ENVIRON: XDG_RUNTIME_DIR=/run/user/1000
ENVIRON: QT_XCB_FORCE_SOFTWARE_OPENGL=1
ENVIRON: XAUTHORITY=/home/erob/.Xauthority
ENVIRON: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
ENVIRON: XDG_CONFIG_DIRS=/etc/xdg
ENVIRON: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
ENVIRON: _=/usr/local/pypy/bin/uwsgi
ENVIRON: UWSGI_RELOADS=0
max space for custom process name = 2917
[uwsgi-logger] registered "syslog"
[uwsgi-logger] registered "rsyslog"
[uwsgi-logger] registered "socket"
[uwsgi-logger] registered "redislog"
[uwsgi-logger] registered "mongodblog"
[uwsgi-logger] registered "file"
[uwsgi-logger] registered "fd"
[uwsgi-logger] registered "stdio"
[uwsgi-cheaper-algo] registered "busyness"
executable name: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
tmp = /
[uWSGI] getting INI configuration from uwsgi.ini
optind:3 argc:3
[uwsgi-cheaper-algo] registered "spare"
[uwsgi-cheaper-algo] registered "backlog"
[uwsgi-cheaper-algo] registered "manual"
*** Starting uWSGI 2.0.15 (32bit) on [Fri Feb 9 06:30:17 2018] ***
***
*** You are running a DEBUG version of uWSGI, please disable debug in
your build profile and recompile it ***
***
compiled with version: 6.3.0 20170516 on 09 February 2018 06:25:44
os: Linux-4.9.0-5-686-pae #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
nodename: marina
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
writing pidfile to /tmp/uwsgi-master.pid
detected binary path: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
chdir() to
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
your processes number limit is 11955
your memory page size is 4096 bytes
detected max file descriptor number: 1024
cores allocated...
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
Initialized PyPy with Python 2.7.13 (84a2f3e6a7f8, Oct 03 2017, 12:58:57)
[PyPy 5.9.0 with GCC 4.6.3]
PyPy Home: /usr/local/pypy/pypy2-v5.9.0-linux32
[uWSGI DEBUG] uwsgi socket 256 SO_RCVBUF size: 87380
[uWSGI DEBUG] uwsgi socket 256 SO_SNDBUF size: 16384
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 127976 bytes (124 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14858)
spawned uWSGI worker 1 (pid: 14861, cores: 1)
adding 6 to signal poll
[uWSGI DEBUG] PATH_INFO=/benchmark/
[uWSGI DEBUG] SERVER_NAME=localhost
[uWSGI DEBUG] SCRIPT_NAME=
[uWSGI DEBUG] HTTP_HOST=localhost
{'QUERY_STRING': '', 'REQUEST_METHOD': 'GET', 'CONTENT_TYPE': '',
'/benchmark/'}
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 138,
in __call__
response = self.process_request(request)
File "/home/erob/ncvs/django/django/middleware/common.py", line 57,
in process_request
host = request.get_host()
File "/home/erob/ncvs/django/django/http/request.py", line 97, in
get_host
host = self._get_raw_host()
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
File "c callback", line 478, in uwsgi_pypy_wsgi_handler
File "./benchmark/wsgi.py", line 20, in application
return WSGIHandler()(environ, start_response)
File "/home/erob/ncvs/django/django/core/handlers/wsgi.py", line 157,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/base.py", line 124,
in get_response
response = self._middleware_chain(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
[pid: 14861|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 444 bytes} [Fri
Feb 9 11:30:23 2018] GET /benchmark/ => generated 0 bytes in 1729 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
goodbye to uWSGI.
VACUUM: pidfile removed.
Hello,
Hi Krzysztof,
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html
So I followed Roberto's suggestion and removed my __pycache__ dir but the
issue is persisting.
What do you think? Should i attempt to patch pypy_setup.py ?
Yes, this looks like sensible next step.
But just to be sure, before you do that, confirm that your nginx is
correctly sending REQUEST_METHOD header to 127.0.0.1:8000.
--
Etienne Robillard
https://www.isotopesoftware.ca/
_______________________________________________
uWSGI mailing list
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
--
Etienne Robillard
https://www.isotopesoftware.ca/
--
Krzysztof Warzecha
Etienne Robillard
2018-02-12 21:12:07 UTC
Permalink
Hi Kryzsztof,

Thank you for your kind reply. Yes, i'm running a 32-bit machine for
development purpose.

My patch is working for my simple use-case but i believe it is far from
being perfect.

However, i'm not exactly sure how to implement the proposed workaround.

Any chances this is going to be fixed in a future uWSGI release ?


Best regards,

Etienne
Post by Krzysztof Warzecha
I'm glad you got that working. That's a 32-bit system, isn't it? Looks
https://github.com/unbit/uwsgi/issues/1129
Post by Etienne Robillard
environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
environ['SERVER_NAME'] = uwsgi.hostname
environ['SERVER_PORT'] = 80
It's ugly but it works! :-)
As a side-effect, i needed to add my hostname to ALLOWED_HOSTS.
Not really sure why SERVER_NAME and SERVER_PORT are not included in the
environ dict.
What do you think?
Etienne
Hi,
I confirm nginx is really sending the REQUEST_METHOD header with
04:33:37.008721 read(6,
"\0\274\1\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\3\0GET\f\0CONTENT_TYPE\0\0\16\0CONTENT_LENGTH\0\0\v\0REQUEST_URI\v\0/benchmark/\t\0PATH_INFO\v\0/benchmark/\r\0DOCUMENT_ROOT!\0/home/erob/www/isotopesoftware.ca\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\t\000127.0.0.1\v\0REMOTE_PORT\5\00041286\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\t\0localhost\v\0REMOTE_USER\0\0\v\0SCRIPT_NAME\0\0\7\0HTTP_TE\22\0deflate,gzip;q=0.3\17\0HTTP_CONNECTION\t\0TE,
close\t\0HTTP_HOST\t\0localhost\17\0HTTP_USER_AGENT!\0lwp-request/6.15
libwww-perl/6.15", 4100) = 448
So I tried to hack pypy_setup.py by using iov.iov_len as a replacement for
environ = {}
iov = wsgi_req.hvec
environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
Now the traceback is somewhat different. Progress! :-)
ENVIRON: PYTHONHOME=/usr
ENVIRON: XDG_MENU_PREFIX=xfce-
ENVIRON: LANG=en_CA.utf8
ENVIRON: DISPLAY=:0.0
ENVIRON: OLDPWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy
ENVIRON: COLORTERM=rxvt
ENVIRON: XDG_VTNR=7
ENVIRON: SSH_AUTH_SOCK=/tmp/ssh-sarMdiJdtI4D/agent.775
ENVIRON: XDG_SESSION_ID=2
ENVIRON: XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/erob
ENVIRON: USER=erob
ENVIRON: DESKTOP_SESSION=lightdm-xsession
PWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
ENVIRON: HOME=/home/erob
ENVIRON: SSH_AGENT_PID=1042
ENVIRON: QT_ACCESSIBILITY=1
ENVIRON: XDG_SESSION_TYPE=x11
XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
ENVIRON: XDG_SESSION_DESKTOP=lightdm-xsession
ENVIRON: DESKTOP_STARTUP_ID=xfce4-panel/exo-open/1069-0-marina_TIME100892
ENVIRON: TERM=rxvt
ENVIRON: SHELL=/bin/bash
ENVIRON: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
ENVIRON: XDG_CURRENT_DESKTOP=XFCE
ENVIRON: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
ENVIRON: SHLVL=1
ENVIRON: COLORFGBG=0;15
ENVIRON: XDG_SEAT=seat0
ENVIRON: LANGUAGE=en_CA:en
ENVIRON: WINDOWID=44040194
ENVIRON: GDMSESSION=lightdm-xsession
ENVIRON: LOGNAME=erob
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iOI2an0AiX,guid=b2939762a51bb6d7f7fca2a75a7c46b9
ENVIRON: XDG_RUNTIME_DIR=/run/user/1000
ENVIRON: QT_XCB_FORCE_SOFTWARE_OPENGL=1
ENVIRON: XAUTHORITY=/home/erob/.Xauthority
ENVIRON: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
ENVIRON: XDG_CONFIG_DIRS=/etc/xdg
ENVIRON: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
ENVIRON: _=/usr/local/pypy/bin/uwsgi
ENVIRON: UWSGI_RELOADS=0
max space for custom process name = 2917
[uwsgi-logger] registered "syslog"
[uwsgi-logger] registered "rsyslog"
[uwsgi-logger] registered "socket"
[uwsgi-logger] registered "redislog"
[uwsgi-logger] registered "mongodblog"
[uwsgi-logger] registered "file"
[uwsgi-logger] registered "fd"
[uwsgi-logger] registered "stdio"
[uwsgi-cheaper-algo] registered "busyness"
executable name: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
tmp = /
[uWSGI] getting INI configuration from uwsgi.ini
optind:3 argc:3
[uwsgi-cheaper-algo] registered "spare"
[uwsgi-cheaper-algo] registered "backlog"
[uwsgi-cheaper-algo] registered "manual"
*** Starting uWSGI 2.0.15 (32bit) on [Fri Feb 9 06:30:17 2018] ***
***
*** You are running a DEBUG version of uWSGI, please disable debug in
your build profile and recompile it ***
***
compiled with version: 6.3.0 20170516 on 09 February 2018 06:25:44
os: Linux-4.9.0-5-686-pae #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
nodename: marina
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
writing pidfile to /tmp/uwsgi-master.pid
detected binary path: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
chdir() to
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
your processes number limit is 11955
your memory page size is 4096 bytes
detected max file descriptor number: 1024
cores allocated...
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
Initialized PyPy with Python 2.7.13 (84a2f3e6a7f8, Oct 03 2017, 12:58:57)
[PyPy 5.9.0 with GCC 4.6.3]
PyPy Home: /usr/local/pypy/pypy2-v5.9.0-linux32
[uWSGI DEBUG] uwsgi socket 256 SO_RCVBUF size: 87380
[uWSGI DEBUG] uwsgi socket 256 SO_SNDBUF size: 16384
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 127976 bytes (124 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14858)
spawned uWSGI worker 1 (pid: 14861, cores: 1)
adding 6 to signal poll
[uWSGI DEBUG] PATH_INFO=/benchmark/
[uWSGI DEBUG] SERVER_NAME=localhost
[uWSGI DEBUG] SCRIPT_NAME=
[uWSGI DEBUG] HTTP_HOST=localhost
{'QUERY_STRING': '', 'REQUEST_METHOD': 'GET', 'CONTENT_TYPE': '',
'/benchmark/'}
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 138,
in __call__
response = self.process_request(request)
File "/home/erob/ncvs/django/django/middleware/common.py", line 57,
in process_request
host = request.get_host()
File "/home/erob/ncvs/django/django/http/request.py", line 97, in
get_host
host = self._get_raw_host()
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
File "c callback", line 478, in uwsgi_pypy_wsgi_handler
File "./benchmark/wsgi.py", line 20, in application
return WSGIHandler()(environ, start_response)
File "/home/erob/ncvs/django/django/core/handlers/wsgi.py", line 157,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/base.py", line 124,
in get_response
response = self._middleware_chain(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
[pid: 14861|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 444 bytes} [Fri
Feb 9 11:30:23 2018] GET /benchmark/ => generated 0 bytes in 1729 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
goodbye to uWSGI.
VACUUM: pidfile removed.
Hello,
Hi Krzysztof,
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html
So I followed Roberto's suggestion and removed my __pycache__ dir but the
issue is persisting.
What do you think? Should i attempt to patch pypy_setup.py ?
Yes, this looks like sensible next step.
But just to be sure, before you do that, confirm that your nginx is
correctly sending REQUEST_METHOD header to 127.0.0.1:8000.
--
Etienne Robillard
https://www.isotopesoftware.ca/
_______________________________________________
uWSGI mailing list
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
--
Etienne Robillard
https://www.isotopesoftware.ca/
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Etienne Robillard
2018-02-21 23:25:50 UTC
Permalink
My patch sucks.

I found a much better solution for this problem is to disable
|-D_FILE_OFFSET_BITS=64 in uwsgiconfig.py for 32-bit builds.

However I haven't tested yet to run pypy on a 64-bit system.

||Etienne|
||
Post by Krzysztof Warzecha
I'm glad you got that working. That's a 32-bit system, isn't it? Looks
https://github.com/unbit/uwsgi/issues/1129
Post by Etienne Robillard
environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
environ['SERVER_NAME'] = uwsgi.hostname
environ['SERVER_PORT'] = 80
It's ugly but it works! :-)
As a side-effect, i needed to add my hostname to ALLOWED_HOSTS.
Not really sure why SERVER_NAME and SERVER_PORT are not included in the
environ dict.
What do you think?
Etienne
Hi,
I confirm nginx is really sending the REQUEST_METHOD header with
04:33:37.008721 read(6,
"\0\274\1\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\3\0GET\f\0CONTENT_TYPE\0\0\16\0CONTENT_LENGTH\0\0\v\0REQUEST_URI\v\0/benchmark/\t\0PATH_INFO\v\0/benchmark/\r\0DOCUMENT_ROOT!\0/home/erob/www/isotopesoftware.ca\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\t\000127.0.0.1\v\0REMOTE_PORT\5\00041286\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\t\0localhost\v\0REMOTE_USER\0\0\v\0SCRIPT_NAME\0\0\7\0HTTP_TE\22\0deflate,gzip;q=0.3\17\0HTTP_CONNECTION\t\0TE,
close\t\0HTTP_HOST\t\0localhost\17\0HTTP_USER_AGENT!\0lwp-request/6.15
libwww-perl/6.15", 4100) = 448
So I tried to hack pypy_setup.py by using iov.iov_len as a replacement for
environ = {}
iov = wsgi_req.hvec
environ[ffi.string(ffi.cast("char*", iov[i].iov_base),
iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base),
iov[i+1].iov_len)
Now the traceback is somewhat different. Progress! :-)
ENVIRON: PYTHONHOME=/usr
ENVIRON: XDG_MENU_PREFIX=xfce-
ENVIRON: LANG=en_CA.utf8
ENVIRON: DISPLAY=:0.0
ENVIRON: OLDPWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy
ENVIRON: COLORTERM=rxvt
ENVIRON: XDG_VTNR=7
ENVIRON: SSH_AUTH_SOCK=/tmp/ssh-sarMdiJdtI4D/agent.775
ENVIRON: XDG_SESSION_ID=2
ENVIRON: XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/erob
ENVIRON: USER=erob
ENVIRON: DESKTOP_SESSION=lightdm-xsession
PWD=/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
ENVIRON: HOME=/home/erob
ENVIRON: SSH_AGENT_PID=1042
ENVIRON: QT_ACCESSIBILITY=1
ENVIRON: XDG_SESSION_TYPE=x11
XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
ENVIRON: XDG_SESSION_DESKTOP=lightdm-xsession
ENVIRON: DESKTOP_STARTUP_ID=xfce4-panel/exo-open/1069-0-marina_TIME100892
ENVIRON: TERM=rxvt
ENVIRON: SHELL=/bin/bash
ENVIRON: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
ENVIRON: XDG_CURRENT_DESKTOP=XFCE
ENVIRON: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
ENVIRON: SHLVL=1
ENVIRON: COLORFGBG=0;15
ENVIRON: XDG_SEAT=seat0
ENVIRON: LANGUAGE=en_CA:en
ENVIRON: WINDOWID=44040194
ENVIRON: GDMSESSION=lightdm-xsession
ENVIRON: LOGNAME=erob
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iOI2an0AiX,guid=b2939762a51bb6d7f7fca2a75a7c46b9
ENVIRON: XDG_RUNTIME_DIR=/run/user/1000
ENVIRON: QT_XCB_FORCE_SOFTWARE_OPENGL=1
ENVIRON: XAUTHORITY=/home/erob/.Xauthority
ENVIRON: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
ENVIRON: XDG_CONFIG_DIRS=/etc/xdg
ENVIRON: PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
ENVIRON: _=/usr/local/pypy/bin/uwsgi
ENVIRON: UWSGI_RELOADS=0
max space for custom process name = 2917
[uwsgi-logger] registered "syslog"
[uwsgi-logger] registered "rsyslog"
[uwsgi-logger] registered "socket"
[uwsgi-logger] registered "redislog"
[uwsgi-logger] registered "mongodblog"
[uwsgi-logger] registered "file"
[uwsgi-logger] registered "fd"
[uwsgi-logger] registered "stdio"
[uwsgi-cheaper-algo] registered "busyness"
executable name: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
tmp = /
[uWSGI] getting INI configuration from uwsgi.ini
optind:3 argc:3
[uwsgi-cheaper-algo] registered "spare"
[uwsgi-cheaper-algo] registered "backlog"
[uwsgi-cheaper-algo] registered "manual"
*** Starting uWSGI 2.0.15 (32bit) on [Fri Feb 9 06:30:17 2018] ***
***
*** You are running a DEBUG version of uWSGI, please disable debug in
your build profile and recompile it ***
***
compiled with version: 6.3.0 20170516 on 09 February 2018 06:25:44
os: Linux-4.9.0-5-686-pae #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)
nodename: marina
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
writing pidfile to /tmp/uwsgi-master.pid
detected binary path: /usr/local/pypy/pypy2-v5.9.0-linux32/bin/uwsgi
chdir() to
/home/erob/src/django-hotsauce-0.9/tests/benchmarks/lib/pypy/django_sqlite
your processes number limit is 11955
your memory page size is 4096 bytes
detected max file descriptor number: 1024
cores allocated...
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
Initialized PyPy with Python 2.7.13 (84a2f3e6a7f8, Oct 03 2017, 12:58:57)
[PyPy 5.9.0 with GCC 4.6.3]
PyPy Home: /usr/local/pypy/pypy2-v5.9.0-linux32
[uWSGI DEBUG] uwsgi socket 256 SO_RCVBUF size: 87380
[uWSGI DEBUG] uwsgi socket 256 SO_SNDBUF size: 16384
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 127976 bytes (124 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14858)
spawned uWSGI worker 1 (pid: 14861, cores: 1)
adding 6 to signal poll
[uWSGI DEBUG] PATH_INFO=/benchmark/
[uWSGI DEBUG] SERVER_NAME=localhost
[uWSGI DEBUG] SCRIPT_NAME=
[uWSGI DEBUG] HTTP_HOST=localhost
{'QUERY_STRING': '', 'REQUEST_METHOD': 'GET', 'CONTENT_TYPE': '',
'/benchmark/'}
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 138,
in __call__
response = self.process_request(request)
File "/home/erob/ncvs/django/django/middleware/common.py", line 57,
in process_request
host = request.get_host()
File "/home/erob/ncvs/django/django/http/request.py", line 97, in
get_host
host = self._get_raw_host()
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
Internal Server Error: /benchmark/
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
41, in inner
response = get_response(request)
File "/home/erob/ncvs/django/django/utils/deprecation.py", line 140,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
File "c callback", line 478, in uwsgi_pypy_wsgi_handler
File "./benchmark/wsgi.py", line 20, in application
return WSGIHandler()(environ, start_response)
File "/home/erob/ncvs/django/django/core/handlers/wsgi.py", line 157,
in __call__
response = self.get_response(request)
File "/home/erob/ncvs/django/django/core/handlers/base.py", line 124,
in get_response
response = self._middleware_chain(request)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
43, in inner
response = response_for_exception(request, exc)
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
93, in response_for_exception
response = handle_uncaught_exception(request,
get_resolver(get_urlconf()), sys.exc_info())
File "/home/erob/ncvs/django/django/core/handlers/exception.py", line
139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/erob/ncvs/django/django/views/debug.py", line 84, in
technical_500_response
html = reporter.get_traceback_html()
File "/home/erob/ncvs/django/django/views/debug.py", line 328, in
get_traceback_html
return t.render(c)
File "/home/erob/ncvs/django/django/template/base.py", line 207, in
render
return self._render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 199, in
_render
return self.nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/defaulttags.py", line
322, in render
return nodelist.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 990, in
render
bit = node.render_annotated(context)
File "/home/erob/ncvs/django/django/template/base.py", line 957, in
render_annotated
return self.render(context)
File "/home/erob/ncvs/django/django/template/base.py", line 1040, in
render
output = self.filter_expression.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 708, in
resolve
obj = self.var.resolve(context)
File "/home/erob/ncvs/django/django/template/base.py", line 849, in
resolve
value = self._resolve_lookup(context)
File "/home/erob/ncvs/django/django/template/base.py", line 911, in
_resolve_lookup
current = current()
File "/home/erob/ncvs/django/django/http/request.py", line 162, in
get_raw_uri
host=self._get_raw_host(),
File "/home/erob/ncvs/django/django/http/request.py", line 89, in
_get_raw_host
host = self.META['SERVER_NAME']
KeyError: u'SERVER_NAME'
[pid: 14861|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 444 bytes} [Fri
Feb 9 11:30:23 2018] GET /benchmark/ => generated 0 bytes in 1729 msecs
(HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
SIGINT/SIGQUIT received...killing workers...
worker 1 buried after 1 seconds
goodbye to uWSGI.
VACUUM: pidfile removed.
Hello,
Hi Krzysztof,
http://lists.unbit.it/pipermail/uwsgi/2014-June/007389.html
So I followed Roberto's suggestion and removed my __pycache__ dir but the
issue is persisting.
What do you think? Should i attempt to patch pypy_setup.py ?
Yes, this looks like sensible next step.
But just to be sure, before you do that, confirm that your nginx is
correctly sending REQUEST_METHOD header to 127.0.0.1:8000.
--
Etienne Robillard
https://www.isotopesoftware.ca/
_______________________________________________
uWSGI mailing list
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
--
Etienne Robillard
https://www.isotopesoftware.ca/
--
Etienne Robillard
***@yandex.com
https://www.isotopesoftware.ca/
Loading...