From f5d9ec214df655dc49305399215e00d16231fecd Mon Sep 17 00:00:00 2001 From: Juergen Gehring Date: Tue, 22 May 2018 02:56:45 -0700 Subject: vsomeip 2.10.19 --- CHANGES | 5 ++ CMakeLists.txt | 2 +- .../endpoints/src/tcp_client_endpoint_impl.cpp | 3 + implementation/runtime/src/application_impl.cpp | 77 ++++++++++++---------- 4 files changed, 53 insertions(+), 34 deletions(-) diff --git a/CHANGES b/CHANGES index c65c8ef..0f7aa15 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ Changes ======= +v2.10.19 +- Catch exceptions on shutdown (especially from boost::log) +- Fixed handling of malformed packets in TCP client endpoint in conjunction + with magic cookies + v2.10.18 - Fix restarting of TCP connection on connection reset by the server and mark services reachable through it as unavailable until diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cb9b56..1bb01ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project (vsomeip) set (VSOMEIP_MAJOR_VERSION 2) set (VSOMEIP_MINOR_VERSION 10) -set (VSOMEIP_PATCH_VERSION 18) +set (VSOMEIP_PATCH_VERSION 19) 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/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp index 056e743..102d0fe 100644 --- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp @@ -507,6 +507,9 @@ void tcp_client_endpoint_impl::receive_cbk( _recv_buffer_size -= its_offset; its_iteration_gap += its_offset; has_full_message = true; // trigger next loop + } else { + _recv_buffer_size = 0; + its_missing_capacity = 0; } } else { VSOMEIP_ERROR << "tce::c<" << this diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index 065e6a3..d079816 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -1875,46 +1875,57 @@ void application_impl::shutdown() { is_dispatching_ = false; dispatcher_condition_.notify_all(); } - { - std::lock_guard its_lock(dispatcher_mutex_); - for (auto its_dispatcher : dispatchers_) { - if (its_dispatcher.second->get_id() != stop_caller_id_) { - if (its_dispatcher.second->joinable()) { - its_dispatcher.second->join(); + + try { + + { + std::lock_guard its_lock(dispatcher_mutex_); + for (auto its_dispatcher : dispatchers_) { + if (its_dispatcher.second->get_id() != stop_caller_id_) { + if (its_dispatcher.second->joinable()) { + its_dispatcher.second->join(); + } + } else { + // If the caller of stop() is one of our dispatchers + // it can happen the shutdown mechanism will block + // as that thread probably can't be joined. The reason + // is the caller of stop() probably wants to join the + // thread once call start (which got to the IO-Thread) + // and which is expected to return after stop() has been + // called. + // Therefore detach this thread instead of joining because + // after it will return to "main_dispatch" it will be + // properly shutdown anyways because "is_dispatching_" + // was set to "false" here. + its_dispatcher.second->detach(); } - } else { - // If the caller of stop() is one of our dispatchers - // it can happen the shutdown mechanism will block - // as that thread probably can't be joined. The reason - // is the caller of stop() probably wants to join the - // thread once call start (which got to the IO-Thread) - // and which is expected to return after stop() has been - // called. - // Therefore detach this thread instead of joining because - // after it will return to "main_dispatch" it will be - // properly shutdown anyways because "is_dispatching_" - // was set to "false" here. - its_dispatcher.second->detach(); } + availability_handlers_.clear(); + running_dispatchers_.clear(); + elapsed_dispatchers_.clear(); + dispatchers_.clear(); } - availability_handlers_.clear(); - running_dispatchers_.clear(); - elapsed_dispatchers_.clear(); - dispatchers_.clear(); - } - if (routing_) - routing_->stop(); + if (routing_) + routing_->stop(); - work_.reset(); - io_.stop(); + work_.reset(); + io_.stop(); - { - std::lock_guard its_lock_start_stop(start_stop_mutex_); - for (auto t : io_threads_) { - t->join(); + { + std::lock_guard its_lock_start_stop(start_stop_mutex_); + for (auto t : io_threads_) { + t->join(); + } + io_threads_.clear(); } - io_threads_.clear(); +#ifndef _WIN32 + } catch (const boost::log::v2_mt_posix::system_error &e) { + std::cerr << "catched boost::log system_error in stop thread" << std::endl << + boost::current_exception_diagnostic_information(); +#endif + } catch (const std::exception &e) { + VSOMEIP_ERROR << "application_impl::shutdown() catched exception: " << e.what(); } } -- cgit v1.2.1