COVESA / vsomeip

An implementation of Scalable service-Oriented MiddlewarE over IP
Mozilla Public License 2.0
1.01k stars 647 forks source link

[BUG]: <Incorrect behavior in udp_server_endpoint_impl::on_multicast_received causing premature service deletion due to TTL update> #682

Open pomforandroid opened 3 weeks ago

pomforandroid commented 3 weeks ago

vSomeip Version

v3.1.20

Boost Version

1.72

Environment

Android

Describe the bug

Description: I have observed an issue in the udp_server_endpoint_impl::on_multicast_received function that is leading to premature service deletion on Android clients communicating with QNX servers. Despite both client and server having the same IP address (192.168.1.3), the condition if (multicastremote.address() != local_.address()) is evaluating to true, causing unexpected behavior.

Problem Overview:

After successfully establishing communication and adding a route with ip route add 239.127.3.1 via 192.168.1.3 , the service instance ends up being deleted after the TTL expiration, triggered by routing_manager_impl::update_routing_info setting the TTL to 0. The on_message_received function within udp_server_endpoint_impl::on_multicast_received is responsible for updating the TTL value to 3, preventing the connection from being severed.

Suspected Bug:

The comparison multicastremote.address() != local_.address() seems to be returning true on the Android client, where both multicastremote and local_ addresses are 192.168.1.3, leading to unexpected service deletion. Additionally, the client's routing is set to client-dvr, which may be contributing to the issue, "routing" : "client-dvr",

Proposed Solution:

It is recommended to review and debug the logic within the udp_server_endpoint_impl::on_multicast_received function to identify and rectify the root cause of the incorrect evaluation. Reproduction Steps:

Establish communication between Android client and QNX server with identical IP addresses. Add route using ip route add 239.127.3.1 via 192.168.1.3 . Observe premature service deletion after TTL expiration. Additional Information:

Both client and server configurations in vsomeip.json have enable: true for service discovery with multicast address 239.127.3.1 and port 30490. "service-discovery" : { "enable" : "true", "multicast" : "239.127.3.1", "port" : "30490", "protocol" : "udp", "initial_delay_min" : "10", "initial_delay_max" : "50", "repetitions_base_delay" : "50", "repetitions_max" : "3", "ttl" : "3", "cyclic_offer_delay" : "2000", "request_response_delay" : "1500" } Issue occurs after TTL expiration, resulting in the deletion of the service instance. Any insights or guidance on resolving this issue would be greatly appreciated

Reproduction Steps

No response

Expected behaviour

No response

Logs and Screenshots

04-14 17:02:29.895 8739 8739 D fabletest: vsomeipBaseDir: /data/user/0/com.demo.soalib/cache/vsomeip 04-14 17:02:29.895 8739 8739 D fabletest: Os.getenv("VSOMEIP_BASE_PATH"): /data/user/0/com.demo.soalib/cache/vsomeip/ 04-14 17:02:29.895 8739 8739 D fabletest: Os.getenv("VSOMEIP_CONFIGURATION"): /data/user/0/com.demo.soalib/cache/vsomeip/vsomeip.json 04-14 17:02:29.895 8739 8739 D fabletest: Os.getenv("COMMONAPI_CONFIG"): /data/user/0/com.demo.soalib/cache/vsomeip/commonapi.ini 04-14 17:02:29.908 8739 8767 V DvrServiceClientManagerJNI: SAVE GLOBAL JVM OK ... 04-14 17:02:29.912 8739 8767 I om.demo.soali: Parsed vsomeip configuration in 2ms 04-14 17:02:29.912 8739 8767 I om.demo.soali: Using configuration file: "/data/user/0/com.demo.soalib/cache/vsomeip/vsomeip.json". 04-14 17:02:29.912 8739 8767 I om.demo.soali: Configuration module loaded. 04-14 17:02:29.912 8739 8767 I om.demo.soali: Initializing vsomeip application "client-dvr". 04-14 17:02:29.912 8739 8767 I om.demo.soali: Instantiating routing manager [Host]. 04-14 17:02:29.912 8739 8767 I om.demo.soali: create_local_server Routing endpoint at /data/user/0/com.demo.soalib/cache/vsomeip/vsomeip-0 04-14 17:02:29.912 8739 8767 I om.demo.soali: Service Discovery enabled. Trying to load module. 04-14 17:02:29.912 8739 8767 I om.demo.soali: Service Discovery module loaded. 04-14 17:02:29.913 8739 8767 I om.demo.soali: Application(client-dvr, 1343) is initialized (11, 100). 04-14 17:02:29.913 8739 8770 I om.demo.soali: Starting vsomeip application "client-dvr" (1343) using 2 threads I/O nice 255 04-14 17:02:29.913 8739 8767 I om.demo.soali: REGISTER EVENT(1343): [0004.0002.8015:is_provider=false] 04-14 17:02:29.913 8739 8767 I om.demo.soali: REGISTER EVENT(1343): [0004.0002.8016:is_provider=false] 04-14 17:02:29.913 8739 8767 I om.demo.soali: REGISTER EVENT(1343): [0004.0002.8017:is_provider=false] 04-14 17:02:29.913 8739 8771 I om.demo.soali: main dispatch thread id from application: 1343 (client-dvr) is: 6f457cecb0 TID: 8771 04-14 17:02:29.913 8739 8772 I om.demo.soali: shutdown thread id from application: 1343 (client-dvr) is: 6f456d0cb0 TID: 8772 04-14 17:02:29.913 8739 8767 I om.demo.soali: REGISTER EVENT(1343): [0004.0002.8018:is_provider=false] 04-14 17:02:29.913 8739 8767 I om.demo.soali: REGISTER EVENT(1343): [0004.0002.8019:is_provider=false] 04-14 17:02:29.913 8739 8767 I om.demo.soali: REGISTER EVENT(1343): [0004.0002.801a:is_provider=false] 04-14 17:02:29.913 8739 8767 I om.demo.soali: REQUEST(1343): [0004.0002:2.4294967295] 04-14 17:02:29.913 8739 8767 I om.demo.soali: Listening at /data/user/0/com.demo.soalib/cache/vsomeip/vsomeip-1343 04-14 17:02:29.914 8739 8767 I fabletest: buildProxy dvr success! 04-14 17:02:29.914 8739 8767 V DvrServiceClientManagerJNI: check available ... 04-14 17:02:29.914 8739 8767 I fabletest: dvr manager.isAvailable false 04-14 17:02:29.914 8739 8770 I om.demo.soali: Watchdog is disabled! 04-14 17:02:29.914 8739 8770 I om.demo.soali: io thread id from application: 1343 (client-dvr) is: 6f458cccb0 TID: 8770 04-14 17:02:29.914 8739 8774 I om.demo.soali: io thread id from application: 1343 (client-dvr) is: 6f45442cb0 TID: 8774 04-14 17:02:29.914 8739 8770 I om.demo.soali: vSomeIP 3.1.20.2 | (default) 04-14 17:02:29.915 8739 8774 I om.demo.soali: Network interface "eth0" state changed: up 04-14 17:02:29.915 8739 8770 I om.demo.soali: Route "239.127.3.1/32 if: eth0 gw: 192.168.1.3" state changed: up 04-14 17:02:29.916 8739 8770 I om.demo.soali: udp_server_endpoint_impl: SO_RCVBUF is: 1703936 04-14 17:02:29.916 8739 8770 I om.demo.soali: udp_server_endpoint_impl: SO_RCVBUF (Multicast) is: 1703936 04-14 17:02:29.916 8739 8770 I om.demo.soali: SOME/IP routing ready. 04-14 17:02:29.947 8739 8774 I om.demo.soali: udp_client_endpoint_impl::connect: SO_RCVBUF is: 1703936 04-14 17:02:29.979 8739 8739 W om.demo.soali: Class androidx.compose.runtime.snapshots.SnapshotStateMap failed lock verification and will run slower. 04-14 17:02:29.979 8739 8739 W om.demo.soali: Common causes for lock verification issues are non-optimized dex code 04-14 17:02:29.979 8739 8739 W om.demo.soali: and incorrect proguard optimizations. 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: QUALCOMM build : 99c7ee0f15, I459d0023eb 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Build Date : 07/20/22 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: OpenGL ES Shader Compiler Version: EV031.36.00.01 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Local Branch : 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Remote Branch : 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Remote Branch : 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Reconstruct Branch : 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Build Config : S P 10.0.7 AArch64 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so 04-14 17:02:30.048 8739 8764 I AdrenoGLES-0: Driver Version : 0582.0 04-14 17:02:30.054 8739 8764 I AdrenoGLES-0: PFP: 0x00000000, ME: 0x00000000 04-14 17:02:30.056 8739 8764 I Adreno-GSL_RPC: : ctxt_id 121, sync_type 1 04-14 17:02:30.059 8739 8764 W AdrenoUtils: : Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model 04-14 17:02:30.059 8739 8764 I AdrenoUtils: : Reading chip ID through GSL 04-14 17:02:30.061 8739 8764 I Adreno-GSL_RPC: : ctxt_id 122, sync_type 1 04-14 17:02:30.066 8739 8781 E ion : ioctl c0044901 failed with code -1: Inappropriate ioctl for device 04-14 17:02:30.066 8739 8781 I DMABUFHEAPS: Using : Non-legacy ION heaps 04-14 17:02:31.754 8739 8751 W System : A resource failed to call close. 04-14 17:02:32.914 8739 8767 V DvrServiceClientManagerJNI: check available ... 04-14 17:02:32.914 8739 8767 I om.demo.soali: SUBSCRIBE(1343): [0004.0002.03e9:8015:2] 04-14 17:02:32.914 8739 8767 V DvrServiceClientManagerJNI: check available ... 04-14 17:02:32.916 8739 8771 I fabletest: onError! 0 04-14 17:02:33.915 8739 8767 I fabletest: requestLoopRecordStateACK! 04-14 17:02:33.915 8739 8767 V DvrServiceClientManagerJNI: check available ... 04-14 17:02:33.918 8739 8770 I om.demo.soali: update_routing_info: elapsed=1000 : delete service/instance 0004.0002 04-14 17:02:33.921 8739 8774 I om.demo.soali: udp_client_endpoint_impl::connect: SO_RCVBUF is: 1703936