Skip to content

build: simplify change of C++ version in CMakeLists.txt#1000

Open
JochenHiller wants to merge 28 commits intoCOVESA:masterfrom
JochenHiller:enhanceChangeCppVersion
Open

build: simplify change of C++ version in CMakeLists.txt#1000
JochenHiller wants to merge 28 commits intoCOVESA:masterfrom
JochenHiller:enhanceChangeCppVersion

Conversation

@JochenHiller
Copy link

Preparation for easy compiling with latest C++ standards.

This change does work with C++17, C++20 and C++23 with current toolchain from Dockerfile.
E.g. cmake -DVSOMEIP_CXX_STANDARD=23 . will compile against C++23 standard

Preparation for easy compiling with latest C++ standards.
This change does work with C++17, C++20 and C++23 with current toolchain from Dockerfile.
E.g. `cmake -DVSOMEIP_CXX_STANDARD=23 .` will compile against C++23 standard
…EIP_CXX_STANDARD

* QNX build: hard reference to C++17, use `VSOMEIP_CXX_STANDARD` instead
* tests will be compiled with C++20 since this [commit](COVESA@9ff1977#diff-33394812ba204689144fd2f80832db83853ba1cb32403edb4e15fe4893e675fd). Change will enforce to use C++20 when C++17 is specified in `VSOMEIP_CXX_STANDARD`
* internal_routing_disabled_acceptance_test: hard reference to C++17, use `VSOMEIP_CXX_STANDARD` instead
@JochenHiller
Copy link
Author

JochenHiller commented Jan 22, 2026

Updated PR: Change more build related references to C++ standard and changed them to use build variable VSOMEIP_CXX_STANDARD:

  • QNX build: hard reference to C++17, use VSOMEIP_CXX_STANDARD instead
  • tests will be compiled with C++20 since this commit. Change will enforce to use C++20 when C++17 is specified in VSOMEIP_CXX_STANDARD
  • internal_routing_disabled_acceptance_test: hard reference to C++17, use VSOMEIP_CXX_STANDARD instead

I did tests of compile and execute unit tests of these variants (using current toolchain in Dockerfile, gcc 11.4.0):

C++ Standard CMake call Compilation Unit Tests
default cmake . pass pass
17 cmake -DVSOMEIP_CXX_STANDARD=17 . pass pass
20 cmake -DVSOMEIP_CXX_STANDARD=20 . pass pass
23 cmake -DVSOMEIP_CXX_STANDARD=23 . pass pass

Question: Is it intended that tests are now compiled with C++20? If so, maybe documentation should be updated.

ricardolleite and others added 26 commits January 22, 2026 16:40
The scenario is:

there is a client, a server, and vsomeipd
client connects to server, does a SUBSCRIBE
server receives SUBSCRIBE, tries to connect to do
CONFIG_ID+SUB_ACK+initial value
client is unreachable for a bit (suppose: is in a guest)
server has to reconnect a few times
client should receive all of the above
Add application names
Cleanup .sh starter files
Add test documentation
Fix routing tests return codes and add documentation

Updated sleep times for external_local_routing_test_starter.sh and local_routing_test_starter.sh.
Fixed return codes.
Fixed memory leaks in usr/bin/* that are used in test scripts, but it should be fine to ignore as it does not impact
the functioning of the test.
Added documentation.
Consistency when existing test scripts
Consistency across test scripts
Most of tests are running with interpret as bash.
There is no plausible reason for this tests to run w/ sh.
Add include of utility. Drop unneeded include of asio/io_context.hpp
Document and fix test scripts for offer_test
Remove unnecessary sleeps, fixed some typos
In local communication, if a subscribe is sent to the service-provider,
but right before the subscription ack/nack is sent, the connection
service-provider -> service-consumer is removed, service-provider
detects and executes handle_client_error, however service-consumer
will not detect any connection problem and still be waiting for subscribe-ack.
What was happening is that right after replacing the old connection,
remove_connection was executed from ltsei::receive_cbk when detecting
an issue. This would then make the disconnect_from impossible to be executed
on the endpoint to the client, as no connection was present. The client would be
unaffected and not detect any problem keeping it in a "limbo" state.
By specifying the connection to remove, we can avoid removing a just-updated
connection and prevent this behavior.
Also made the connection's stop and destructor be executed outside of
connections_mutex_.
The local receiver is being created on demand, but this causes issues
with TCP communication, as it is the local receiver that defines the
port used for vsomeip_sec
Therefore it should be created unconditionally, all the time, at start
Introduce a thread-safe timer utility
This timer utility can be used to either run a job periodically, or as a one shot timer.
This utility is going to be used in upcoming work.
Meanwhile introduce the capability to tinker with these timers,
e.g. in fake_socket tests.
Note that this would first require the actual use of this utility.
It is a simple scenario, routingd-as-server. It makes sense, because
there is a different implementation for routing client vs routing host
If a user forgets to set the message type (so neither request, nor
response, nor notification...), the message will fail to arrive
anywhere, but often with a very cryptic error, such as:

rmi::send: Routing error. Endpoint for (...) could not be found!

This is too difficult to debug. Made it obvious!
It is important for local TCP communication that libvsomeip polls for
data acknowledgement before closing a connection with TCP RST, which is
why 1f18549 makes sense
However, it does not make sense to wait neither for data to be sent, nor
for data ACKs if a connection is closed due to an error
Therefore, change endpoints such that the "are we stopping due to an
error?" information is propagated up to the endpoint
This requires a change on all endpoints, but note that it only really
matters for local client endpoints - local server endpoints currently do
not send data (excluding ASSIGN_CLIENT), and boardnet endpoints do not
care about graceful shutdown
SonarQube IDE (along a few other things) rely on compile_commands.json,
so set the variable to create it.
For SonarQube:

Build project with "CMAKE_EXPORT_COMPILE_COMMANDS ON"
Install SonarQube for IDE extension
SonarQube should detect the new "compile_commands.json" present
in the build directory
Get SonarQube complaints and suggestions live on your IDE
Most of the network tests run shell scripts that run many different
executables, so need to instruct valgrind to produce a different log
file for each
The valgrind documentation recommends the same when using --log-file
and --trace-children=yes
Fix broken link from markdown to png asset.
subscribe_notify_test.png is subscribe_notify_test_one_tests.png for subscribe_notify_test_one_tests.md
Remove unused state (use_count_, opened_, local_mutex_); it is
used nowhere and makes endpoints considerably bigger
Furthermore, move magic cookie state to tcei/tsei, as this is exclusive
to TCP communication, and anyhow the endpoint manager knows it is
dealing with TCP endpoints due to the configuration lookups
This test covers two issues found in the start-stop-start process of an application.
Start-stop-start of a single application:
Prior to e8b6519, with local TCP communication, the following sequence would break a vsomeip application:
Scenario:

app->start();
app->stop();
app->start(); // application never registers to the daemon, nothing works

e8b6519 solved this problem.
Start-stop-start with two applications:
If a new application is started between the stop and the second start of the first application, the start of the
first application will fail. This happens because, since 'create_local_server' is not called in
routing_manager_client::start(), the server endpoint will be assigned, in 'create_local', to a memory port
that is already being used by application 2.
Scenario:

app1->start() - port 31493
app1->stop() - endpoints destroyed and ports released
app2->start() - port 31493
app1->start() - port 31493 because create_local_server is not called -> registration fails because the address
is already assigned

b9f8c84 solves the problem.
This change fixes an edge-case in the subscription mechanism
where the routing host was able to send multiple unsubscribe
requests to the service for the same subscription.
Additionally, it also improves the logging of subscription requests
between applications.
Fix
This edge-case is visible when a remote client is using inconsistent
Session IDs to subscribe to the service, triggering multiple reboot
detections on the host. The host then sends multiple unsubscribe
requests while the service is still busy processing the first one.
The fix involves simply checking if a subscription has already been
expired before sending another unsubscribe requests to the service.
Log
The change to the logs adds the subscription id to the subscription
related traces, such SUBSCRIBE, UNSUBSCRIBE, SUBSCRIBE_ACK etc.
This makes it easier to track the subscription as it bounces between
service, client and host.
For example:
SUBSCRIBE(0000): [0001.0001.0001:ffff:0] accepted. id=0002 subscribers=2
SUBSCRIBE ACK(0101): [0001.0001.0001.ffff] id=0002
Set the TCP_QUICKACK socket option
Since in our sockets the linger is set to 0,
upon socket close the tcp connections are
immediately destroyed
This is a problem in the
case that there are pending TCP ACKs to be sent for
that connection, where with the connection
being destroyed if any ACKs are not sent until then,
the ACK will never be sent and the other side never
receives it
To prevent this situation, set the option
TCP_QUICKACK in order for the ACKs to be sent
before the 100ms timer between calling the
shutdown_and_close to the socket and effectively
closing it
A possible race condition between the transition of a binded socket towards a connection oriented
UDP socket enables a scenario where packets can be dropped and a ICMP port unreachable sent back.
When the routing host processes an offer that is to be offered/subscribed exclusively on an UDP port,
the client endpoint is created, socket binded to local address and then it asynchronously starts the
connection oriented process (define remote address for endpoint), while doing it asynchronously, the
routing host sends the service availability to clients and might even receive their subscriptions and
send it to the remote partner via service discovery. This asynchronous behavior is considered to be
a possible root cause for the ICMP port unreachable message seen for the initial event being dropped
in
Other possible root causes for port unreachable are:

Port unavailable, socket not binded, do not believe is the scenario as the endpoint creation is
synchronous and previous to the availability.
Sender is not the remote address defined for the connection, also not the scenario here.

A fix is presented in this PR where the service availability is only sent to the clients when the
UDP sockets is considered "connected".
Climate test is updated as availability handler was called more than the expected number of times
as the offer was processed with the service not being requested but since an availability handler
was still registered and the client is the host, the handler was invoked with the
service state: AS_OFFERED.
Deliver service availability only after endpoint creation
set tcp quick ack
Fix remote subscription expiration
new network-test for start-stop-start application
endpoint: drop unused state
Update subscribe_notify_test_one_tests.md
zuul: catch all valgrind failures
build: enable CMAKE_EXPORT_COMPILE_COMMANDS
endpoint: no waiting when stopping due to error
app: fail early, fail fast for unknown messages
tests: add another fake_socket test
Introduce a thread-safe timer utility
rmi: create local receiver on start
fix race condition in connections_ map changes
Fix payload tests return codes
Fix/doc offer_test
Support compilation with gcc15
tests: updates shebang line to interpret as bash
Fix network_tests/routing_tests
Revert "IO threads exit mitigation "
Fix and document second_address tests
tests: add regression test
Preparation for easy compiling with latest C++ standards.
This change does work with C++17, C++20 and C++23 with current toolchain from Dockerfile.
E.g. `cmake -DVSOMEIP_CXX_STANDARD=23 .` will compile against C++23 standard
…EIP_CXX_STANDARD

* QNX build: hard reference to C++17, use `VSOMEIP_CXX_STANDARD` instead
* tests will be compiled with C++20 since this [commit](COVESA@9ff1977#diff-33394812ba204689144fd2f80832db83853ba1cb32403edb4e15fe4893e675fd). Change will enforce to use C++20 when C++17 is specified in `VSOMEIP_CXX_STANDARD`
* internal_routing_disabled_acceptance_test: hard reference to C++17, use `VSOMEIP_CXX_STANDARD` instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants