vsomeip icon indicating copy to clipboard operation
vsomeip copied to clipboard

[BUG]: Availability handler is not called again after release_service() and request_service()

Open zhaoxin39913 opened this issue 1 year ago • 2 comments

vSomeip Version

v3.4.10

Boost Version

1.7.6

Environment

Ubuntu 20.04

Describe the bug

Hi vsomeip team,

There is a critical issue during our customer integration test, and after a lot of log investigation and debugging we have confirmed the issue is because the available event is missing after release_service() and request_service().

In our reproduction test, there are two vsomeip apps running on two devices. Server app is always offering a service (eg. 0x238/0x1) continuously , client app then requests that service and registers availability handler. The first time the availability handler in the client app is triggered with "AVAILABLE=true" correctly. However next if client app calls release_service(0x238/0x1) and waits for 2-3 seconds, then calls requst_service(0x238/0x1) again, the availability handler is first triggered with "AVAILABLE=false" but the "AVAILABLE=true" is never triggered aftewards unless we restart the server app or client app, even we found the client socket is already established(confirmed via "netstat" command).

You can 100% reproduce the issue with below code logic(assume the server app is offering service (0x238/0x1) all the time):

#define SERVICE_ID 0x238
#define INSTANCE_ID 0x1

// Request service and register availability handler.
app->request_service(SERVICE_ID, INSTANCE_ID);
app->register_availability_handler(SERVICE_ID, INSTANCE_ID, availability_handler);

// Wait for a few seconds
std::this_thread::sleep_for(std::chrono::seconds(3));

// After AVAILABLE=true is triggered then call release_service(). 
app->unregister_availability_handler(SERVICE_ID, INSTANCE_ID);
app->release_service(SERVICE_ID, INSTANCE_ID);

// Wait for a few seconds
std::this_thread::sleep_for(std::chrono::seconds(3));

// Re-register the service
app->request_service(SERVICE_ID, INSTANCE_ID);
app->register_availability_handler(SERVICE_ID, INSTANCE_ID, availability_handler);

// Till here, the availability handler is triggered with "AVAILABLE=false", 
// but the "AVAILABLE=true" is never coming, unless we restart the server app or client app

Reproduction Steps

No response

Expected behaviour

No response

Logs and Screenshots

No response

zhaoxin39913 avatar Dec 30 '24 06:12 zhaoxin39913

Tested both availability handler types, which have the same issue.

typedef std::function< void (service_t, instance_t, bool) > availability_handler_t;
typedef std::function< void (service_t, instance_t, availability_state_e) > availability_state_handler_t;

zhaoxin39913 avatar Dec 30 '24 09:12 zhaoxin39913

Hi vsomeip experts:

I found several availability related fixes after v3.4.10 as below, could you tell me which have fixed my issue ?

https://github.com/COVESA/vsomeip/commit/7b8b53d2ffc8bf61293dd3ae4432e795cc3c54f8 https://github.com/COVESA/vsomeip/commit/19a558931703de00b7dd9045111d1d7d1e0a22fd https://github.com/COVESA/vsomeip/commit/6a48b2a88e2f66304ef6cef470e5127a17fd2776

zhaoxin39913 avatar Apr 29 '25 04:04 zhaoxin39913