Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFO]: Supporting multiple versions of the same service (PRS_SOMEIPSD_00512). #797

Open
zhaoxin39913 opened this issue Oct 26, 2024 · 8 comments
Labels

Comments

@zhaoxin39913
Copy link

vSomeip Version

v3.4.10

Boost Version

1.7.6

Environment

Ubuntu 20.04

Describe the bug

Hi vsomeip experts,

One issue I would like to check with you guys.
 
In order to support multiple versions of the same service (defined in SOME/IP SD spec PRS_SOMEIPSD_00512), there could be multiple services offered with the same serviceID and instanceID but different major versions within a network. Using API request_service(serviceId, instanceId, ANY_MAJOR) should be able to find all services with different major versions for a given serviceID/instanceID pair. Next are_available() API should be able to retrieve all those major versions.

The problem is how does availability_handler() get triggered when those services with different major versions are detected, since only the serviceID and instanceID is passing to the handler without major version.

This is one of our customer user case, what's the solution do you suggest to handle it in our application?

Reproduction Steps

N/A

Expected behaviour

N/A

Logs and Screenshots

N/A

@zhaoxin39913 zhaoxin39913 changed the title [BUG]: <title>Supporting multiple versions of the same service. [BUG]: <title>Supporting multiple versions of the same service (PRS_SOMEIPSD_00512). Nov 4, 2024
@zhaoxin39913 zhaoxin39913 changed the title [BUG]: <title>Supporting multiple versions of the same service (PRS_SOMEIPSD_00512). [BUG]: Supporting multiple versions of the same service (PRS_SOMEIPSD_00512). Nov 4, 2024
@zhaoxin39913 zhaoxin39913 changed the title [BUG]: Supporting multiple versions of the same service (PRS_SOMEIPSD_00512). [INFO]: Supporting multiple versions of the same service (PRS_SOMEIPSD_00512). Nov 4, 2024
@KareemLMR
Copy link

Hello,
Did you tried calling request_service API with setting major version?
image

@zhaoxin39913
Copy link
Author

zhaoxin39913 commented Nov 18, 2024

Hi @KareemLMR,

Yes, I have tested request_service() API for the same service-instances with different major versions, it works without any errors from the log. But I am not able to verify it using vsomeip server API since the offer_service() API doesn't support offering the same service-instances with different major versions within the same VLAN network which I mentioned in #809.

Due to the limitation I have to ask our customer to verify it. It seems like our customer is using a 3rd party SOME/IP stack to deloy the services on different ECUs, which can support PRS_SOMEIPSD_00512.

@zhaoxin39913
Copy link
Author

zhaoxin39913 commented Nov 21, 2024

Hi @KareemLMR ,

Even we can specify the versions in some client side APIs like request_service(), subscribe() and register_availability_handler()/unregister_availability_handler(), there are still some APIs don't support passing the versions, which means the serviceID-instanceID-majVersion is not fully manageable independently. Thus I think we need to have below changes to fully support PRS_SOMEIPSD_00512 on client side to make sure the version is present in pair.

virtual void release_service(service_t _service, instance_t _instance) = 0;
change to
virtual void release_service(service_t _service, instance_t _instance, major_version_t _major = ANY_MAJOR, minor_version_t _minor = ANY_MINOR) = 0;

virtual void unsubscribe(service_t _service, instance_t _instance, eventgroup_t _eventgroup) = 0;
change to
virtual void unsubscribe(service_t _service, instance_t _instance, eventgroup_t _eventgroup, major_version_t _major = DEFAULT_MAJOR) = 0;

And request_event()/release_event() shall all add the major version as input parameter as below:
virtual void request_event(service_t _service, instance_t _instance, event_t _event, const std::set<eventgroup_t> &_eventgroups, major_version_t _major = DEFAULT_MAJOR, event_type_e _type = event_type_e::ET_EVENT, reliability_type_e _reliability = reliability_type_e::RT_UNKNOWN) = 0;

virtual void release_event(service_t _service, instance_t _instance, event_t _event, major_version_t _major = DEFAULT_MAJOR) = 0;

@zhaoxin39913
Copy link
Author

zhaoxin39913 commented Nov 22, 2024

I tested the request_service() for the same instance but with different major versions, and it return error message as below:
[error] rm_base::request_service service property mismatch (0102): [1234.5678:18:878082192] passed: 34:4294967295

In my test I have two devices (A and B) in the network. First device B offers service 0x1234/5678 with majorVersion 0x12. Next device B request service 0x1234/5678 with majorVersion 0x12 and it works. Then device B request service 0x1234/5678 with majorVersion 0x22, it reported such error.

From the source code, it seems like the majorVersion is not taken into consideration when maintaining the service instances available in the network. See void routing_manager_base::request_service() in routing_manager_base.cpp

@zhaoxin39913
Copy link
Author

Hi @KareemLMR,

From my investigation, It seems like the PRS_SOMEIPSD_00512 in SOME/IP SD Spec is totally not supported in vsomeip library, can you confirm ?

@KareemLMR
Copy link

KareemLMR commented Nov 23, 2024

Hello @zhaoxin39913
There is something I doubt, but I need to check with you. Open the vsomeip source code and navigate to the file implementation/routing/src/routing_manager_base.cpp at this function routing_manager_base::offer_service to be specific
image
And add a log to this if condition marked by the red arrow:
if (!its_info->is_local()) {
return false;
}
and if you can add more logs throughout this function then recompile and reinstall the binaries and let me see the logs of your test. If the log you added in that if condition appeared, then there is an issue as you said. If not then it is something else we will see.

@zhaoxin39913
Copy link
Author

Hi @KareemLMR,

I have made below changes per as your request:

    if (!its_info->is_local()) {
        VSOMEIP_INFO << "rm_base::offer_service !its_info->is_local ("
                << std::hex << std::setfill('0')
                << std::setw(4) << _client << "): ["
                << std::setw(4) << _service << "."
                << std::setw(4) << _instance << ":"
                << std::dec
                << static_cast<std::uint32_t>(its_info->get_major()) << ":"
                << its_info->get_minor() << "] passed: "
                << static_cast<std::uint32_t>(_major) << ":"
                << _minor;
        return false;

And after change I have triggered "notify-sample" to offer the second service instance 0x1234/0x5678 with version 0xA (There is already a service instance 0x1234/0x5678 with version 0x12 offered by another device within the same network). And from the wireshark we can see that the first time notify-sample was successful to offer the service 0x1234/0x5678 version 0xA, but after call stop_offer() and then start_offer() in "notify-sample", it failed to offer the service again. Below are full log messages from notify-sample:

zhax@zhax-desktop:~/work/COVESA/src/vsomeip-3.4.10/build/examples$ VSOMEIP_APPLICATION_NAME=service-sample ./notify-sample
2024-11-28 14:44:42.707338 [info] Using configuration folder: "/home/zhax/work/COVESA/src/config".
2024-11-28 14:44:42.709307 [info] Parsed vsomeip configuration in 1ms
2024-11-28 14:44:42.709649 [info] Configuration module loaded.
2024-11-28 14:44:42.709911 [info] Security disabled!
2024-11-28 14:44:42.710142 [info] Initializing vsomeip (3.4.10) application "service-sample".
2024-11-28 14:44:42.711782 [info] Instantiating routing manager [Host].
2024-11-28 14:44:42.714633 [info] create_routing_root: Routing root @ /tmp/vsomeip-0
2024-11-28 14:44:42.716890 [info] Service Discovery enabled. Trying to load module.
2024-11-28 14:44:42.725771 [info] Service Discovery module loaded.
2024-11-28 14:44:42.726925 [info] Application(service-sample, 1277) is initialized (11, 100).
2024-11-28 14:44:42.727391 [info] offer_event: Event [1234.5678.9999] uses configured cycle time 0ms
2024-11-28 14:44:42.728266 [info] REGISTER EVENT(1277): [1234.5678.9999:is_provider=true]
2024-11-28 14:44:42.728753 [info] Starting vsomeip application "service-sample" (1277) using 2 threads I/O nice 255
2024-11-28 14:44:42.731711 [info] main dispatch thread id from application: 1277 (service-sample) is: ffffbc79f060 TID: 189214
2024-11-28 14:44:42.732672 [info] shutdown thread id from application: 1277 (service-sample) is: ffffbbf8f060 TID: 189215
2024-11-28 14:44:42.733317 [info] create_local_server: Listening @ /tmp/vsomeip-1277
2024-11-28 14:44:42.734978 [info] OFFER(1277): [1234.5678:10.0] (true)
2024-11-28 14:44:42.732532 [info] Client [1277] routes unicast:192.168.225.3, netmask:255.255.255.0
Setting event (Length=1).
2024-11-28 14:44:42.739600 [info] Watchdog is disabled!
Application service-sample is registered.
2024-11-28 14:44:42.741732 [info] io thread id from application: 1277 (service-sample) is: ffffbec44020 TID: 189210
2024-11-28 14:44:42.741929 [info] io thread id from application: 1277 (service-sample) is: ffffbaf6f060 TID: 189217
2024-11-28 14:44:42.743662 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:44:42.744930 [info] Network interface "eth0" state changed: up
2024-11-28 14:44:42.746798 [info] Route "default route (0.0.0.0/0) if: eth0 gw: 192.168.225.1" state changed: up
2024-11-28 14:44:42.748222 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30490
2024-11-28 14:44:42.748774 [debug] Joining to multicast group 224.0.0.1 from 192.168.225.3
2024-11-28 14:44:42.750352 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30509
2024-11-28 14:44:42.750775 [info] SOME/IP routing ready.
2024-11-28 14:44:42.750875 [info] udp_server_endpoint_impl<multicast>: SO_RCVBUF is: 212992 (1703936) local port:30490
2024-11-28 14:44:42.752166 [warning] Route "224.0.0.1/32 if: eth0 gw: n/a" state changed: up
2024-11-28 14:44:43.334512 [error] routing_manager_impl::add_routing_info: rejecting routing info. Remote: 192.168.225.2 is trying to offer [1234.5678.18.878082192] on port 12344 offered previously on this node: [1234.5678.10.0]
Setting event (Length=2).
Setting event (Length=3).
2024-11-28 14:44:45.339291 [error] routing_manager_impl::add_routing_info: rejecting routing info. Remote: 192.168.225.2 is trying to offer [1234.5678.18.878082192] on port 12344 offered previously on this node: [1234.5678.10.0]
Setting event (Length=4).
Setting event (Length=5).
2024-11-28 14:44:47.349538 [error] routing_manager_impl::add_routing_info: rejecting routing info. Remote: 192.168.225.2 is trying to offer [1234.5678.18.878082192] on port 12344 offered previously on this node: [1234.5678.10.0]
Setting event (Length=6).
Setting event (Length=7).
2024-11-28 14:44:49.357992 [error] routing_manager_impl::add_routing_info: rejecting routing info. Remote: 192.168.225.2 is trying to offer [1234.5678.18.878082192] on port 12344 offered previously on this node: [1234.5678.10.0]
Setting event (Length=8).
Setting event (Length=9).
2024-11-28 14:44:51.367642 [error] routing_manager_impl::add_routing_info: rejecting routing info. Remote: 192.168.225.2 is trying to offer [1234.5678.18.878082192] on port 12344 offered previously on this node: [1234.5678.10.0]
Setting event (Length=1).
2024-11-28 14:44:52.746252 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:44:52.748212 [info] STOP OFFER(1277): [1234.5678:10.0] (true)
2024-11-28 14:44:53.376311 [warning] process_offerservice_serviceentry: Remote offer type changed [1234.5678]
2024-11-28 14:45:02.748736 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:45:02.763922 [info] rm_base::offer_service !its_info->is_local (1277): [1234.5678:18:878082192] passed: 10:0
2024-11-28 14:45:02.764833 [error] routing_manager_impl::handle_local_offer_service: rejecting service registration. Application: 1277 is trying to offer [1234.5678.10.0]] already offered remotely
2024-11-28 14:45:02.765169 [info] offer_service (1277): [1234.5678:10.0] (true) not offering, returned from handle_local_offer_service!
Setting event (Length=2).
Setting event (Length=3).
Setting event (Length=4).
Setting event (Length=5).
Setting event (Length=6).
Setting event (Length=7).
Setting event (Length=8).
Setting event (Length=9).
Setting event (Length=1).
Setting event (Length=2).
2024-11-28 14:45:12.752146 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:45:12.778179 [info] STOP OFFER(1277): [1234.5678:10.0] (true)
2024-11-28 14:45:12.779683 [warning] stop_offer_service received STOP_OFFER(1277): [1234.5678:10.0] for remote service --> ignore
2024-11-28 14:45:22.755800 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:45:22.794124 [info] rm_base::offer_service !its_info->is_local (1277): [1234.5678:18:878082192] passed: 10:0
2024-11-28 14:45:22.795834 [error] routing_manager_impl::handle_local_offer_service: rejecting service registration. Application: 1277 is trying to offer [1234.5678.10.0]] already offered remotely
2024-11-28 14:45:22.796629 [info] offer_service (1277): [1234.5678:10.0] (true) not offering, returned from handle_local_offer_service!
Setting event (Length=3).
Setting event (Length=4).
Setting event (Length=5).
Setting event (Length=6).
Setting event (Length=7).
Setting event (Length=8).
Setting event (Length=9).
Setting event (Length=1).
Setting event (Length=2).
Setting event (Length=3).
2024-11-28 14:45:32.758869 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:45:32.809674 [info] STOP OFFER(1277): [1234.5678:10.0] (true)
2024-11-28 14:45:32.810830 [warning] stop_offer_service received STOP_OFFER(1277): [1234.5678:10.0] for remote service --> ignore
2024-11-28 14:45:42.762672 [info] vSomeIP 3.4.10 | (default)
2024-11-28 14:45:42.825814 [info] rm_base::offer_service !its_info->is_local (1277): [1234.5678:18:878082192] passed: 10:0
2024-11-28 14:45:42.831568 [error] routing_manager_impl::handle_local_offer_service: rejecting service registration. Application: 1277 is trying to offer [1234.5678.10.0]] already offered remotely
2024-11-28 14:45:42.832564 [info] offer_service (1277): [1234.5678:10.0] (true) not offering, returned from handle_local_offer_service!

@KareemLMR
Copy link

Ok, I see the log you added appeared. That's good. I saw what I wanted to see. Let me try a change at my side and send it to you to try when it is successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants