[uWSGI] Logger without name causes segfault

Chi Ho Kwok chkwok at digibites.nl
Fri Apr 25 02:26:36 CEST 2014

I just discovered that declaring a logger without a name leads to a
segfault. Backtrace:

Fri Apr 25 02:14:58 2014 - !!! uWSGI process 6490 got Segmentation Fault !!!
Fri Apr 25 02:14:58 2014 - *** backtrace of 6490 ***
uwsgi(uwsgi_backtrace+0x2e) [0x467b3e]
uwsgi(uwsgi_segfault+0x21) [0x467f01]
/lib/x86_64-linux-gnu/libc.so.6(+0x36ff0) [0x7fc4b5cbfff0]
/lib/x86_64-linux-gnu/libc.so.6(+0x1410a6) [0x7fc4b5dca0a6]
uwsgi(uwsgi_get_logger_from_id+0x38) [0x42e4a8]
uwsgi(uwsgi_setup_log_master+0xb9) [0x42e589]
uwsgi(uwsgi_setup+0xf78) [0x46b008]
uwsgi(main+0x9) [0x41e399]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fc4b5caaec5]
uwsgi() [0x41e3c7]
*** end of backtrace ***

>From http://uwsgi-docs.readthedocs.org/en/latest/Logging.html, a line like
"logger = file:/blabla" should be valid, but with PCRE enabled, it crashes
uwsgi on start. It looks like strcmp is done on a null pointer on line 920
in core/logging.c.

Config used (emperor only, setting up a new system)

master = true
die-on-term = true

emperor = /etc/uwsgi/sites/

logger = *test *file:/var/log/uwsgi/uwsgi-all.log
logger = nonok file:/var/log/uwsgi/uwsgi-error.log

# Anything not 200 is sent to error log
log-route = nonok (?!HTTP/1.\d 200)

log-date = true
log-format = %(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)"
%(status) %(size) "%(referer)" "%(uagent)"

uid = www-data
gid = www-data

To crash, remove the "test" logger name. Enviroment: fresh Ubuntu 14.04 vm,
with pretty much only libpcre3-dev libssl-dev python-dev build-essential as

While I'm here, what's the best way to setup a system like Apache's access
and error log? This is how we work currently:

Access: all the 200's and OK's.
Error: 404, 500, all output from Apache and its plugins like starting up,
shutting down and most importantly, *sys.stderr.write() from wsgi-apps*. Is
the last one printed to the "everything logger" in uwsgi and can be fished
out with some regexes?

Kind regards,

Chi Ho Kwok
Digibites Technology
chkwok at digibites.nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20140425/abe867b0/attachment.html>

More information about the uWSGI mailing list