Fix: python lttngust agent fails when LTTNG_UST_APP_PATH is not set
authorKienan Stewart <kstewart@efficios.com>
Fri, 9 Feb 2024 19:18:59 +0000 (14:18 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Feb 2024 14:22:59 +0000 (09:22 -0500)
Observed issue
==============

lttng-tools `tests/regression/ust/python-logging/test_python_logging`
had the following failures:

```
not ok 14 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 27 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 40 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 53 - Found 0 / 5 events matching 'python-ev-test1' out of 0 events
not ok 66 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 74 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 82 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 98 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 109 - Found 0 / 5 events matching 'python-ev-test1' out of 0 events
not ok 115 - Found 0 events matching 'python-ev-test1'
not ok 121 - Found 0 / 1 events matching 'python-ev-test2' amongst 0 events
not ok 127 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 134 - Found 0 / 10 events matching 'python-ev-test1' amongst 0 events
not ok 140 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 146 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
not ok 157 - Found 0 / 5 events matching 'python-ev-test1' amongst 0 events
```

Cause
=====

When the use of `LTTNG_UST_APP_PATH` was introduced[1], no default
value for `ust_app_port` was set. In the case where
`LTTNG_UST_APP_PATH` is not set in the environment the condition for
starting with the `ust_app_port` is still checked, causing the
following exception:

```
[2559145.907503] LTTng-UST warning: _init_threads(): cannot create client threads: cannot access local variable 'ust_app_port' where it is not associated with a value
```

Solution
========

Provide a known default value for `ust_app_port`.

Known drawbacks
===============

None.

References
==========

[1]: https://github.com/lttng/lttng-ust/commit/c0f6fb054d2f16518d047a6adf7e8aa81eff5403

Change-Id: I92242ccd056dd91505156e4e8df812639eaef570
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/python-lttngust/lttngust/agent.py

index 58845b569c70ad75076872f11ce2e9de767c1adc..d0c1af7ca8eab3883129e9e889012d48735d7cd2 100644 (file)
@@ -316,6 +316,7 @@ def _init_threads():
         user_port = None
         dbg._pdebug('ust_app session daemon port: {}'.format(ust_app_port))
     else:
+        ust_app_port = None
         sys_port = _get_port_from_file('/var/run/lttng/agent.port')
         user_port_file = os.path.join(_get_user_home_path(), '.lttng', 'agent.port')
         user_port = _get_port_from_file(user_port_file)
This page took 0.025905 seconds and 4 git commands to generate.