perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

traced service 'enable-relay-endpoint' has no effects on linux

Open aetheln opened this issue 6 months ago • 1 comments

traced service code path for linux with 'enable-relay-endpoint' (near line 195 in traced/service/servic.cc) does not add relay socket into producer_eps.

aetheln avatar Jun 05 '26 03:06 aetheln

Just below in the code you can see, the flag being used linux (non-android) https://crsrc.org/c/third_party/perfetto/src/traced/service/service.cc;l=212-225

  for (const auto& producer_socket_name : producer_socket_names) {
  remove(producer_socket_name.c_str());
  ListenEndpoint ep(producer_socket_name);
  // RelayPort is exposed on this socket if either:
  //   --enable-relay-endpoint was passed (applies to all
  //   PERFETTO_PRODUCER_SOCK_NAME sockets), OR
  //   --enable-relay-endpoint-on=<this socket> was passed (selects
  //   specific producer sockets).
  bool selected = relay_endpoint_sockets.count(producer_socket_name) > 0;
  if (selected)
    seen_relay_selectors.insert(producer_socket_name);
  ep.expose_relay_endpoint = enable_relay_endpoint || selected;
  producer_eps.emplace_back(std::move(ep));
}

On Linux, it makes the producer socket you already configured also accept relay connections.

The code your pointing to is android-speciific. You can look into #5908 for the change added. And pls refer to https://perfetto.dev/docs/learning-more/multi-machine-tracing#step-1-start-code-traced-code-on-the-host-listening-on-tcp on how to configure

sashwinbalaji avatar Jun 05 '26 07:06 sashwinbalaji