debug.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Debugging and inspecting
  2. ============================
  3. The highly asynchronous nature of ``larigira`` might lead to difficulty in
  4. debugging. However, ``larigira`` has some features to help you with debugging.
  5. Debugging options
  6. -----------------
  7. First of all, you might want to run larigira with the environment variable
  8. ``LARIGIRA_DEBUG`` set to ``true``. ``env LARIGIRA_DEBUG=true larigira``
  9. will do.
  10. With this on, message logging is much more verbose. Please observe
  11. that log messages provide information about the logger name from which the
  12. message originated: this is typically the class name of the object.
  13. Debug API
  14. ---------
  15. ``larigira`` also provides HTTP API to help you with debug:
  16. ``/api/debug/running``, for example, provides detailed information about
  17. running greenlets, with several representations:
  18. * the ``audiogens`` object will contain informations about greenlets associated
  19. with *scheduled* events. Here you can see its ``audiospec``, ``timespec``,
  20. and many other details
  21. * the ``greenlets`` object provides a simple list of every greenlets.
  22. Associated with every greenlet there is as much information as possible:
  23. object name, documentation, etc.
  24. * the ``greenlets_tree`` has the same information as ``greenlets``, but is
  25. shown as a tree: this is often easier to understand. For example, the
  26. ``Controller`` greenlet should have three children (``MpcWatcher``, ``Timer``
  27. and ``Monitor``).
  28. A user-friendly, but more limited, visualization is available at
  29. ``/view/status/running``
  30. Signals
  31. ---------
  32. When ``larigira`` receives the ``ALRM`` signal, three things happen: the playlist
  33. length is checked (as if ``CHECK_SECS`` passed); the event system "ticks" (as
  34. if ``EVENT_TICK_SECS`` passed); the DB is reloaded from disk.
  35. This is useful if you want to debug the event system, or if you manually
  36. changed the data on disk. Please note that the event system will automatically
  37. reload the DB from disk when appropriate. However, the WebUI will not, so you
  38. might have a misleading ``/db/list`` page; send an ``ALRM`` in this case.
  39. The same effect can be triggered performing an HTTP ``GET /rpc/refresh``.