Skip to contentSkip to conversation

is there existing cases for relayd to stream over Android usb based adb?

lttng-dev Wu, Yannan via lttng-dev 1 participant 7 messages May 30, 2024 – Jun 4, 2024

lore
Share & tools
lore
#0 lore raw

Hihi, there,

I am currently working on enabling lttng live mode over android usb adb. Here is the situation, during debugging some network related issues, we dont want the trace data to be streamed via network to cause extra load to the system being profiled. Then we select to connect lttng-relayd with adb via port forwarding so that the data is "forward" to the host.

Here is the set up and the problem:

for the device: adb reverse tcp:5342 tcp:5342; adb reverse tcp:5343 tcp:5343; adb reverse tcp:5344 tcp:5344 Then starting up lttng with --live enabled.

What is expected:
lttng start streaming to the localhost.
What is seen:
the lttng-relayd failed to start. For unable binding to the socket.

The cause of this issue:

both adb reverse and lttng relayd need binding to the socket which is conflict with each other.

So what I wanna ask is, for embedded system use cases, do we have successful use cases among team that could stream the trace data in live mode to the host with usb based adb? If not, any idea or suggestion to me on how to process forward?

Amanda

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#1 lore raw

Hi Amanda,

I'd like to confirm my understanding the situation.

Android device
- Running lttng-sessiond with one or more configured sessions

Development device
- Connected to the android device over usb using adb

You want want the data captured on the android device to be streamed via the usb connection rather than the other networks on the android device.

Could you expand on the commands you used to set up the tracing sessions and relay, and where each of those commands were run?

It sounds to me like you might want to be doing something like the following:

(Development device) Start lttng-relayd:
- tcp://0.0.0.0:5342 and :5343 will be bound on the development device
- tcp://127.0.0.1:5344 will be available for the live reader

(Development device) Create the reverses for the following ports: 5342 and 5343
- At this point :5342 and :5343 should be available on the android
device and reach the relayd running on the development device

(Android device) Start lttng-sessiond
(Android device) Create session(s): `lttng create -U tcp://localhost/
- Using -U/--set-url, no relayd will be spawned on the android device
(Android device) Start session(s)

This setup should have the relayd running on the development and writing the traces there and/or viewing them with a live viewer. On the android device, the UST applications (if any) will connect to the local sessiond and consumers, which will shuttle the information over :5342 and :5343 to the developer device via the reverse sockets.

Please note that I didn't have time to test this, so there might be some mistakes. As I requested above, clear details of the exact commands you use for the tracing setup would be very helpful to have the clearest understanding of what you're doing.

hope this helps,
kienan

Quoted 27 lines · Yannan via lttng-dev

Hihi, there,

I am currently working on enabling lttng live mode over android usb adb. Here is the situation, during debugging some network related issues, we dont want the trace data to be streamed via network to cause extra load to the system being profiled. Then we select to connect lttng-relayd with adb via port forwarding so that the data is "forward" to the host.

*Here is the set up and the problem:*

for the device:  adb reverse tcp:5342 tcp:5342; adb reverse tcp:5343 tcp:5343; adb reverse tcp:5344 tcp:5344 Then starting up lttng with --live enabled.

*What is expected:*
lttng start streaming to the localhost.
*What is seen: *
the lttng-relayd failed to start. For unable binding to the socket.

*The cause of this issue: *

both adb reverse and lttng relayd need binding to the socket which is conflict with each other.

So what I wanna ask is, for embedded system use cases, do we have successful use cases among team that could stream the trace data in live mode to the host with usb based adb? If not, any idea or suggestion to me on how to process forward?

Amanda

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#2 lore raw

Yes. My test command is like below:

1. lttng-sessiond --d --no-kernel
2.

yannanwu@ue91e96f2951b5c:~/trees/lttng_test_run$ lttng create my-user-space-live-session --live
Live session my-user-space-live-session created.
Traces will be output to tcp4://127.0.0.1:5342/ [data: 5343]
Live timer interval set to 1000000 us

3. After this, I could "ps -Ax|grep lttng" and see lttng-relayd started. But once I start adb reverse, it will failed for failed binding to socket.
4. In the other order, if I start adb reverse first and lttng-create later, lttng-create will not fail but lttng-relayd is not started. By manually start lttng-relayd it will also failed for unable binding to socket.

Amanda

________________________________
From: Kienan Stewart <[email protected]>
Sent: Friday, May 31, 2024 3:12:16 AM
To: Wu, Yannan; [email protected]
Subject: RE: [EXTERNAL] [lttng-dev] [lttng-relayd] is there existing cases for relayd to stream over Android usb based adb?

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Hi Amanda,

I'd like to confirm my understanding the situation.

Android device
- Running lttng-sessiond with one or more configured sessions

Development device
- Connected to the android device over usb using adb

You want want the data captured on the android device to be streamed via the usb connection rather than the other networks on the android device.

Could you expand on the commands you used to set up the tracing sessions and relay, and where each of those commands were run?

It sounds to me like you might want to be doing something like the following:

(Development device) Start lttng-relayd:
- tcp://0.0.0.0:5342 and :5343 will be bound on the development device
- tcp://127.0.0.1:5344 will be available for the live reader

(Development device) Create the reverses for the following ports: 5342 and 5343
- At this point :5342 and :5343 should be available on the android
device and reach the relayd running on the development device

(Android device) Start lttng-sessiond
(Android device) Create session(s): `lttng create -U tcp://localhost/
- Using -U/--set-url, no relayd will be spawned on the android device
(Android device) Start session(s)

This setup should have the relayd running on the development and writing the traces there and/or viewing them with a live viewer. On the android device, the UST applications (if any) will connect to the local sessiond and consumers, which will shuttle the information over :5342 and :5343 to the developer device via the reverse sockets.

Please note that I didn't have time to test this, so there might be some mistakes. As I requested above, clear details of the exact commands you use for the tracing setup would be very helpful to have the clearest understanding of what you're doing.

hope this helps,
kienan

Quoted 36 lines · Yannan via lttng-dev

Hihi, there,

I am currently working on enabling lttng live mode over android usb adb. Here is the situation, during debugging some network related issues, we dont want the trace data to be streamed via network to cause extra load to the system being profiled. Then we select to connect lttng-relayd with adb via port forwarding so that the data is "forward" to the host.

*Here is the set up and the problem:*

for the device: adb reverse tcp:5342 tcp:5342; adb reverse tcp:5343 tcp:5343; adb reverse tcp:5344 tcp:5344
Then starting up lttng with --live enabled.

*What is expected:*
lttng start streaming to the localhost.
*What is seen: *
the lttng-relayd failed to start. For unable binding to the socket.

*The cause of this issue: *

both adb reverse and lttng relayd need binding to the socket which is conflict with each other.

So what I wanna ask is, for embedded system use cases, do we have successful use cases among team that could stream the trace data in live mode to the host with usb based adb? If not, any idea or suggestion to me on how to process forward?

Amanda

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#6 lore raw
In reply to Kienan Stewart via lttng-dev

I checked lttng-relayd source code, we do need to bind to the exact socket for further process. As adb reverse bind to the socket as well there is a conflict in-between. Do we have any other way to workaround it?

Amanda

________________________________
From: Kienan Stewart <[email protected]>
Sent: Friday, May 31, 2024 3:12:16 AM
To: Wu, Yannan; [email protected]
Subject: RE: [EXTERNAL] [lttng-dev] [lttng-relayd] is there existing cases for relayd to stream over Android usb based adb?

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Hi Amanda,

I'd like to confirm my understanding the situation.

Android device
- Running lttng-sessiond with one or more configured sessions

Development device
- Connected to the android device over usb using adb

You want want the data captured on the android device to be streamed via the usb connection rather than the other networks on the android device.

Could you expand on the commands you used to set up the tracing sessions and relay, and where each of those commands were run?

It sounds to me like you might want to be doing something like the following:

(Development device) Start lttng-relayd:
- tcp://0.0.0.0:5342 and :5343 will be bound on the development device
- tcp://127.0.0.1:5344 will be available for the live reader

(Development device) Create the reverses for the following ports: 5342 and 5343
- At this point :5342 and :5343 should be available on the android
device and reach the relayd running on the development device

(Android device) Start lttng-sessiond
(Android device) Create session(s): `lttng create -U tcp://localhost/
- Using -U/--set-url, no relayd will be spawned on the android device
(Android device) Start session(s)

This setup should have the relayd running on the development and writing the traces there and/or viewing them with a live viewer. On the android device, the UST applications (if any) will connect to the local sessiond and consumers, which will shuttle the information over :5342 and :5343 to the developer device via the reverse sockets.

Please note that I didn't have time to test this, so there might be some mistakes. As I requested above, clear details of the exact commands you use for the tracing setup would be very helpful to have the clearest understanding of what you're doing.

hope this helps,
kienan

Quoted 36 lines · Yannan via lttng-dev

Hihi, there,

I am currently working on enabling lttng live mode over android usb adb. Here is the situation, during debugging some network related issues, we dont want the trace data to be streamed via network to cause extra load to the system being profiled. Then we select to connect lttng-relayd with adb via port forwarding so that the data is "forward" to the host.

*Here is the set up and the problem:*

for the device: adb reverse tcp:5342 tcp:5342; adb reverse tcp:5343 tcp:5343; adb reverse tcp:5344 tcp:5344
Then starting up lttng with --live enabled.

*What is expected:*
lttng start streaming to the localhost.
*What is seen: *
the lttng-relayd failed to start. For unable binding to the socket.

*The cause of this issue: *

both adb reverse and lttng relayd need binding to the socket which is conflict with each other.

So what I wanna ask is, for embedded system use cases, do we have successful use cases among team that could stream the trace data in live mode to the host with usb based adb? If not, any idea or suggestion to me on how to process forward?

Amanda

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#3 lore raw
In reply to Wu, Yannan via lttng-dev

Hi Amanda,

For each of the 4 commands described below, please clarify on which device they are executed, whether on the Android device or on the Development device.

Please make sure to follow to the letter the commands proposed by Kienan: in the correct order, and on the appropriate device.

Thanks,

Mathieu

Quoted 123 lines · Yannan via lttng-dev

Yes. My test command is like below:

1. lttng-sessiond --d --no-kernel
2.

    yannanwu@ue91e96f2951b5c:~/trees/lttng_test_run$ lttng create my-user-space-live-session --live
    Live session my-user-space-live-session created.
    Traces will be output to tcp4://127.0.0.1:5342/ [data: 5343]
    Live timer interval set to 1000000 us

3. After this, I could "ps -Ax|grep lttng" and see lttng-relayd started. But once I start adb reverse, it will failed for failed binding to socket.
4. In the other order, if I start adb reverse first and lttng-create later, lttng-create will not fail but lttng-relayd is not started. By manually start lttng-relayd it will also failed for unable binding to socket.

Amanda

------------------------------------------------------------------------
*From:* Kienan Stewart <[email protected]>
*Sent:* Friday, May 31, 2024 3:12:16 AM
*To:* Wu, Yannan; [email protected]
*Subject:* RE: [EXTERNAL] [lttng-dev] [lttng-relayd] is there existing cases for relayd to stream over Android usb based adb?
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Hi Amanda,

I'd like to confirm my understanding the situation.

Android device
   - Running lttng-sessiond with one or more configured sessions

Development device
   - Connected to the android device over usb using adb

You want want the data captured on the android device to be streamed via the usb connection rather than the other networks on the android device.

Could you expand on the commands you used to set up the tracing sessions and relay, and where each of those commands were run?

It sounds to me like you might want to be doing something like the following:

(Development device) Start lttng-relayd:
   - tcp://0.0.0.0:5342 and :5343 will be bound on the development device
   - tcp://127.0.0.1:5344 will be available for the live reader

(Development device) Create the reverses for the following ports: 5342 and 5343
   - At this point :5342 and :5343 should be available on the android
device and reach the relayd running on the development device

(Android device) Start lttng-sessiond
(Android device) Create session(s): `lttng create -U tcp://localhost/
   - Using -U/--set-url, no relayd will be spawned on the android device
(Android device) Start session(s)

This setup should have the relayd running on the development and writing the traces there and/or viewing them with a live viewer. On the android device, the UST applications (if any) will connect to the local sessiond and consumers, which will shuttle the information over :5342 and :5343 to the developer device via the reverse sockets.

Please note that I didn't have time to test this, so there might be some mistakes. As I requested above, clear details of the exact commands you use for the tracing setup would be very helpful to have the clearest understanding of what you're doing.

hope this helps,
kienan

Quoted 36 lines · Yannan via lttng-dev

Hihi, there,

I am currently working on enabling lttng live mode over android usb adb. Here is the situation, during debugging some network related issues, we dont want the trace data to be streamed via network to cause extra load to the system being profiled. Then we select to connect lttng-relayd with adb via port forwarding so that the data is "forward" to the host.

*Here is the set up and the problem:*

for the device:  adb reverse tcp:5342 tcp:5342; adb reverse tcp:5343 tcp:5343; adb reverse tcp:5344 tcp:5344
Then starting up lttng with --live enabled.

*What is expected:*
lttng start streaming to the localhost.
*What is seen: *
the lttng-relayd failed to start. For unable binding to the socket.

*The cause of this issue: *

both adb reverse and lttng relayd need binding to the socket which is conflict with each other.

So what I wanna ask is, for embedded system use cases, do we have successful use cases among team that could stream the trace data in live mode to the host with usb based adb? If not, any idea or suggestion to me on how to process forward?

Amanda

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

<https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev>

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#4 lore raw

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:

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

________________________________
From: Mathieu Desnoyers <[email protected]>
Sent: Tuesday, June 4, 2024 11:09:40 PM
To: Wu, Yannan; Kienan Stewart; [email protected]
Subject: RE: [EXTERNAL] [lttng-dev] [lttng-relayd] is there existing cases for relayd to stream over Android usb based adb?

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Hi Amanda,

For each of the 4 commands described below, please clarify on which device they are executed, whether on the Android device or on the Development device.

Please make sure to follow to the letter the commands proposed by Kienan: in the correct order, and on the appropriate device.

Thanks,

Mathieu

Quoted 120 lines · Yannan via lttng-dev

Yes. My test command is like below:

1. lttng-sessiond --d --no-kernel
2.

    yannanwu@ue91e96f2951b5c:~/trees/lttng_test_run$ lttng create my-user-space-live-session --live
    Live session my-user-space-live-session created.
    Traces will be output to tcp4://127.0.0.1:5342/ [data: 5343]
    Live timer interval set to 1000000 us

3. After this, I could "ps -Ax|grep lttng" and see lttng-relayd started. But once I start adb reverse, it will failed for failed binding to socket.
4. In the other order, if I start adb reverse first and lttng-create later, lttng-create will not fail but lttng-relayd is not started. By manually start lttng-relayd it will also failed for unable binding to socket.

Amanda

------------------------------------------------------------------------
*From:* Kienan Stewart <[email protected]>
*Sent:* Friday, May 31, 2024 3:12:16 AM
*To:* Wu, Yannan; [email protected]
*Subject:* RE: [EXTERNAL] [lttng-dev] [lttng-relayd] is there existing cases for relayd to stream over Android usb based adb?
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Hi Amanda,

I'd like to confirm my understanding the situation.

Android device
- Running lttng-sessiond with one or more configured sessions

Development device
- Connected to the android device over usb using adb

You want want the data captured on the android device to be streamed via the usb connection rather than the other networks on the android device.

Could you expand on the commands you used to set up the tracing sessions and relay, and where each of those commands were run?

It sounds to me like you might want to be doing something like the following:

(Development device) Start lttng-relayd:
- tcp://0.0.0.0:5342 and :5343 will be bound on the development device
- tcp://127.0.0.1:5344 will be available for the live reader

(Development device) Create the reverses for the following ports: 5342 and 5343
- At this point :5342 and :5343 should be available on the android
device and reach the relayd running on the development device

(Android device) Start lttng-sessiond
(Android device) Create session(s): `lttng create -U tcp://localhost/
- Using -U/--set-url, no relayd will be spawned on the android device
(Android device) Start session(s)

This setup should have the relayd running on the development and writing the traces there and/or viewing them with a live viewer. On the android device, the UST applications (if any) will connect to the local sessiond and consumers, which will shuttle the information over :5342 and :5343 to the developer device via the reverse sockets.

Please note that I didn't have time to test this, so there might be some mistakes. As I requested above, clear details of the exact commands you use for the tracing setup would be very helpful to have the clearest understanding of what you're doing.

hope this helps,
kienan

Quoted 36 lines · Yannan via lttng-dev

Hihi, there,

I am currently working on enabling lttng live mode over android usb adb. Here is the situation, during debugging some network related issues, we dont want the trace data to be streamed via network to cause extra load to the system being profiled. Then we select to connect lttng-relayd with adb via port forwarding so that the data is "forward" to the host.

*Here is the set up and the problem:*

for the device: adb reverse tcp:5342 tcp:5342; adb reverse tcp:5343 tcp:5343; adb reverse tcp:5344 tcp:5344
Then starting up lttng with --live enabled.

*What is expected:*
lttng start streaming to the localhost.
*What is seen: *
the lttng-relayd failed to start. For unable binding to the socket.

*The cause of this issue: *

both adb reverse and lttng relayd need binding to the socket which is conflict with each other.

So what I wanna ask is, for embedded system use cases, do we have successful use cases among team that could stream the trace data in live mode to the host with usb based adb? If not, any idea or suggestion to me on how to process forward?

Amanda

Quoted 4 lines

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Quoted 6 lines

<https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev>

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

#5 lore raw
Quoted 15 lines · Yannan

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:*

Quoted 7 lines

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

Quoted 4 lines

/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/

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev