Skip to content

Fix durability of service introspection topics #1068

@nirwester

Description

@nirwester

Hi, while testing the new service introspection topic, I noticed an anomaly on the durability of the published service response.

If executing the following sequence of actions:

-starting a server
-starting a client
-wait some seconds to make sure that the execution is finished
-subscribe to the introspection topic (ex ros2 topic echo /add_two_ints/_service_event)
The last response sent by the server is received, even if the service is no more running. Ex:

info:
event_type: 2
stamp:
sec: 1683653877
nanosec: 751816926
client_gid:
...
sequence_number: 1
request: []
response:
sum: 3

I used this code, where the basic services example was modified to enable full intropsection:
https://github.com/nirwester/ros2_journey_examples/tree/master/homeworks/chap4/service_with_introspection
Running on this docker container (jammy-Iron):
osrf/docker_images#673

This would seem an issue in the durability of the corresponding publisher, probably set to transient_local. I don't know if there's any technical reason for this kind of implementation, but getting the last published results upon subscription seems confusing to me.

The problem was reproduced by @clalancette that proposed two possible solutions:

  • Leave it as TRANSIENT_LOCAL, but give it a large queue depth. That means that late-joining subscribers would be able to get all of the previous data, at the expense of using a lot of memory.
  • Change it to VOLATILE and just don't worry about late-joining subscribers.

The volatile choice sounds like the more reasonable, but we might be missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions