From 1a230558936ec84b4fb44b2346dc5ae52d6f2805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gehring?= Date: Mon, 12 Dec 2016 03:59:58 -0800 Subject: vSomeIP 2.5.2 --- CHANGES | 6 + CMakeLists.txt | 2 +- .../configuration/src/configuration_impl.cpp | 22 +- .../endpoints/src/local_client_endpoint_impl.cpp | 1 + .../routing/include/routing_manager_impl.hpp | 1 + .../routing/include/routing_manager_proxy.hpp | 11 +- implementation/routing/include/serviceinfo.hpp | 4 + .../routing/src/routing_manager_impl.cpp | 303 ++++++++++++--------- .../routing/src/routing_manager_proxy.cpp | 40 +-- .../routing/src/routing_manager_stub.cpp | 50 ++-- implementation/routing/src/serviceinfo.cpp | 7 + .../runtime/include/application_impl.hpp | 1 + implementation/runtime/src/application_impl.cpp | 16 +- .../include/service_discovery_impl.hpp | 5 +- .../src/service_discovery_impl.cpp | 24 +- test/CMakeLists.txt | 100 +++---- .../big_payload_test_tcp_client_random.json.in | 3 +- .../big_payload_test_tcp_service_random.json.in | 3 +- .../subscribe_notify_one_test_service.cpp | 2 - 19 files changed, 328 insertions(+), 273 deletions(-) diff --git a/CHANGES b/CHANGES index 307f64c..8677cfd 100644 --- a/CHANGES +++ b/CHANGES @@ -260,3 +260,9 @@ v2.5.1 - Made number of internal threads per application configurable. - Postpone notify_one events sent from subscription handler to ensure correct message order on receiver side. + +v2.5.2 +- Fixed deadlock and crashes +- Prevent race of initial attributes +- Allow incomplete application configurations +- Unit test timeouts increased to avoid failures on (slow) build servers diff --git a/CMakeLists.txt b/CMakeLists.txt index efdd3b4..1b596e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project (vsomeip) set (VSOMEIP_MAJOR_VERSION 2) set (VSOMEIP_MINOR_VERSION 5) -set (VSOMEIP_PATCH_VERSION 1) +set (VSOMEIP_PATCH_VERSION 2) set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION}) set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentatin/doxygen.in set (CMAKE_VERBOSE_MAKEFILE off) diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp index 3c8d90b..f14589c 100644 --- a/implementation/configuration/src/configuration_impl.cpp +++ b/implementation/configuration/src/configuration_impl.cpp @@ -474,16 +474,20 @@ void configuration_impl::load_application_data( } if (its_name != "") { if (applications_.find(its_name) == applications_.end()) { - if (!is_configured_client_id(its_id)) { - applications_[its_name] - = std::make_tuple(its_id, its_max_dispatchers, - its_max_dispatch_time, its_io_thread_count); - client_identifiers_.insert(its_id); - } else { - VSOMEIP_WARNING << "Multiple configurations for application " - << its_name << ". Ignoring a configuration from " - << _file_name; + if (its_id > 0) { + if (!is_configured_client_id(its_id)) { + client_identifiers_.insert(its_id); + } else { + VSOMEIP_ERROR << "Multiple applications are configured to use" + << " client identifier " << std::hex << its_id + << ". Ignoring the configuration for application " + << its_name; + its_id = 0; + } } + applications_[its_name] + = std::make_tuple(its_id, its_max_dispatchers, + its_max_dispatch_time, its_io_thread_count); } else { VSOMEIP_WARNING << "Multiple configurations for application " << its_name << ". Ignoring a configuration from " diff --git a/implementation/endpoints/src/local_client_endpoint_impl.cpp b/implementation/endpoints/src/local_client_endpoint_impl.cpp index 1466ac0..53dfc9d 100644 --- a/implementation/endpoints/src/local_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_client_endpoint_impl.cpp @@ -146,6 +146,7 @@ void local_client_endpoint_impl::receive_cbk( if (_error == boost::asio::error::operation_aborted) { // endpoint was stopped shutdown_and_close_socket(); + return; } else if (_error == boost::asio::error::connection_reset || _error == boost::asio::error::eof || _error == boost::asio::error::bad_descriptor) { diff --git a/implementation/routing/include/routing_manager_impl.hpp b/implementation/routing/include/routing_manager_impl.hpp index 2671566..6e6bd45 100644 --- a/implementation/routing/include/routing_manager_impl.hpp +++ b/implementation/routing/include/routing_manager_impl.hpp @@ -348,6 +348,7 @@ private: std::map> used_client_ports_; std::mutex used_client_ports_mutex_; + std::mutex version_log_timer_mutex_; boost::asio::steady_timer version_log_timer_; bool if_state_running_; diff --git a/implementation/routing/include/routing_manager_proxy.hpp b/implementation/routing/include/routing_manager_proxy.hpp index b3ae769..37ec8b5 100644 --- a/implementation/routing/include/routing_manager_proxy.hpp +++ b/implementation/routing/include/routing_manager_proxy.hpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -76,9 +77,6 @@ public: instance_t _instance, event_t _event, bool _is_provided); - void notify(service_t _service, instance_t _instance, event_t _event, - std::shared_ptr _payload, bool _force, bool _flush); - void on_connect(std::shared_ptr _endpoint); void on_disconnect(std::shared_ptr _endpoint); void on_message(const byte_t *_data, length_t _length, endpoint *_receiver, @@ -165,7 +163,7 @@ private: }; bool is_connected_; - bool is_started_; + std::atomic is_started_; inner_state_type_e state_; std::shared_ptr sender_; // --> stub @@ -212,11 +210,6 @@ private: std::map> pending_ingoing_subscripitons_; std::mutex pending_ingoing_subscripitons_mutex_; - std::map > > > pending_notifications_; - std::mutex deserialize_mutex_; std::mutex state_mutex_; diff --git a/implementation/routing/include/serviceinfo.hpp b/implementation/routing/include/serviceinfo.hpp index 4a8a69a..c890435 100644 --- a/implementation/routing/include/serviceinfo.hpp +++ b/implementation/routing/include/serviceinfo.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -55,11 +56,14 @@ private: major_version_t major_; minor_version_t minor_; + + mutable std::mutex ttl_mutex_; std::chrono::milliseconds ttl_; std::shared_ptr reliable_; std::shared_ptr unreliable_; + std::mutex requesters_mutex_; std::set requesters_; bool is_local_; diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp index c1daec7..00108a2 100644 --- a/implementation/routing/src/routing_manager_impl.cpp +++ b/implementation/routing/src/routing_manager_impl.cpp @@ -107,6 +107,7 @@ void routing_manager_impl::start() { host_->on_state(state_type_e::ST_REGISTERED); if (configuration_->log_version()) { + std::lock_guard its_lock(version_log_timer_mutex_); version_log_timer_.expires_from_now( std::chrono::seconds(0)); version_log_timer_.async_wait(std::bind(&routing_manager_impl::log_version_timer_cbk, @@ -121,7 +122,10 @@ void routing_manager_impl::start() { } void routing_manager_impl::stop() { - version_log_timer_.cancel(); + { + std::lock_guard its_lock(version_log_timer_mutex_); + version_log_timer_.cancel(); + } #ifndef WIN32 if (netlink_connector_) { netlink_connector_->stop(); @@ -425,10 +429,12 @@ void routing_manager_impl::subscribe(client_t _client, service_t _service, } } } - std::lock_guard ist_lock(pending_subscription_mutex_); - eventgroup_data_t subscription = { _service, _instance, _eventgroup, _major, - _subscription_type}; - pending_subscriptions_.insert(subscription); + { + std::lock_guard ist_lock(pending_subscription_mutex_); + eventgroup_data_t subscription = { _service, _instance, _eventgroup, _major, + _subscription_type}; + pending_subscriptions_.insert(subscription); + } } else { VSOMEIP_ERROR<< "SOME/IP eventgroups require SD to be enabled!"; } @@ -1621,11 +1627,14 @@ void routing_manager_impl::remove_local(client_t _client) { instance_t routing_manager_impl::find_instance(service_t _service, endpoint * _endpoint) { instance_t its_instance(0xFFFF); - auto found_service = service_instances_.find(_service); - if (found_service != service_instances_.end()) { - auto found_endpoint = found_service->second.find(_endpoint); - if (found_endpoint != found_service->second.end()) { - its_instance = found_endpoint->second; + { + std::lock_guard its_lock(endpoint_mutex_); + auto found_service = service_instances_.find(_service); + if (found_service != service_instances_.end()) { + auto found_endpoint = found_service->second.find(_endpoint); + if (found_endpoint != found_service->second.end()) { + its_instance = found_endpoint->second; + } } } return (its_instance); @@ -1849,48 +1858,51 @@ std::chrono::milliseconds routing_manager_impl::add_routing_info( bool is_reliable_known(false); bool is_unreliable_known(false); - auto found_service = remote_service_info_.find(_service); - if (found_service != remote_service_info_.end()) { - auto found_instance = found_service->second.find(_instance); - if (found_instance != found_service->second.end()) { - std::shared_ptr its_definition; - if (_reliable_port != ILLEGAL_PORT) { - auto found_reliable = found_instance->second.find(true); - if (found_reliable != found_instance->second.end()) { - its_definition = found_reliable->second; - if (its_definition->get_address() == _reliable_address - && its_definition->get_port() == _reliable_port) { - is_reliable_known = true; - } else { - VSOMEIP_WARNING << "Reliable service endpoint has changed: [" - << std::hex << std::setfill('0') << std::setw(4) << _service << "." - << std::hex << std::setfill('0') << std::setw(4) << _instance << "." - << std::dec << static_cast(_major) << "." - << std::dec << _minor << "] old: " - << its_definition->get_address().to_string() << ":" - << its_definition->get_port() << " new: " - << _reliable_address.to_string() << ":" - << _reliable_port; + { + std::lock_guard its_lock(endpoint_mutex_); + auto found_service = remote_service_info_.find(_service); + if (found_service != remote_service_info_.end()) { + auto found_instance = found_service->second.find(_instance); + if (found_instance != found_service->second.end()) { + std::shared_ptr its_definition; + if (_reliable_port != ILLEGAL_PORT) { + auto found_reliable = found_instance->second.find(true); + if (found_reliable != found_instance->second.end()) { + its_definition = found_reliable->second; + if (its_definition->get_address() == _reliable_address + && its_definition->get_port() == _reliable_port) { + is_reliable_known = true; + } else { + VSOMEIP_WARNING << "Reliable service endpoint has changed: [" + << std::hex << std::setfill('0') << std::setw(4) << _service << "." + << std::hex << std::setfill('0') << std::setw(4) << _instance << "." + << std::dec << static_cast(_major) << "." + << std::dec << _minor << "] old: " + << its_definition->get_address().to_string() << ":" + << its_definition->get_port() << " new: " + << _reliable_address.to_string() << ":" + << _reliable_port; + } } } - } - if (_unreliable_port != ILLEGAL_PORT) { - auto found_unreliable = found_instance->second.find(false); - if (found_unreliable != found_instance->second.end()) { - its_definition = found_unreliable->second; - if (its_definition->get_address() == _unreliable_address - && its_definition->get_port() == _unreliable_port) { - is_unreliable_known = true; - } else { - VSOMEIP_WARNING << "Unreliable service endpoint has changed: [" - << std::hex << std::setfill('0') << std::setw(4) << _service << "." - << std::hex << std::setfill('0') << std::setw(4) << _instance << "." - << std::dec << static_cast(_major) << "." - << std::dec << _minor << "] old: " - << its_definition->get_address().to_string() << ":" - << its_definition->get_port() << " new: " - << _unreliable_address.to_string() << ":" - << _unreliable_port; + if (_unreliable_port != ILLEGAL_PORT) { + auto found_unreliable = found_instance->second.find(false); + if (found_unreliable != found_instance->second.end()) { + its_definition = found_unreliable->second; + if (its_definition->get_address() == _unreliable_address + && its_definition->get_port() == _unreliable_port) { + is_unreliable_known = true; + } else { + VSOMEIP_WARNING << "Unreliable service endpoint has changed: [" + << std::hex << std::setfill('0') << std::setw(4) << _service << "." + << std::hex << std::setfill('0') << std::setw(4) << _instance << "." + << std::dec << static_cast(_major) << "." + << std::dec << _minor << "] old: " + << its_definition->get_address().to_string() << ":" + << its_definition->get_port() << " new: " + << _unreliable_address.to_string() << ":" + << _unreliable_port; + } } } } @@ -1901,7 +1913,10 @@ std::chrono::milliseconds routing_manager_impl::add_routing_info( if (_reliable_port != ILLEGAL_PORT && !is_reliable_known) { std::shared_ptr endpoint_def = endpoint_definition::get(_reliable_address, _reliable_port, true); - remote_service_info_[_service][_instance][true] = endpoint_def; + { + std::lock_guard its_lock(endpoint_mutex_); + remote_service_info_[_service][_instance][true] = endpoint_def; + } // check if service was requested and establish TCP connection if necessary { @@ -1933,14 +1948,15 @@ std::chrono::milliseconds routing_manager_impl::add_routing_info( } } } - - std::lock_guard its_lock(specific_endpoint_clients_mutex_); - auto found_service2 = specific_endpoint_clients_.find(_service); - if (found_service2 != specific_endpoint_clients_.end()) { - auto found_instance = found_service2->second.find(_instance); - if (found_instance != found_service2->second.end()) { - for (const client_t& c : found_instance->second) { - find_or_create_remote_client(_service, _instance, true, c); + { + std::lock_guard its_lock(specific_endpoint_clients_mutex_); + auto found_service2 = specific_endpoint_clients_.find(_service); + if (found_service2 != specific_endpoint_clients_.end()) { + auto found_instance = found_service2->second.find(_instance); + if (found_instance != found_service2->second.end()) { + for (const client_t& c : found_instance->second) { + find_or_create_remote_client(_service, _instance, true, c); + } } } } @@ -1984,7 +2000,10 @@ std::chrono::milliseconds routing_manager_impl::add_routing_info( if (_unreliable_port != ILLEGAL_PORT && !is_unreliable_known) { std::shared_ptr endpoint_def = endpoint_definition::get(_unreliable_address, _unreliable_port, false); - remote_service_info_[_service][_instance][false] = endpoint_def; + { + std::lock_guard its_lock(endpoint_mutex_); + remote_service_info_[_service][_instance][false] = endpoint_def; + } if (!is_reliable_known) { on_availability(_service, _instance, true, _major, _minor); stub_->on_offer_service(VSOMEIP_ROUTING_CLIENT, _service, _instance, _major, _minor); @@ -2066,7 +2085,7 @@ std::chrono::milliseconds routing_manager_impl::update_routing_info(std::chrono: for (auto &s : get_services()) { for (auto &i : s.second) { - if (find_local_client(s.first, i.first) != VSOMEIP_ROUTING_CLIENT) { + if (i.second->is_local()) { continue; //don't expire local services } ttl_t its_ttl = i.second->get_ttl(); @@ -2403,7 +2422,10 @@ void routing_manager_impl::on_subscribe_ack(service_t _service, std::shared_ptr its_endpoint = find_or_create_server_endpoint(_port, false, is_someip); if (its_endpoint) { - service_instances_[_service][its_endpoint.get()] = _instance; + { + std::lock_guard its_lock(endpoint_mutex_); + service_instances_[_service][its_endpoint.get()] = _instance; + } its_endpoint->join(_address.to_string()); } else { VSOMEIP_ERROR<<"Could not find/create multicast endpoint!"; @@ -2458,101 +2480,109 @@ void routing_manager_impl::on_subscribe_nack(client_t _client, bool routing_manager_impl::deliver_specific_endpoint_message(service_t _service, instance_t _instance, const byte_t *_data, length_t _size, endpoint *_receiver) { + client_t its_client(0x0); + // Try to deliver specific endpoint message (for selective subscribers) - std::lock_guard its_lock(endpoint_mutex_); - auto found_servic = remote_services_.find(_service); - if (found_servic != remote_services_.end()) { - auto found_instance = found_servic->second.find(_instance); - if (found_instance != found_servic->second.end()) { - for (auto client_entry : found_instance->second) { - client_t client = client_entry.first; - if (!client) { - continue; - } - auto found_reliability = client_entry.second.find(_receiver->is_reliable()); - if (found_reliability != client_entry.second.end()) { - auto found_enpoint = found_reliability->second; - if (found_enpoint.get() == _receiver) { - if (client != get_client()) { - auto local_endpoint = find_local(client); - if (local_endpoint) { - send_local(local_endpoint, client, _data, _size, _instance, true, - _receiver->is_reliable(), VSOMEIP_SEND); - } - } else { - deliver_message(_data, _size, _instance, _receiver->is_reliable()); + { + std::lock_guard its_lock(endpoint_mutex_); + auto found_servic = remote_services_.find(_service); + if (found_servic != remote_services_.end()) { + auto found_instance = found_servic->second.find(_instance); + if (found_instance != found_servic->second.end()) { + for (auto client_entry : found_instance->second) { + if (!client_entry.first) { + continue; + } + auto found_reliability = client_entry.second.find(_receiver->is_reliable()); + if (found_reliability != client_entry.second.end()) { + auto found_enpoint = found_reliability->second; + if (found_enpoint.get() == _receiver) { + its_client = client_entry.first; + break; } - return true; } } } } } + if (its_client) { + if (its_client != get_client()) { + auto local_endpoint = find_local(its_client); + if (local_endpoint) { + send_local(local_endpoint, its_client, _data, _size, _instance, true, + _receiver->is_reliable(), VSOMEIP_SEND); + } + } else { + deliver_message(_data, _size, _instance, _receiver->is_reliable()); + } + return true; + } return false; } void routing_manager_impl::clear_client_endpoints(service_t _service, instance_t _instance, bool _reliable) { - std::lock_guard its_lock(endpoint_mutex_); - std::shared_ptr deleted_endpoint; - // Clear client endpoints for remote services (generic and specific ones) - if (remote_services_.find(_service) != remote_services_.end()) { - if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) { - auto endpoint = remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT][_reliable]; - if (endpoint) { - service_instances_[_service].erase(endpoint.get()); - deleted_endpoint = endpoint; - } - remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].erase(_reliable); - auto found_endpoint = remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].find( - !_reliable); - if (found_endpoint == remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].end()) { - remote_services_[_service][_instance].erase(VSOMEIP_ROUTING_CLIENT); - } - } - } + std::unordered_set its_specific_endpoint_clients; { std::lock_guard its_lock(specific_endpoint_clients_mutex_); auto found_service = specific_endpoint_clients_.find(_service); if(found_service != specific_endpoint_clients_.end()){ auto found_instance = found_service->second.find(_instance); if(found_instance != found_service->second.end()) { - for (const client_t& client : found_instance->second) { - if (remote_services_.find(_service) != remote_services_.end()) { - if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) { - auto endpoint = remote_services_[_service][_instance][client][_reliable]; - if (endpoint) { - service_instances_[_service].erase(endpoint.get()); - endpoint->stop(); - } - remote_services_[_service][_instance][client].erase(_reliable); - auto found_endpoint = remote_services_[_service][_instance][client].find(!_reliable); - if (found_endpoint == remote_services_[_service][_instance][client].end()) { - remote_services_[_service][_instance].erase(client); - } - } + its_specific_endpoint_clients = found_instance->second; + } + } + } + { + std::lock_guard its_lock(endpoint_mutex_); + std::shared_ptr deleted_endpoint; + // Clear client endpoints for remote services (generic and specific ones) + if (remote_services_.find(_service) != remote_services_.end()) { + if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) { + auto endpoint = remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT][_reliable]; + if (endpoint) { + service_instances_[_service].erase(endpoint.get()); + deleted_endpoint = endpoint; + } + remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].erase(_reliable); + auto found_endpoint = remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].find( + !_reliable); + if (found_endpoint == remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].end()) { + remote_services_[_service][_instance].erase(VSOMEIP_ROUTING_CLIENT); + } + // erase specific client endpoints + for (const client_t &client : its_specific_endpoint_clients) { + auto endpoint = remote_services_[_service][_instance][client][_reliable]; + if (endpoint) { + service_instances_[_service].erase(endpoint.get()); + endpoint->stop(); + } + remote_services_[_service][_instance][client].erase(_reliable); + auto found_endpoint = remote_services_[_service][_instance][client].find(!_reliable); + if (found_endpoint == remote_services_[_service][_instance][client].end()) { + remote_services_[_service][_instance].erase(client); } } } } - } - if (remote_services_.find(_service) != remote_services_.end()) { - if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) { - if (!remote_services_[_service][_instance].size()) { - remote_services_[_service].erase(_instance); - if (0 >= remote_services_[_service].size()) { - remote_services_.erase(_service); + if (remote_services_.find(_service) != remote_services_.end()) { + if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) { + if (!remote_services_[_service][_instance].size()) { + remote_services_[_service].erase(_instance); + if (0 >= remote_services_[_service].size()) { + remote_services_.erase(_service); + } } } } - } - if (!service_instances_[_service].size()) { - service_instances_.erase(_service); - } - if(deleted_endpoint) { - stop_and_delete_client_endpoint(deleted_endpoint); + if (!service_instances_[_service].size()) { + service_instances_.erase(_service); + } + if(deleted_endpoint) { + stop_and_delete_client_endpoint(deleted_endpoint); + } } } @@ -2828,6 +2858,7 @@ bool routing_manager_impl::send_identify_message(client_t _client, bool routing_manager_impl::supports_selective(service_t _service, instance_t _instance) { bool supports_selective(false); + std::lock_guard its_lock(endpoint_mutex_); auto its_service = remote_service_info_.find(_service); if (its_service != remote_service_info_.end()) { auto its_instance = its_service->second.find(_instance); @@ -2973,10 +3004,13 @@ void routing_manager_impl::log_version_timer_cbk(boost::system::error_code const #endif VSOMEIP_INFO << "vSomeIP " << VSOMEIP_VERSION; - version_log_timer_.expires_from_now( - std::chrono::seconds(configuration_->get_log_version_interval())); - version_log_timer_.async_wait(std::bind(&routing_manager_impl::log_version_timer_cbk, - this, std::placeholders::_1)); + { + std::lock_guard its_lock(version_log_timer_mutex_); + version_log_timer_.expires_from_now( + std::chrono::seconds(configuration_->get_log_version_interval())); + version_log_timer_.async_wait(std::bind(&routing_manager_impl::log_version_timer_cbk, + this, std::placeholders::_1)); + } } } @@ -3008,6 +3042,7 @@ void routing_manager_impl::watchdog_cbk(boost::system::error_code const &_error) void routing_manager_impl::clear_remote_service_info(service_t _service, instance_t _instance, bool _reliable) { // Clear remote_service_info_ + std::lock_guard its_lock(endpoint_mutex_); if (remote_service_info_.find(_service) != remote_service_info_.end()) { if (remote_service_info_[_service].find(_instance) != remote_service_info_[_service].end()) { remote_service_info_[_service][_instance].erase(_reliable); diff --git a/implementation/routing/src/routing_manager_proxy.cpp b/implementation/routing/src/routing_manager_proxy.cpp index f60218d..a000211 100644 --- a/implementation/routing/src/routing_manager_proxy.cpp +++ b/implementation/routing/src/routing_manager_proxy.cpp @@ -539,6 +539,12 @@ bool routing_manager_proxy::send(client_t _client, const byte_t *_data, (void)_client; bool is_sent(false); bool has_remote_subscribers(false); + { + std::lock_guard its_lock(state_mutex_); + if (state_ != inner_state_type_e::ST_REGISTERED) { + return false; + } + } if (_size > VSOMEIP_MESSAGE_TYPE_POS) { std::shared_ptr its_target; if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS])) { @@ -649,31 +655,6 @@ bool routing_manager_proxy::send_to( return (false); } -void routing_manager_proxy::notify( - service_t _service, instance_t _instance, event_t _event, - std::shared_ptr _payload, bool _force, bool _flush) { - { - std::lock_guard its_lock(state_mutex_); - if (state_ == inner_state_type_e::ST_REGISTERED) { - routing_manager_base::notify(_service, _instance, _event, _payload, _force, _flush); - } - - if (is_field(_service, _instance, _event)){ - std::shared_ptr its_notification - = runtime::get()->create_notification(); - its_notification->set_service(_service); - its_notification->set_instance(_instance); - its_notification->set_method(_event); - its_notification->set_payload(_payload); - auto service_info = find_service(_service, _instance); - if (service_info) { - its_notification->set_interface_version(service_info->get_major()); - } - pending_notifications_[_service][_instance][_event] = its_notification; - } - } -} - void routing_manager_proxy::on_connect(std::shared_ptr _endpoint) { if (_endpoint != sender_) { return; @@ -1464,15 +1445,6 @@ void routing_manager_proxy::send_pending_commands() { per.event_, per.eventgroups_, per.is_field_, per.is_provided_); - for (auto &s : pending_notifications_) { - for (auto &i : s.second) { - for (auto &pn : i.second) { - routing_manager_base::notify(s.first, i.first, - pn.first, pn.second->get_payload(), false, true); // TODO: Use _flush argument to send all events at once - } - } - } - for (auto &po : pending_requests_) { send_request_service(client_, po.service_, po.instance_, po.major_, po.minor_, po.use_exclusive_proxy_); diff --git a/implementation/routing/src/routing_manager_stub.cpp b/implementation/routing/src/routing_manager_stub.cpp index a55d61b..ee75ec7 100644 --- a/implementation/routing/src/routing_manager_stub.cpp +++ b/implementation/routing/src/routing_manager_stub.cpp @@ -88,8 +88,10 @@ void routing_manager_stub::start() { VSOMEIP_INFO << "Watchdog is disabled!"; } - std::lock_guard its_lock(routing_info_mutex_); - routing_info_[host_->get_client()].first = 0; + { + std::lock_guard its_lock(routing_info_mutex_); + routing_info_[host_->get_client()].first = 0; + } } void routing_manager_stub::stop() { @@ -127,7 +129,10 @@ void routing_manager_stub::stop() { #endif } - broadcast_routing_info(true); + { + std::lock_guard its_lock(routing_info_mutex_); + broadcast_routing_info(true); + } } const std::shared_ptr routing_manager_stub::get_configuration() const { @@ -551,24 +556,31 @@ void routing_manager_stub::on_register_application(client_t _client) { } void routing_manager_stub::on_deregister_application(client_t _client) { - routing_info_mutex_.lock(); - auto its_info = routing_info_.find(_client); - if (its_info != routing_info_.end()) { - for (auto &its_service : its_info->second.second) { - for (auto &its_instance : its_service.second) { - auto its_version = its_instance.second; - routing_info_mutex_.unlock(); - host_->on_availability(its_service.first, its_instance.first, - false, its_version.first, its_version.second); - host_->on_stop_offer_service(_client, its_service.first, - its_instance.first, its_version.first, - its_version.second); - routing_info_mutex_.lock(); + std::vector< + std::tuple> services_to_report; + { + std::lock_guard its_lock(routing_info_mutex_); + auto its_info = routing_info_.find(_client); + if (its_info != routing_info_.end()) { + for (const auto &its_service : its_info->second.second) { + for (const auto &its_instance : its_service.second) { + const auto its_version = its_instance.second; + services_to_report.push_back( + std::make_tuple(its_service.first, + its_instance.first, its_version.first, + its_version.second)); + } } } + routing_info_.erase(_client); + } + for (const auto &s : services_to_report) { + host_->on_availability(std::get<0>(s), std::get<1>(s), false, + std::get<2>(s), std::get<3>(s)); + host_->on_stop_offer_service(_client, std::get<0>(s), std::get<1>(s), + std::get<2>(s), std::get<3>(s)); } - routing_info_.erase(_client); - routing_info_mutex_.unlock(); } void routing_manager_stub::client_registration_func(void) { @@ -694,13 +706,13 @@ void routing_manager_stub::init_routing_endpoint() { void routing_manager_stub::on_offer_service(client_t _client, service_t _service, instance_t _instance, major_version_t _major, minor_version_t _minor) { - std::lock_guard its_guard(routing_info_mutex_); if (_client == host_->get_client()) { create_local_receiver(); } if (_client == VSOMEIP_ROUTING_CLIENT || configuration_->is_offer_allowed(_client, _service, _instance)) { + std::lock_guard its_guard(routing_info_mutex_); routing_info_[_client].second[_service][_instance] = std::make_pair(_major, _minor); broadcast_routing_info(); } else { diff --git a/implementation/routing/src/serviceinfo.cpp b/implementation/routing/src/serviceinfo.cpp index f8db130..d497fe1 100644 --- a/implementation/routing/src/serviceinfo.cpp +++ b/implementation/routing/src/serviceinfo.cpp @@ -42,20 +42,24 @@ minor_version_t serviceinfo::get_minor() const { } ttl_t serviceinfo::get_ttl() const { + std::lock_guard its_lock(ttl_mutex_); ttl_t ttl = static_cast(std::chrono::duration_cast(ttl_).count()); return ttl; } void serviceinfo::set_ttl(ttl_t _ttl) { + std::lock_guard its_lock(ttl_mutex_); std::chrono::seconds ttl = static_cast(_ttl); ttl_ = std::chrono::duration_cast (ttl); } std::chrono::milliseconds serviceinfo::get_precise_ttl() const { + std::lock_guard its_lock(ttl_mutex_); return ttl_; } void serviceinfo::set_precise_ttl(std::chrono::milliseconds _precise_ttl) { + std::lock_guard its_lock(ttl_mutex_); ttl_ = _precise_ttl; } @@ -73,14 +77,17 @@ void serviceinfo::set_endpoint(std::shared_ptr _endpoint, } void serviceinfo::add_client(client_t _client) { + std::lock_guard its_lock(requesters_mutex_); requesters_.insert(_client); } void serviceinfo::remove_client(client_t _client) { + std::lock_guard its_lock(requesters_mutex_); requesters_.erase(_client); } uint32_t serviceinfo::get_requesters_size() { + std::lock_guard its_lock(requesters_mutex_); return static_cast(requesters_.size()); } diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp index 0f5582f..b394512 100644 --- a/implementation/runtime/include/application_impl.hpp +++ b/implementation/runtime/include/application_impl.hpp @@ -245,6 +245,7 @@ private: state_type_e state_; // vsomeip state handler + std::mutex state_handler_mutex_; state_handler_t handler_; // Method/Event (=Member) handlers diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index f2fd422..7ce2b1d 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -643,10 +643,12 @@ void application_impl::notify_one(service_t _service, instance_t _instance, } void application_impl::register_state_handler(state_handler_t _handler) { + std::lock_guard its_lock(state_handler_mutex_); handler_ = _handler; } void application_impl::unregister_state_handler() { + std::lock_guard its_lock(state_handler_mutex_); handler_ = nullptr; } @@ -900,16 +902,22 @@ void application_impl::on_state(state_type_e _state) { } } } - if (handler_) { + bool has_state_handler(false); + state_handler_t handler = nullptr; + { + std::lock_guard its_lock(state_handler_mutex_); + if (handler_) { + has_state_handler = true; + handler = handler_; + } + } + if (has_state_handler) { { std::lock_guard its_lock(handlers_mutex_); - - state_handler_t handler = handler_; std::shared_ptr its_sync_handler = std::make_shared([handler, _state]() { handler(_state); }); - handlers_.push_back(its_sync_handler); } dispatcher_condition_.notify_one(); diff --git a/implementation/service_discovery/include/service_discovery_impl.hpp b/implementation/service_discovery/include/service_discovery_impl.hpp index e367c0b..083cdbd 100644 --- a/implementation/service_discovery/include/service_discovery_impl.hpp +++ b/implementation/service_discovery/include/service_discovery_impl.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -306,6 +307,7 @@ private: std::chrono::milliseconds repetitions_base_delay_; std::uint8_t repetitions_max_; std::chrono::milliseconds cyclic_offer_delay_; + std::mutex offer_debounce_timer_mutex_; boost::asio::steady_timer offer_debounce_timer_; // this map is used to collect offers while for offer debouncing std::mutex collected_offers_mutex_; @@ -316,9 +318,10 @@ private: std::map, services_t> repetition_phase_timers_; + std::mutex main_phase_timer_mutex_; boost::asio::steady_timer main_phase_timer_; - bool is_suspended_; + std::atomic is_suspended_; std::string sd_multicast_; diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp index e33027a..5fec777 100644 --- a/implementation/service_discovery/src/service_discovery_impl.cpp +++ b/implementation/service_discovery/src/service_discovery_impl.cpp @@ -161,8 +161,14 @@ void service_discovery_impl::start() { void service_discovery_impl::stop() { boost::system::error_code ec; is_suspended_ = true; - main_phase_timer_.cancel(ec); - offer_debounce_timer_.cancel(ec); + { + std::lock_guard its_lock(main_phase_timer_mutex_); + main_phase_timer_.cancel(ec); + } + { + std::lock_guard its_lock(offer_debounce_timer_mutex_); + offer_debounce_timer_.cancel(ec); + } { std::lock_guard its_lock(repetition_phase_timers_mutex_); for(const auto &t : repetition_phase_timers_) { @@ -968,8 +974,6 @@ bool service_discovery_impl::send(bool _is_announcing, bool _is_find) { std::vector< std::shared_ptr< message_impl > > its_messages; std::shared_ptr < message_impl > its_message; - uint32_t its_remaining(max_message_size_); - if (_is_find || !_is_announcing) { uint32_t its_start(0); uint32_t its_size(0); @@ -981,7 +985,6 @@ bool service_discovery_impl::send(bool _is_announcing, bool _is_find) { insert_find_entries(its_message, its_start, its_size, is_done); its_start += its_size / VSOMEIP_SOMEIP_SD_ENTRY_SIZE; }; - its_remaining -= its_size; } else { its_message = its_runtime->create_message(); its_messages.push_back(its_message); @@ -2274,6 +2277,7 @@ void service_discovery_impl::offer_service(service_t _service, } void service_discovery_impl::start_offer_debounce_timer(bool _first_start) { + std::lock_guard its_lock(offer_debounce_timer_mutex_); boost::system::error_code ec; if (_first_start) { offer_debounce_timer_.expires_from_now(initial_delay_, ec); @@ -2564,6 +2568,7 @@ bool service_discovery_impl::send_stop_offer( } void service_discovery_impl::start_main_phase_timer() { + std::lock_guard its_lock(main_phase_timer_mutex_); boost::system::error_code ec; main_phase_timer_.expires_from_now(cyclic_offer_delay_); if (ec) { @@ -2601,9 +2606,12 @@ void service_discovery_impl::send_uni_or_multicast_offerservice( bool service_discovery_impl::last_offer_shorter_half_offer_delay_ago() { //get remaining time to next offer since last offer - std::chrono::milliseconds remaining = std::chrono::duration_cast< - std::chrono::milliseconds>(main_phase_timer_.expires_from_now()); - + std::chrono::milliseconds remaining(0); + { + std::lock_guard its_lock(main_phase_timer_mutex_); + remaining = std::chrono::duration_cast( + main_phase_timer_.expires_from_now()); + } if (std::chrono::milliseconds(0) > remaining) { remaining = cyclic_offer_delay_; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ed4e983..fb8a89f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1718,17 +1718,17 @@ if(NOT ${TESTS_BAT}) add_test(NAME ${TEST_APPLICATION} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER} ) - set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 40) + set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 80) add_test(NAME ${TEST_APPLICATION_SINGLE_PROCESS_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER} ) - set_tests_properties(${TEST_APPLICATION_SINGLE_PROCESS_NAME} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_APPLICATION_SINGLE_PROCESS_NAME} PROPERTIES TIMEOUT 120) # magic cookies test add_test(NAME ${TEST_MAGIC_COOKIES_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER} ) - set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 120) # Header/Factory tets add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY}) @@ -1744,7 +1744,7 @@ if(NOT ${TESTS_BAT}) add_test(NAME ${TEST_EXTERNAL_LOCAL_ROUTING_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER} ) - set_tests_properties(${TEST_EXTERNAL_LOCAL_ROUTING_NAME} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_EXTERNAL_LOCAL_ROUTING_NAME} PROPERTIES TIMEOUT 120) # Payload tests add_test(NAME ${TEST_LOCAL_PAYLOAD_NAME} @@ -1753,206 +1753,206 @@ if(NOT ${TESTS_BAT}) add_test(NAME ${TEST_LOCAL_PAYLOAD_HUGE_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} ) - set_tests_properties(${TEST_LOCAL_PAYLOAD_HUGE_NAME} PROPERTIES TIMEOUT 240) + set_tests_properties(${TEST_LOCAL_PAYLOAD_HUGE_NAME} PROPERTIES TIMEOUT 480) add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} ) add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER} ) - set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 240) + set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 480) add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER} ) - set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 240) + set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 480) # big payload tests add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} RANDOM ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} LIMITED ) - set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} RANDOM ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITED ) - set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120) # client id tests add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_CLIENT_ID_UTILITY} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY}) set_property(TEST ${TEST_CLIENT_ID_UTILITY} APPEND PROPERTY ENVIRONMENT "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_CONFIG_FILE}") - set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120) # subscribe notify tests add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120) # subscribe notify one id tests add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120) # cpu load tests add_test(NAME ${TEST_CPU_LOAD_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_MASTER_STARTER} ) - set_tests_properties(${TEST_CPU_LOAD_NAME} PROPERTIES TIMEOUT 1500) + set_tests_properties(${TEST_CPU_LOAD_NAME} PROPERTIES TIMEOUT 3000) # initial event tests add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID) - set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 60) + set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120) # offer tests add_test(NAME ${TEST_OFFER_NAME}_local COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_STARTER}) - set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 90) + set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 180) add_test(NAME ${TEST_OFFER_NAME}_external COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_MASTER_STARTER}) - set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 180) + set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 360) else() # Routing tests add_test(NAME ${TEST_LOCAL_ROUTING_NAME} diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in index cc93b48..85cf393 100644 --- a/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in +++ b/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in @@ -16,7 +16,8 @@ [ { "name":"big_payload_test_client", - "id":"0x1343" + "id":"0x1343", + "max_dispatch_time" : "5000" } ], "buffer-shrink-threshold" : "2", diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in index e607018..56613e3 100644 --- a/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in +++ b/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in @@ -15,7 +15,8 @@ [ { "name":"big_payload_test_service", - "id":"0x1277" + "id":"0x1277", + "max_dispatch_time" : "5000" } ], "services": diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp index 0727b8e..dc735e2 100644 --- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp +++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp @@ -292,8 +292,6 @@ public: continue; } - app_->request_service(i.service_id, i.instance_id, vsomeip::DEFAULT_MAJOR, vsomeip::DEFAULT_MINOR, true); - app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id, vsomeip::DEFAULT_MAJOR, subscription_type_); -- cgit v1.2.1