John Sivak | 23 Apr 06:08 2014

.yaml config files and magic variables

I'm switching from an .ini based uWSGI config to a .yaml based one and 
am having problems with magic variables being processed for a Python web 
app using Pylons.

In the .ini file:
chdir = %d

properly evaulates to the directory of the .ini file.

In the .yaml file:

chdir: %d

Can't be used, because PyYaml complains about the '%' character being 
first, so I try:

chdir: "%d"

but then uWSGI expands that to "/home/jsivak/projects/app1" (including 
the double quotation marks) and uWSGI can't find/chdir to the actual 
directory: /home/jsivak/projects/app1

Is this a bug/issue in uWSGI's processing of string based magic variables?

Thanks
Roberto De Ioris | 22 Apr 09:03 2014
Picon

[ANNOUNCE] uWSGI 2.0.4


Hi, another minor release for LTS branch is available:

http://uwsgi-docs.readthedocs.org/en/latest/Changelog-2.0.4.html

relevant new things are the support for duplicated http headers in http
parsers, the LRU auto-purging support for caches and the new experimental
asyncio loop engine.

--

-- 
Roberto De Ioris
http://unbit.it
Alain Meunier | 19 Apr 18:08 2014
Picon

sqlite blocking or not?

Hello,

I am not sure if I do things correctly.

Right now, my setup is working with a request done to sqlite through uwsgi.

Here is the way I connect to uwsgi :
uwsgi --plugin http_plugin.so --plugin lua_plugin.so --http :30031 --http-modifier1 6 --lua /path/to/test.lua --async 8

The script does a sqlite connection which deliberatly lasts about 2 seconds (to test the concurrency).

I feared that it would block me since sqlite doesn't have a server. And that it would break uwsgi unblocking nature.

But it seems that I can manage to get concurrency even without async or async 1.
Curl requests will still work in parallel.

That is why I wonder if I get the "blocking" point.

This database is read-only, so no write locks.

Could someone confirm that my current setup enables -massive- concurrency and more important, that I am not missing something on the way ?

Thanks,
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Roberto De Ioris | 19 Apr 12:28 2014
Picon

[ANNOUNCE] Experimental asyncio plugin


https://github.com/unbit/uwsgi-docs/blob/master/asyncio.rst

Every report will be really wellcomed

--

-- 
Roberto De Ioris
http://unbit.it
Roberto Bouza | 17 Apr 23:39 2014
Picon

Compiling uWSGI (custom building tools)

Hello,

I built the whole GCC/Binutils/glibc/python bundle (because we needed a good static python executable), so now that I have all the suite up and running, I'm still having some issues 
with uWSGI and I was hoping to get some help.

The first error I get is this:

In file included from /usr/local/python-static/2.7.6/include/python2.7/unicodeobject.h:120:0,
                 from /usr/local/python-static/2.7.6/include/python2.7/Python.h:85,
                 from plugins/python/uwsgi_python.h:2,
                 from plugins/python/pyutils.c:1:
/usr/local/glibc/2.19/include/wchar.h: In function 'wctob':
/usr/local/glibc/2.19/include/wchar.h:395:1: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
 ^
In file included from /usr/local/python-static/2.7.6/include/python2.7/unicodeobject.h:120:0,
                 from /usr/local/python-static/2.7.6/include/python2.7/Python.h:85,
                 from plugins/python/uwsgi_python.h:2,
                 from plugins/python/pyloader.c:1:
/usr/local/glibc/2.19/include/wchar.h: In function 'wctob':
/usr/local/glibc/2.19/include/wchar.h:395:1: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
 ^
In file included from /usr/local/python-static/2.7.6/include/python2.7/unicodeobject.h:120:0,
                 from /usr/local/python-static/2.7.6/include/python2.7/Python.h:85,
                 from plugins/python/uwsgi_python.h:2,
                 from plugins/python/python_plugin.c:1:
/usr/local/glibc/2.19/include/wchar.h: In function 'wctob':
/usr/local/glibc/2.19/include/wchar.h:395:1: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
 ^
In file included from /usr/local/python-static/2.7.6/include/python2.7/unicodeobject.h:120:0,
                 from /usr/local/python-static/2.7.6/include/python2.7/Python.h:85,
                 from plugins/python/uwsgi_python.h:2,
                 from plugins/python/wsgi_handlers.c:1:
/usr/local/glibc/2.19/include/wchar.h: In function 'wctob':
/usr/local/glibc/2.19/include/wchar.h:395:1: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
 { return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'

Which If I remove -Werror from the uwsgiconfig.py (It looks like a hack to me) can get past this error.

Then I get a lot of this (a few per library included) just pasting the end of it:

...
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:2290: undefined reference to `BZ2_bzDecompressEnd'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:2298: undefined reference to `BZ2_bzDecompressEnd'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:2312: undefined reference to `BZ2_bzDecompressEnd'
/usr/local/python-static/2.7.6/lib/python2.7/config/libpython2.7.a(bz2module.o): In function `Util_UnivNewlineRead':
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:357: undefined reference to `BZ2_bzRead'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:344: undefined reference to `BZ2_bzRead'
/usr/local/python-static/2.7.6/lib/python2.7/config/libpython2.7.a(bz2module.o): In function `BZ2File_seek':
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:1091: undefined reference to `BZ2_bzReadClose'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/bz2module.c:1106: undefined reference to `BZ2_bzReadOpen'
/usr/local/python-static/2.7.6/lib/python2.7/config/libpython2.7.a(callbacks.o): In function `CThunkObject_dealloc':
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callbacks.c:26: undefined reference to `ffi_closure_free'
/usr/local/python-static/2.7.6/lib/python2.7/config/libpython2.7.a(callbacks.o): In function `_ctypes_alloc_callback':
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callbacks.c:426: undefined reference to `ffi_closure_alloc'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callbacks.c:464: undefined reference to `ffi_prep_cif'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callbacks.c:476: undefined reference to `ffi_prep_closure_loc'
/usr/local/python-static/2.7.6/lib/python2.7/config/libpython2.7.a(callproc.o): In function `_call_function_pointer':
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callproc.c:801: undefined reference to `ffi_prep_cif'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callproc.c:836: undefined reference to `ffi_call'
/home/rbouza/development/Packages/build/tmp/Python-2.7.6/./Modules/_ctypes/callproc.c:836: undefined reference to `ffi_call'
collect2: error: ld returned 1 exit status
*** error linking uWSGI ***
make: *** [all] Error 1

But all the LDFLAGS and CFLAGS are there here is the linking line:

*** uWSGI linking ***
/usr/local/gcc/4.8.2/bin/gcc -o uwsgi -L/usr/local/gcc/4.8.2/lib -L/usr/local/gcc/4.8.2/lib64 -L/usr/local/binutils/2.24/lib -L/usr/local/glibc/2.19/lib -L/usr/local/libev/4.15/lib -L/usr/local/libffi/3.0.13/lib64 -L/usr/local/readline/6.2/lib -L/usr/local/zlib/1.2.8/lib -L/usr/local/bzip2/1.0.6/lib -L/usr/local/ncurses/5.9/lib -L/usr/local/openssl/1.0.1g/lib -L/usr/local/gdbm/1.11/lib -L/usr/local/sqlite/3.8.4.2/lib -L/usr/local/python-static/2.7.6/lib -lev -ldl core/utils.o core/protocol.o core/socket.o core/logging.o core/master.o core/master_utils.o core/emperor.o core/notify.o core/mule.o core/subscription.o core/stats.o core/sendfile.o core/async.o core/master_checks.o core/fifo.o core/offload.o core/io.o core/static.o core/websockets.o core/spooler.o core/snmp.o core/exceptions.o core/config.o core/setup_utils.o core/clock.o core/init.o core/buffer.o core/reader.o core/writer.o core/alarm.o core/cron.o core/hooks.o core/plugins.o core/lock.o core/cache.o core/daemons.o core/errors.o core/hash.o core/master_events.o core/chunked.o core/queue.o core/event.o core/signal.o core/strings.o core/progress.o core/timebomb.o core/ini.o core/fsmon.o core/mount.o core/metrics.o core/plugins_builder.o core/sharedarea.o core/rpc.o core/gateway.o core/loop.o core/cookie.o core/querystring.o core/rb_timers.o core/transformations.o core/uwsgi.o proto/base.o proto/uwsgi.o proto/http.o proto/fastcgi.o proto/scgi.o proto/puwsgi.o lib/linux_ns.o core/zlib.o core/yaml.o core/ssl.o core/legion.o core/xmlconf.o core/dot_h.o core/config_py.o plugins/python/python_plugin.o plugins/python/pyutils.o plugins/python/pyloader.o plugins/python/wsgi_handlers.o plugins/python/wsgi_headers.o plugins/python/wsgi_subhandler.o plugins/python/web3_subhandler.o plugins/python/pump_subhandler.o plugins/python/gil.o plugins/python/uwsgi_pymodule.o plugins/python/profiler.o plugins/python/symimporter.o plugins/python/tracebacker.o plugins/python/raw.o plugins/gevent/gevent.o plugins/gevent/hooks.o plugins/ping/ping_plugin.o plugins/cache/cache.o plugins/nagios/nagios.o plugins/rrdtool/rrdtool.o plugins/carbon/carbon.o plugins/rpc/rpc_plugin.o plugins/corerouter/cr_common.o plugins/corerouter/cr_map.o plugins/corerouter/corerouter.o plugins/fastrouter/fastrouter.o plugins/http/http.o plugins/http/keepalive.o plugins/http/https.o plugins/http/spdy3.o plugins/ugreen/ugreen.o plugins/signal/signal_plugin.o plugins/syslog/syslog_plugin.o plugins/rsyslog/rsyslog_plugin.o plugins/logsocket/logsocket_plugin.o plugins/router_uwsgi/router_uwsgi.o plugins/router_redirect/router_redirect.o plugins/router_basicauth/router_basicauth.o plugins/zergpool/zergpool.o plugins/redislog/redislog_plugin.o plugins/mongodblog/mongodblog_plugin.o plugins/router_rewrite/router_rewrite.o plugins/router_http/router_http.o plugins/logfile/logfile.o plugins/router_cache/router_cache.o plugins/rawrouter/rawrouter.o plugins/router_static/router_static.o plugins/sslrouter/sslrouter.o plugins/spooler/spooler_plugin.o plugins/cheaper_busyness/cheaper_busyness.o plugins/symcall/symcall_plugin.o plugins/transformation_tofile/tofile.o plugins/transformation_gzip/gzip.o plugins/transformation_chunked/chunked.o plugins/transformation_offload/offload.o plugins/router_memcached/router_memcached.o plugins/router_redis/router_redis.o plugins/router_hash/router_hash.o plugins/router_expires/expires.o plugins/router_metrics/plugin.o plugins/transformation_template/tt.o plugins/stats_pusher_socket/plugin.o -lpthread -lm -rdynamic -ldl -lz -lssl -lcrypto -lxml2 -lz -lm -lpthread -ldl -lutil -lm /usr/local/python-static/2.7.6/lib/python2.7/config/libpython2.7.a -lutil -lcrypt

System info:

$> uname -a
Linux localhost 2.6.32-279.19.1.el6.x86_64 #1 SMP Tue Dec 18 15:04:44 PST 2012 x86_64 x86_64 x86_64 GNU/Linux
$> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

uWSGI 2.0.3

Any help is appreciated! Thank you!

--
Roberto Bouza Fraga.
www: http://www.robertobouza.com
t: http://twitter.com/bouzafr - <at> bouzafr
e: bouzafr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
est | 17 Apr 16:15 2014
Picon

bug or feature? uwsgi_param UWSGI_SCHEME $scheme;

just found this question


looks like nginx config missing one thing:

uwsgi_param UWSGI_SCHEME $scheme;

the uwsgi_params does not include this line.

Is this a bug or a feature?
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Roberto De Ioris | 16 Apr 10:11 2014
Picon

Re: Varnish 4.0


> New varnish allows to create directors as loadable modules [1] [2] so I
> think it would be nice to have varnish as frontend without the need for
> HTTP router or nginx & FastRouter. But that would probably require to
> re-implement subscription logic (or split this code into
> libsubscription.so
> and link to it).
> On one hand it's nice to have one less layer, but on the other hand I
> doubt
> it would bring us much profit.
> But maybe there is some other way we could benefit from it?
>
> --
> Łukasz Mierzwa
> _______________________________________________
> uWSGI mailing list
> uWSGI <at> lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>

links are missing :)

--

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
uWSGI <at> lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Łukasz Mierzwa | 16 Apr 10:07 2014
Picon

Varnish 4.0

New varnish allows to create directors as loadable modules [1] [2] so I think it would be nice to have varnish as frontend without the need for HTTP router or nginx & FastRouter. But that would probably require to re-implement subscription logic (or split this code into libsubscription.so and link to it).
On one hand it's nice to have one less layer, but on the other hand I doubt it would bring us much profit.
But maybe there is some other way we could benefit from it?

--
Łukasz Mierzwa
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Richard Collins | 16 Apr 03:51 2014
Picon

Disable uWSGI exceptions catcher

On a new server, I have somehow managed to get python exceptions coming out to web browsers. It looks like I have accidentally enabled some debugging mode.

It is definately uWsgi, here is the first line I see in the browser:
uWSGI exceptions catcher for "GET /" (request plugin: "python", modifier1: 0)

How do I configure uWsgi to print the error to stderr and send a 500 error to nginx?

Richard Collins
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Tim Tisdall | 14 Apr 17:38 2014
Picon

restarting uwsgi with HUP occasionally gives bad fd

I have an init.d script that I use to restart my uwsgi instance by sending a HUP signal to the process.  In the past I've had no issues and it usually restarts the instance in a nice way.  Recently I've occasionally gotten the following in my logs:

worker 1 buried after 2 seconds
worker 2 buried after 3 seconds
binary reloading uWSGI...
chdir() to /
closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
found fd 3 mapped to socket 0 (/var/run/uwsgi/metrics_dev.sock)
running /sites/metrics_dev/env/bin/uwsgi
Bad file descriptor (epoll.cpp:144)

After that, the process is no longer running and I have to start it up as if it was shut down completely.  It's only a mild annoyance, but was wondering if there was a way to fix this.

I'm using uWSGI 2.0.3 which is using that socket to communicate with nginx.

-Tim
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Alain Meunier | 13 Apr 17:25 2014
Picon

nginx -> uwsgi -> nginx

Hello,

I would like to implement that :

1) client query nginx server (that is ok)
2) nginx proxy_pass to uwsgi to treat the answer and do the calculation (that is ok)
3) uwsgi talks back to nginx to serve a static file to the client via a loadbalanced upstream (how ?).

Is this logic ok ? If so, i cannot find a way in the uwsgi api to talk back to nginx without losing the initial client connection.

I thought about another http connection from uwsgi to nginx once the calculation is done but I don't know how not to lose the client informations (x-real) in the meantime.


Any ideas ?

Thanks
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Gmane