Turn thread traceback logger on by default
It no longer requires an additional thread to work and it is very useful to have this enabled when you hit an issue that is hard to reproduce.
This commit is contained in:
parent
c90322f1e2
commit
f843b32e88
@ -19,6 +19,11 @@ v0.13.0 (in development)
|
||||
- Log a warning if a track isn't playable to make it more obvious that backend
|
||||
X needs backend Y to be present for playback to work.
|
||||
|
||||
- Removed the :attr:`mopidy.settings.DEBUG_THREAD` setting and the
|
||||
:option:`--debug-thread` command line option. Sending SIGUSR1 to
|
||||
the Mopidy process will now always make it log tracebacks for all alive
|
||||
threads.
|
||||
|
||||
**Spotify backend**
|
||||
|
||||
- Let GStreamer handle time position tracking and seeks. (Fixes: :issue:`191`)
|
||||
|
||||
@ -305,10 +305,27 @@ Debugging deadlocks
|
||||
|
||||
Between the numerous Pykka threads and GStreamer interactions there can
|
||||
sometimes be a potential for deadlocks. In an effort to make these slightly
|
||||
simpler to debug the setting :attr:`mopidy.settings.DEBUG_THREAD` or the option
|
||||
``--debug-thread`` can be used to turn on an extra debug thread. This thread is
|
||||
not linked to the regular program flow, and it's only task is to dump traceback
|
||||
showing the other threads state when we get a ``SIGUSR1``.
|
||||
simpler to debug Mopidy registers a ``SIGUSR1`` signal handler which logs the
|
||||
traceback of all alive threads.
|
||||
|
||||
To trigger the signal handler, you need the process ID (PID) of Mopidy. This
|
||||
can for example be found by running ``ps``::
|
||||
|
||||
$ ps aux | grep mopidy
|
||||
jodal 4313 2.0 1.7 2573592 69804 pts/14 Sl+ 00:15 0:02 python
|
||||
mopidy
|
||||
jodal 4700 0.0 0.0 9392 924 pts/10 S+ 00:17 0:00 grep
|
||||
mopidy
|
||||
$
|
||||
|
||||
In this example, Mopidy's PID is 4313. You can then use the ``kill`` command to
|
||||
send the ``SIGUSR1`` signal to the Mopidy proces::
|
||||
|
||||
$ kill -SIGUSR1 4313
|
||||
$
|
||||
|
||||
If you check the log, you should now find one log record with a full traceback
|
||||
for each of the currently alive threads in Mopidy.
|
||||
|
||||
|
||||
Writing documentation
|
||||
|
||||
@ -45,13 +45,11 @@ logger = logging.getLogger('mopidy.main')
|
||||
|
||||
def main():
|
||||
signal.signal(signal.SIGTERM, process.exit_handler)
|
||||
signal.signal(signal.SIGUSR1, pykka.debug.log_thread_tracebacks)
|
||||
|
||||
loop = gobject.MainLoop()
|
||||
options = parse_options()
|
||||
|
||||
if options.debug_thread or settings.DEBUG_THREAD:
|
||||
signal.signal(signal.SIGUSR1, pykka.debug.log_thread_tracebacks)
|
||||
|
||||
try:
|
||||
log.setup_logging(options.verbosity_level, options.save_debug_log)
|
||||
check_old_folders()
|
||||
|
||||
@ -49,14 +49,6 @@ DEBUG_LOG_FORMAT = '%(levelname)-8s %(asctime)s' + \
|
||||
#: DEBUG_LOG_FILENAME = u'mopidy.log'
|
||||
DEBUG_LOG_FILENAME = 'mopidy.log'
|
||||
|
||||
#: If we should start a background thread that dumps thread's traceback when we
|
||||
#: get a SIGUSR1. Mainly a debug tool for figuring out deadlocks.
|
||||
#:
|
||||
#: Default::
|
||||
#:
|
||||
#: DEBUG_THREAD = False
|
||||
DEBUG_THREAD = False
|
||||
|
||||
#: Location of the Mopidy .desktop file.
|
||||
#:
|
||||
#: Used by :mod:`mopidy.frontends.mpris`.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user