Bug #870


Python agent hang on teardown

Added by Christian Babeux over 9 years ago. Updated almost 9 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


The UST Python agent seems to be hanging when executing this serie of commands:

import logging
import lttng_agent
agent = lttng_agent.LTTngAgent()
ev1 = logging.getLogger("python-ev-test1");

lttng create; lttng enable-event -p -a; lttng start then launch

A proper way to teardown the agent without calling destroy need to be found.

Actions #1

Updated by Christian Babeux over 9 years ago

  • Target version set to 2.7
Actions #2

Updated by Mathieu Desnoyers about 9 years ago

  • Status changed from New to Feedback
  • Assignee set to Mathieu Desnoyers

Should be fixed by this UST commit:

commit de4dee04fa3e008fe1044538f78778a867563aa4
Author: Philippe Proulx <>
Date:   Tue Mar 31 20:09:54 2015 -0400

    Refactor Python agent

    This patch refactors the whole LTTng-UST Python agent.
    Notorious changes are:

      * Python module "lttng_agent" moved to Python package
        "lttngust". This removes "agent" from the name, which
        really is an implementation detail. "lttngust" is used
        because "lttng" would clash with LTTng-tools Python
      * Python package instead of simple module. Splitting the
        code in various modules will make future development
      * Use daemon threads to make sure logging with tracing
        support is available as long as the regular threads live,
        while making sure that the application exits instantly when
        its regular threads die.
      * Create client threads and register to session daemons
        at import time. This allows the package to be usable just
        by importing it (no need to instanciate any specific class
        or call any specific function).
      * Do not use a semaphore + sleep to synchronize client threads
        with the importing thread: use a blocking synchronized
        queue with appropriate timeouts.
      * Add debug statements at strategic locations, enabled by
        setting the $LTTNG_UST_PYTHON_DEBUG environment variable
        to 1 before importing the package.
      * Override the default session daemon registration timeout
      * Override the default session daemon registration retry
      * Honor $LTTNG_HOME (to retrieve session daemon TCP ports).
      * Do not use an absolute path when loading the tracepoint
        provider shared object. Users should use the
        $LD_LIBRARY_PATH environment variable to override the
        default library path when running Python instead.
      * Do not keep an event dictionary since this brings issues
        when enabling/disabling events with the same name in
        different sessions.
      * Make sure the reference count does not go below 0,
        which could happen when destroying a session which contains
        events that are disabled already.
      * Minor improvements to make the code more Pythonic.

    Signed-off-by: Philippe Proulx <>
    Signed-off-by: Mathieu Desnoyers <>
Actions #3

Updated by Mathieu Desnoyers almost 9 years ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF