Hi list,
I've got two issues (not sure if related) with my setup.
First issue:
For some odd reason, Pyramid wasn't working because uWSGI wasn't
handing the nginx variables down to pypy (yes I included the uwsgi_param
file in nginx's configuration). This led to KeyError(s) because
"REQUEST_METHOD" and other variables weren't present in uwsgi.environ[].
A little digging led me to an odd behaviour in the embedded
pypy_setup.py file concerning lines somewhere 450 lines down:
for i in range(0, wsgi_req.var_cnt, 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)
For some reason wsgi_req.var_cnt is 0 even though everything else in
the iovs are properly populated. This is queer as from the C source,
var_cnt is incremented while filling up the iovs, so if data in the iovs
are valid, var_cnt should have been valid.
I worked around the issue for now by overriding the embedded
pypy_setup.py file and re-calculating the value of var_cnt by assuming that
parameters have iov_len > 0 and that (hopefully) there's no garbage in
memory past the actual iovs.
Second issue:
I'm having very odd results with dictionaries used in my application.
Even with "processes = 1", "enable-threads = false", "threads = 1",
"offload-threads = 0" and "single-interpreter = true", some parts of my
application are seeing different versions of the same dictionary.
In particular, I realised that any modifications done as a result of
web requests (updating a dictionary from a POST request, for example), are
somehow isolated from any modifications done as a result of background
tasks (updating the same dictionary with information from a configuration
file, for example). This does not make sense as when I print
myDict.__repr__() in both places in my application, I get the same address.
However, when I print myDict, the data is wholly different and independent.
Other info:
The setup is on a Raspberry Pi running a custom Yocto-based
distribution. uWSGI, nginx and pypy were cross-compiled from source. I do
realise this complicates matters, but can anyone point out what could be
amiss?
=======8<===SNIP===8<=======
application.ini
============================
[uwsgi]
socket = /var/run/uwsgi/app.sock
pidfile = /var/run/uwsgi/app.pid
log-slow = true
master = true
chdir = /srv/uwsgi/app/
pypy-home /usr/pypy
pypy-lib /usr/pypy/libpypy-c.so
pypy-pythonpath = /usr/pypy
pypy-wsgi-file = /srv/uwsgi/app/myapp.py
pypy-setup = /srv/uwsgi/app/pypy_setup.py
processes = 1
enable-threads = false
threads = 1
offload-threads = 0
single-interpreter = true
harakiri = 30
limit-post = 65536
post-buffering = 8192
uid = xieliwei
gid = user
sharedarea = 4
reload-os-env = true
=======8<===SNIP===8<=======
# uwsgi --version
2.0.5.1
# nginx -v
nginx version: nginx/1.7.2
# pypy --version
Python 2.7.6 (14dc8277e88a, Apr 05 2014, 05:41:19)
[PyPy 2.3.0-alpha0 with GCC 4.8.2]
# uname -a
Linux dserv 3.10.30 #1 PREEMPT Mon Mar 17 10:10:37 PDT 2014 armv6l GNU/Linux
=======8<===SNIP===8<=======
Thanks!
Liwei
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi