vsomeip: [BUG]: Communication is not happening between AWS EC2 instances, stuck at find and offer packets stage only.
vSomeip Version
v3.5.1
Boost Version
1.74
Environment
Ubuntu 22.04, x86, AWS instance
Describe the bug
Following vSOMEIP in 10 minutes, to establish communication between two AWS EC2 instances.
Find and offer packets are both visible at client interface, but next step of the communication three-way handshake is not happening. Nor in the client logs SERVICE Available is visible.
Also things that I did -
- Used this command to add multicast address to kernel routing table. on both sides - route add -nv <multicast-address> dev <interface>
- Added Multicast address to the Same multicast domain, in which two instances are lying on AWS console.
- Multicast offer packets are visible at client side, this proves multicasting is correct.
- Inbound and Outbound rules allow all IPv4 packets from all port range.
I have provided Client logs, Server logs, Client.json, Server.json, both src code and also packet capture.
Client IP is 172.31.88.228 and Server IP is 172.31.26.247. (Please check in pcap only offer and find packets from these IPs)
Client Log : 2024-10-30 07:17:47.299023 client [info] Using configuration file: “…/client.json”. 2024-10-30 07:17:47.299474 client [info] Parsed vsomeip configuration in 0ms 2024-10-30 07:17:47.299539 client [info] Configuration module loaded. 2024-10-30 07:17:47.299582 client [info] Security disabled! 2024-10-30 07:17:47.299713 client [info] Initializing vsomeip (3.5.1) application “client”. 2024-10-30 07:17:47.299856 client [info] Instantiating routing manager [Host]. 2024-10-30 07:17:47.300890 client [info] create_routing_root: Routing root @ /tmp/vsomeip-0 2024-10-30 07:17:47.301365 client [info] Service Discovery enabled. Trying to load module. 2024-10-30 07:17:47.302839 client [info] Service Discovery module loaded. 2024-10-30 07:17:47.303158 client [info] Application(client, 1313) is initialized (11, 100). 2024-10-30 07:17:47.303280 client [info] REQUEST(1313): [1965.1771:1.1] 2024-10-30 07:17:47.303731 client [info] create_local_server: Listening @ /tmp/vsomeip-1313 2024-10-30 07:17:47.303893 client [info] Starting vsomeip application “client” (1313) using 2 threads I/O nice 0 2024-10-30 07:17:47.304307 client [debug] Thread created. Number of active threads for client : 1 2024-10-30 07:17:47.304652 client [info] Client [1313] routes unicast:172.31.88.228, netmask:255.255.240.0 2024-10-30 07:17:47.304611 client [info] main dispatch thread id from application: 1313 (client) is: 79fb6e200640 TID: 4167 Service [1965.1771] is NOT available. 2024-10-30 07:17:47.305551 client [info] shutdown thread id from application: 1313 (client) is: 79fb6d800640 TID: 4168 2024-10-30 07:17:47.305903 client [info] Watchdog is disabled! 2024-10-30 07:17:47.306281 client [info] io thread id from application: 1313 (client) is: 79fb6f91ab80 TID: 4165 2024-10-30 07:17:47.306899 client [info] Network interface “eth0” state changed: up 2024-10-30 07:17:47.307233 client [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:17:47.307409 client [info] Route “default route (0.0.0.0/0) if: eth0 gw: 172.31.80.1” state changed: up 2024-10-30 07:17:47.311367 client [debug] Joining to multicast group 224.244.224.245 from 172.31.88.228 2024-10-30 07:17:47.311535 client [info] SOME/IP routing ready. 2024-10-30 07:17:47.311787 client [warning] Route “224.244.224.245/32 if: eth0 gw: n/a” state changed: up 2024-10-30 07:17:47.312219 client [info] io thread id from application: 1313 (client) is: 79fb67e00640 TID: 4170 2024-10-30 07:17:47.312834 client [info] udp_server_endpoint_impl<multicast>: SO_RCVBUF is: 212992 (1703936) local port:30491 2024-10-30 07:17:57.310545 client [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:18:07.311756 client [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:18:17.313237 client [info] vSomeIP 3.5.1 | (default)
Server Logs: (I edited some logging statements)
2024-10-30 07:18:18.410431 server [info] Using configuration file: “/home/ubuntu/vsomeip_server_minimal/server.json”. 2024-10-30 07:18:18.410869 server [info] Parsed vsomeip configuration in 0ms 2024-10-30 07:18:18.410931 server [info] Configuration module loaded. 2024-10-30 07:18:18.411008 server [info] Security disabled! 2024-10-30 07:18:18.411039 server [info] Initializing vsomeip (3.5.1) application “server”. 2024-10-30 07:18:18.411332 server [info] Instantiating routing manager [Host]. 2024-10-30 07:18:18.412252 server [info] create_routing_root: Routing root @ /tmp/vsomeip-0 2024-10-30 07:18:18.413021 server [info] Service Discovery enabled. Trying to load module. 2024-10-30 07:18:18.414867 server [info] Service Discovery module loaded. 2024-10-30 07:18:18.415201 server [info] Application(server, 1212) is initialized (11, 100). 2024-10-30 07:18:18.415788 server [info] create_local_server: Listening @ /tmp/vsomeip-1212 2024-10-30 07:18:18.416007 server [info] OFFER(1212): [1965.1771:1.1] (true) 2024-10-30 07:18:18.416072 server [info] Starting vsomeip application “server” (1212) using 2 threads I/O nice 0 2024-10-30 07:18:18.416404 server [debug] Thread created. Number of active threads for server : 1 2024-10-30 07:18:18.416793 server [info] Client [1212] routes unicast:172.31.26.247, netmask:255.255.240.0 2024-10-30 07:18:18.417170 server [info] main dispatch thread id from application: 1212 (server) is: 7b81b62006c0 TID: 4709 2024-10-30 07:18:18.417881 server [info] Watchdog is disabled! 2024-10-30 07:18:18.417456 server [info] shutdown thread id from application: 1212 (server) is: 7b81b58006c0 TID: 4710 2024-10-30 07:18:18.418874 server [info] io thread id from application: 1212 (server) is: 7b81b79a0b80 TID: 4707 2024-10-30 07:18:18.419116 server [info] io thread id from application: 1212 (server) is: 7b81a7e006c0 TID: 4712 2024-10-30 07:18:18.422682 server [info] Network interface “enX0” state changed: up 2024-10-30 07:18:18.419497 server [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:18:18.423133 server [info] Route “default route (0.0.0.0/0) if: enX0 gw: 172.31.16.1” state changed: up 2024-10-30 07:18:18.423646 server [debug] Joining to multicast group 224.244.224.245 from 172.31.26.247 2024-10-30 07:18:18.424200 server [info] SOME/IP routing ready. 2024-10-30 07:18:18.424486 server [warning] Route “224.244.224.245/32 if: enX0 gw: n/a” state changed: up 2024-10-30 07:18:18.424043 server [info] Hey udp_server_endpoint_implementation called first time 2024-10-30 07:18:18.425452 server [info] Hey udp_server_endpoint function called 2024-10-30 07:18:18.426019 server [info] udp_server_endpoint_impl<multicast>: SO_RCVBUF is: 212992 (1703936) local port:30491 2024-10-30 07:18:28.424212 server [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:18:38.425042 server [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:18:48.427056 server [info] vSomeIP 3.5.1 | (default) 2024-10-30 07:18:58.427942 server [info] vSomeIP 3.5.1 | (default)
Client JSON :
{
"unicast" : "172.31.88.228",
"netmask" : "255.255.240.0",
"logging" :
{
"level" : "debug",
"console" : "true",
"file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
"dlt" : "false"
},
"applications" :
[
{
"name" : "client",
"id" : "0x1313"
}
],
"routing" : "client",
"service-discovery" :
{
"enable" : "true",
"multicast" : "224.244.224.245",
"port" : "30491",
"protocol" : "udp",
"initial_delay_min" : "10",
"initial_delay_max" : "100",
"repetitions_base_delay" : "200",
"repetitions_max" : "3",
"ttl" : "3",
"cyclic_offer_delay" : "2000",
"request_response_delay" : "1500"
}
}
Server JSON :
{
"unicast" : "172.31.26.247",
"netmask" : "255.255.240.0",
"logging" :
{
"level" : "debug",
"console" : "true",
"file" : { "enable" : "false", "path" : "/tmp/vsomeip_server.log" },
"dlt" : "false"
},
"applications" :
[
{
"name" : "server",
"id" : "0x1212"
}
],
"services" :
[
{
"service" : "0x1965",
"instance" : "0x1771",
"unreliable" : "30509"
}
],
"routing" : "server",
"service-discovery" :
{
"enable" : "true",
"multicast" : "224.244.224.245",
"port" : "30491",
"protocol" : "udp",
"initial_delay_min" : "10",
"initial_delay_max" : "100",
"repetitions_base_delay" : "200",
"repetitions_max" : "3",
"ttl" : "3",
"cyclic_offer_delay" : "2000",
"request_response_delay" : "1500"
}
}
Client Code :
#include <iomanip>
#include <iostream>
#include <sstream>
#include <condition_variable>
#include <thread>
#include <chrono>
#include <unistd.h>
#include <vsomeip/vsomeip.hpp>
#define SAMPLE_SERVICE_ID 0x1965
#define SAMPLE_INSTANCE_ID 0x1771
std::shared_ptr<vsomeip::application> app;
void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::cout << "Service ["
<< std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
<< "] is " << (_is_available ? "available." : "NOT available.") << std::endl;
}
int main()
{
app = vsomeip::runtime::get()->create_application("client");
app->init();
app->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, on_availability);
app->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, 1, 1);
app->start();
}
Server Code :
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vsomeip/vsomeip.hpp>
#define SAMPLE_SERVICE_ID 0x1965
#define SAMPLE_INSTANCE_ID 0x1771
std::shared_ptr<vsomeip::application> app;
int main() {
app = vsomeip::runtime::get()->create_application("server");
app->init();
app->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, 1, 1); // only offers service, not events.
app->start();
}
Reproduction Steps
Use the code and JSON files with your IPs to reproduce the same behavior on AWS EC2 instance.
Expected behaviour
Three-way handshake should happen with SOME/IP packets visible.
Logs and Screenshots
Already attached.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17
Thanks @KareemLMR ,
Second Solution worked, we had to keep netmask more open, you pointed this in the first comment itself. 👍
That’s a good result, we know now the issue is is_same_subnet() function is returning false for this vsomeip rejects the multicast messages and refused to call on_message of the SD. When I was looking at the vsomeip code one of my expectations was that is_same_subnet() would return false as I am still concerned about the subnet mask of your IPs, I just thought they only will affect unicast packets but it seems the code also complain in multicast packets by the way it is related to the netmask of your IP itself not the json node netmask in vsomeip conf file as even if you removed it the default is 255.255.255.0 which of course won’t work in your case. For this I always choose IPs with only the last octet changed but anyway here is my thoughts about the solution of the issue:
First solution is to change server and client IPs to be just the same except for the last octet, if this is possible in your project
Second solution is to change the subnet mask both in network config and json file to be more open to hosts, something like 255.255.0.0, if possible in your project
Third solution you can try, although I don’t know how but you said in your client examples that both multicast and unicast packets reach app layer by your current network configs so I think maybe just for testing you can remove the check for is_same_subnet() from the code and try to see if your client will see the server, but keep the logs you added as they maybe useful if it didn’t work as it may complain somewhere else about subnet mask or anything related
You can start by number 3 as I think it would be the easiest to check that it is the root cause and the only issue. If so we can think what to change in network config to make it work.
So try removing check of is_same_subnet() and tell me the result first.
Ok that’s great. Good that you push everything. Try these changes and tell me the result.
Hello @aadarshkt, There is a way yes to check. You can add logs to these functions:
Inside implementation/endpoints/src: you have this function:
Add logs here to determine whether it registers callback for multicast messages or not. This is the endpoint of the vsomeip so this can tell us what happens exactly when we receive the multicast packet or if we don’t receive at all.
Inside the callback function on_multicast_received in the same file:
Inside the packet processing function on_message_received in the same file uncomment the #if 0 endif same as what we did with SD to log all packets received:
Finally inside implementation/routing/src uncomment #if 0 endif in this function:
It is the one that calls service_discovery module to parse SD messages where we tried to log before.