seastar
seastar copied to clipboard
Posix remote_address() may throw, but it is marked noexcept
I ran into the following error:
terminate called after throwing an instance of 'std::system_error'
what(): getpeername: Transport endpoint is not connected
Aborting on shard 1.
Partial backtrace:
std::terminate() at ??:?
__clang_call_terminate at :?
seastar::net::posix_connected_socket_impl::remote_address() const at ??:?
seastar::tls::tls_connected_socket_impl::remote_address() const at ??:?
seastar::connected_socket::remote_address() const at ??:?
I believe the cause is posix_connected_socket_impl::remote_address()
is marked noexcept, but it calls posix_connected_socket_operations::remote_address()
, which is not noexcept, and in fact the latter calls file_desc::get_remote_address()
which explicitly throws.
See:
https://github.com/scylladb/seastar/blob/master/src/net/posix-stack.cc#L288 https://github.com/scylladb/seastar/blob/master/src/net/posix-stack.cc#L110 https://github.com/scylladb/seastar/blob/master/include/seastar/core/posix.hh#L298