-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P2P: Provide better log message when unable to resolve host #523
Conversation
@@ -2791,7 +2791,8 @@ namespace eosio { | |||
c->send_time(); | |||
} | |||
} else { | |||
fc_ilog( logger, "connection failed to ${a}, ${error}", ("a", c->peer_address())( "error", err.message())); | |||
fc_ilog(logger, "connection failed to ${a}, ${e}", ("a", c->peer_address()) | |||
("e", err == boost::asio::error::not_found ? "Unable to resolve endpoint" : err.message())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little suspicious this isn't the right location for such a test. If we can't resolve any hosts wouldn't this be the right location for handling such a thing?
spring/plugins/net_plugin/net_plugin.cpp
Lines 4611 to 4628 in 0f8bbeb
resolver->async_resolve(host, port, | |
[resolver, host = host, port = port, peer_address = peer_address, listen_address = listen_address, this]( const boost::system::error_code& err, const tcp::resolver::results_type& results ) { | |
connection_ptr c = std::make_shared<connection>( peer_address, listen_address ); | |
c->set_heartbeat_timeout( heartbeat_timeout ); | |
std::lock_guard g( connections_mtx ); | |
auto [it, inserted] = connections.emplace( connection_detail{ | |
.host = peer_address, | |
.c = std::move(c), | |
.ips = results | |
}); | |
if( !err ) { | |
it->c->connect( results ); | |
} else { | |
fc_wlog( logger, "Unable to resolve ${host}:${port} ${error}", | |
("host", host)("port", port)( "error", err.message() ) ); | |
it->c->set_state(connection::connection_state::closed); | |
++(it->c->consecutive_immediate_connection_close); | |
} |
Is it possible when being unable to resolve any hosts async_resolve
completes successfully but returns an empty result list? (that seems at odds with documentation, just trying to think how this existing Unable to resolve
path isn't getting hit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. Seems the issue is that we add the connection to the connections
index even if it doesn't resolve. Then we use that .ips
for reconnection. Seems instead we should attempt to resolve the host on each new re-connection.
Created a new issue for this: #525. Thanks @spoonincode |
Note:start |
Before:
After