I’m in the midst of improving the error handling in my code, but there’s a warning logged by KJ that I can’t figure out. I’d appreciate any advice or insight.
It happens when my client code fails to connect because server-side auth fails, so it gets an abrupt "Connection reset by peer” error that’s thrown from the first Promise::wait() call. That exception causes my client object to get destructed, and during its destructor the warning gets logged (with a bunch of backtrace.)
The call stack is pretty long, so I’ve tried to clean it up a bit. “myapp” is app code. “snej::shs” is my implementation of the SecretHandshake secure-socket protocol, including CapnP glue code adapted from ez-rpc.c++.
myapp::KJExceptionCallback::onRecoverableException() at Logging.cc:80:28 kj::_::Debug::Fault::~Fault() + 172
kj::EventLoop::~EventLoop() + 432
kj::_::HeapDisposer<kj::() const + 56
kj::Disposer::Dispose_<kj::LowLevelAsyncIoProvider, true>::dispose() at memory.h:522:14
void kj::Disposer::dispose<kj::LowLevelAsyncIoProvider>() const at memory.h:534:3
kj::Own<kj::LowLevelAsyncIoProvider>::dispose() at memory.h:278:17
kj::Own<kj::LowLevelAsyncIoProvider>::~Own() at memory.h:204:28
kj::Own<kj::LowLevelAsyncIoProvider>::~Own() at memory.h:204:26
kj::AsyncIoContext::~AsyncIoContext() at async-io.h:876:8
kj::AsyncIoContext::~AsyncIoContext() at async-io.h:876:8
kj::Disposer::Dispose_<snej::shs::SecretRPCContext, true>::dispose() at memory.h:522:14
void kj::Disposer::dispose<snej::shs::SecretRPCContext>() const at memory.h:534:3
kj::Own<snej::shs::SecretRPCContext>::dispose() at memory.h:278:17
kj::Own<snej::shs::SecretRPCContext>::~Own() at memory.h:204:28
kj::Own<snej::shs::SecretRPCContext>::~Own() at memory.h:204:26
kj::_::HeapDisposer<snej::shs::SecretRPCClient::Impl>::disposeImpl() const at memory.h:433:60
kj::Disposer::Dispose_<snej::shs::SecretRPCClient::Impl, false>::dispose() at memory.h:528:14
void kj::Disposer::dispose<snej::shs::SecretRPCClient::Impl>() const at memory.h:534:3
kj::Own<snej::shs::SecretRPCClient::Impl>::dispose() at memory.h:278:17
kj::Own<snej::shs::SecretRPCClient::Impl>::~Own() at memory.h:204:28
kj::Own<snej::shs::SecretRPCClient::Impl>::~Own() at memory.h:204:26
kj::_::HeapDisposer<snej::shs::SecretRPCClient>::disposeImpl() const at memory.h:433:60
kj::Disposer::Dispose_<snej::shs::SecretRPCClient, false>::dispose() at memory.h:528:14
void kj::Disposer::dispose<snej::shs::SecretRPCClient>() const at memory.h:534:3
kj::Own<snej::shs::SecretRPCClient>::dispose() at memory.h:278:17
kj::Own<snej::shs::SecretRPCClient>::~Own() at memory.h:204:28
kj::Own<snej::shs::SecretRPCClient>::~Own() at memory.h:204:26
myapp::net::Client::ConnectionImpl::~ConnectionImpl() at Client.cc:281:19 myapp::net::Client::ConnectionImpl::~ConnectionImpl() at Client.cc:281:19 myapp::net::Client::ConnectionImpl::~ConnectionImpl() at Client.cc:281:19 std::__1::default_delete<myapp::net::Client::Impl>::operator() const at unique_ptr.h:57:5
std::__1::unique_ptr<myapp::net::Client::Impl, std::__1::default_delete<myapp::net::Client::Impl> >::reset() at unique_ptr.h:318:7
std::__1::unique_ptr<myapp::net::Client::Impl, std::__1::default_delete<myapp::net::Client::Impl> >::~unique_ptr() at unique_ptr.h:272:19
std::__1::unique_ptr<myapp::net::Client::Impl, std::__1::default_delete<myapp::net::Client::Impl> >::~unique_ptr() at unique_ptr.h:272:17
kj::_::RunnableImpl<myapp::SyncTask::run() at exception.h:319:5
kj::_::runCatchingExceptions() + 36
kj::Maybe<kj::Exception> kj::runCatchingExceptions<myapp::SyncTask::run() at exception.h:332:10
Tool::main() at Tool.hh:63:20