Skip to content

Commit

Permalink
vsomeip 2.10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
juergengehring committed Jan 25, 2018
1 parent a89a645 commit 8936891
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 219 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

v2.10.7
- Fix potential deadlock when expiring remote subscriptions
- Rework restarting of tcp client endpoints to prevent heap corruption
under high load situations

v2.10.6
- Fix concurrency issue leading to a crash when asynchronous
subscription handlers were used.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project (vsomeip)

set (VSOMEIP_MAJOR_VERSION 2)
set (VSOMEIP_MINOR_VERSION 10)
set (VSOMEIP_PATCH_VERSION 6)
set (VSOMEIP_PATCH_VERSION 7)
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)
Expand Down
21 changes: 14 additions & 7 deletions implementation/endpoints/include/tcp_client_endpoint_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,27 @@ class tcp_client_endpoint_impl: public tcp_client_endpoint_base_impl {

private:
void send_queued();
bool is_magic_cookie(size_t _offset) const;
bool is_magic_cookie(const message_buffer_ptr_t& _recv_buffer,
size_t _offset) const;
void send_magic_cookie(message_buffer_ptr_t &_buffer);

void receive_cbk(boost::system::error_code const &_error,
std::size_t _bytes);
std::size_t _bytes,
message_buffer_ptr_t _recv_buffer,
std::size_t _recv_buffer_size);

void connect();
void receive();
void calculate_shrink_count();
void receive(message_buffer_ptr_t _recv_buffer,
std::size_t _recv_buffer_size,
std::size_t _missing_capacity);
void calculate_shrink_count(const message_buffer_ptr_t& _recv_buffer,
std::size_t _recv_buffer_size);
const std::string get_address_port_remote() const;
const std::string get_address_port_local() const;
void handle_recv_buffer_exception(const std::exception &_e);
void handle_recv_buffer_exception(const std::exception &_e,
const message_buffer_ptr_t& _recv_buffer,
std::size_t _recv_buffer_size);
void set_local_port();
std::size_t write_completion_condition(
const boost::system::error_code& _error,
Expand All @@ -62,9 +71,7 @@ class tcp_client_endpoint_impl: public tcp_client_endpoint_base_impl {
std::string get_remote_information() const;

const std::uint32_t recv_buffer_size_initial_;
message_buffer_t recv_buffer_;
size_t recv_buffer_size_;
std::uint32_t missing_capacity_;
message_buffer_ptr_t recv_buffer_;
std::uint32_t shrink_count_;
const std::uint32_t buffer_shrink_threshold_;

Expand Down
179 changes: 102 additions & 77 deletions implementation/endpoints/src/tcp_client_endpoint_impl.cpp

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions implementation/endpoints/src/udp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ void udp_client_endpoint_impl::restart() {
std::lock_guard<std::mutex> its_lock(mutex_);
queue_.clear();
}
std::string local;
{
std::lock_guard<std::mutex> its_lock(socket_mutex_);
local = get_address_port_local();
}
shutdown_and_close_socket(false);
VSOMEIP_WARNING << "uce::restart: local: " << local
<< " remote: " << get_address_port_remote();
start_connect_timer();
}

Expand Down
52 changes: 29 additions & 23 deletions implementation/routing/src/routing_manager_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,30 +384,36 @@ void routing_manager_base::register_event(client_t _client, service_t _service,
void routing_manager_base::unregister_event(client_t _client, service_t _service, instance_t _instance,
event_t _event, bool _is_provided) {
(void)_client;
std::lock_guard<std::mutex> its_lock(events_mutex_);
auto found_service = events_.find(_service);
if (found_service != events_.end()) {
auto found_instance = found_service->second.find(_instance);
if (found_instance != found_service->second.end()) {
auto found_event = found_instance->second.find(_event);
if (found_event != found_instance->second.end()) {
auto its_event = found_event->second;
its_event->remove_ref(_client, _is_provided);
if (!its_event->has_ref()) {
auto its_eventgroups = its_event->get_eventgroups();
for (auto eg : its_eventgroups) {
std::shared_ptr<eventgroupinfo> its_eventgroup_info
= find_eventgroup(_service, _instance, eg);
if (its_eventgroup_info) {
its_eventgroup_info->remove_event(its_event);
if (0 == its_eventgroup_info->get_events().size()) {
remove_eventgroup_info(_service, _instance, eg);
}
}
std::shared_ptr<event> its_unrefed_event;
{
std::lock_guard<std::mutex> its_lock(events_mutex_);
auto found_service = events_.find(_service);
if (found_service != events_.end()) {
auto found_instance = found_service->second.find(_instance);
if (found_instance != found_service->second.end()) {
auto found_event = found_instance->second.find(_event);
if (found_event != found_instance->second.end()) {
auto its_event = found_event->second;
its_event->remove_ref(_client, _is_provided);
if (!its_event->has_ref()) {
its_unrefed_event = its_event;
found_instance->second.erase(found_event);
} else if (_is_provided) {
its_event->set_provided(false);
}
found_instance->second.erase(_event);
} else if (_is_provided) {
its_event->set_provided(false);
}
}
}
}
if (its_unrefed_event) {
auto its_eventgroups = its_unrefed_event->get_eventgroups();
for (auto eg : its_eventgroups) {
std::shared_ptr<eventgroupinfo> its_eventgroup_info
= find_eventgroup(_service, _instance, eg);
if (its_eventgroup_info) {
its_eventgroup_info->remove_event(its_unrefed_event);
if (0 == its_eventgroup_info->get_events().size()) {
remove_eventgroup_info(_service, _instance, eg);
}
}
}
Expand Down
Loading

0 comments on commit 8936891

Please sign in to comment.