[lttng-dev] [lttng-relayd] is there existing cases for relayd to stream over Android usb based adb?

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Jun 4 11:56:25 EDT 2024


On 2024-06-04 11:25, Wu, Yannan wrote:
> The device is a rooted android device
> 
> *On the device:*
> 
> lttng-sessiond -d --no-kernel
> 
> lttng create my-live-session --live
> 
> lttng enable-event -u <mu customized event>
> 
> lttng start
> 
> 
> *On the host:*
> 
> adb reverse tcp:5343 tcp:5343
> 
> The adb reverse will fail for "/adb.exe: error: cannot bind to socket/"
> 
> 
> In the reversed order, if set up adb reverse from the host first and 
> create the live session after, lttng-relayd on device cannot be started.
> Here is the error message:

The "reverse order" you describe is the order you need. What you are
missing is to run lttng-relayd on the host and to forward both ports
5342 *and* 5343. You will also need to either override the target URLs
for the live control and data ports to prevent sessiond from auto-spawning
a relayd, or forward the live viewer port as well through adb (5344).

Overall:

* First on the Host:

lttng-relayd
adb reverse tcp:5342 tcp:5342  # control port
adb reverse tcp:5343 tcp:5343  # data port
adb reverse tcp:5344 tcp:5344  # live viewer port

* Then on the Android Device:

lttng-sessiond -d --no-kernel
lttng create my-live-session --live --ctrl-url=tcp://localhost:5342 --data-url=tcp://localhost:5343
lttng enable-event -u <my customized event>
lttng start

The reason why the relayd auto-spawn needs to be prevented is because
the "lttng create" command line attempts to connect to the localhost relayd
as a viewer (default port tcp 5344). So if you don't forward this
port as well through adb, the sessiond will always try to auto-spawn
a relayd which conflicts with your forwarded ports on the Android
device.

Technically either forwarding port 5344 or specifying control/data
URL override is sufficient to prevent the relayd auto-spawn, but
I'd recommend doing both if it is possible.

Thanks,

Mathieu

> 
> /PERROR - 15:23:30.915938387 [9813/9829]: Failed to bind socket: Address 
> already in use (in relay_socket_create() at 
> /src/VodkaLttngTool/build/private/source/src/bin/lttng-relayd/main.c:1036)/
> /Error: Health error occurred in relay_thread_listener/
> /Error: A file descriptor leak has been detected: 1 tracked file 
> descriptors are still being tracked/

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com



More information about the lttng-dev mailing list