[uWSGI] Logger without name causes segfault

Roberto De Ioris roberto at unbit.it
Fri Apr 25 07:46:56 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.

This has been fixed in 2.0.4:

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


>
> 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?

This is a good question. Personally i have always considered "500" errors
part of the request logging, but effectively apache
consider it part of the server log.

Take in account:

--log-route -> all of the uWSGI logs and stdout/stderr of apps
--log-req-route -> request logging (so you need to use this one for 404 or
500)

-- 
Roberto De Ioris
http://unbit.it


More information about the uWSGI mailing list