diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa3c5dd568..1b0302291c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Unreleased + - Changes from 5.25.0 + - Misc: + - Fixed: Set osrm-routed to immediately close bad connections [#6112](https://github.com/Project-OSRM/osrm-backend/pull/6112) # 5.25.0 - Changes from 5.24.0 diff --git a/include/server/server.hpp b/include/server/server.hpp index 53098fa61c5..06d2ec8e92b 100644 --- a/include/server/server.hpp +++ b/include/server/server.hpp @@ -101,6 +101,10 @@ class Server new_connection->socket(), boost::bind(&Server::HandleAccept, this, boost::asio::placeholders::error)); } + else + { + util::Log(logERROR) << "HandleAccept error: " << e.message(); + } } unsigned thread_pool_size; diff --git a/src/server/connection.cpp b/src/server/connection.cpp index d6441977f2c..eec84e281cb 100644 --- a/src/server/connection.cpp +++ b/src/server/connection.cpp @@ -3,13 +3,10 @@ #include "server/request_parser.hpp" #include -#include #include #include #include -#include -#include #include namespace osrm @@ -48,6 +45,8 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t { if (error) { + util::Log(logDEBUG) << "Connection read error: " << error.message(); + handle_shutdown(); return; } @@ -73,6 +72,7 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t current_request.endpoint = TCP_socket.remote_endpoint(ec).address(); if (ec) { + util::Log(logDEBUG) << "Socket remote endpoint error: " << ec.message(); handle_shutdown(); return; } @@ -183,6 +183,8 @@ void Connection::handle_timeout(boost::system::error_code ec) void Connection::handle_shutdown() { + // Cancel timer to ensure all resources are released immediately on shutdown. + timer.cancel(); // Initiate graceful connection closure. boost::system::error_code ignore_error; TCP_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignore_error);