Skip to content

Commit 6de92e1

Browse files
committed
proxy-client: tolerate exceptions from remote destroy during cleanup
Fixes #219
1 parent 90be835 commit 6de92e1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

include/mp/proxy-io.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,12 @@ ProxyClientBase<Interface, Impl>::ProxyClientBase(typename Interface::Client cli
538538
// the remote object, waiting for it to be deleted server side. If the
539539
// capnp interface does not define a destroy method, this will just call
540540
// an empty stub defined in the ProxyClientBase class and do nothing.
541-
Sub::destroy(*this);
541+
// Exceptions are caught and logged rather than propagated because
542+
// ~ProxyClientBase is noexcept and the peer may be gone by the time
543+
// this runs.
544+
if (kj::runCatchingExceptions([&]{ Sub::destroy(*this); }) != nullptr) {
545+
MP_LOG(*m_context.loop, Log::Warning) << "Remote destroy call failed during cleanup. Continuing.";
546+
}
542547

543548
// FIXME: Could just invoke removed addCleanup fn here instead of duplicating code
544549
m_context.loop->sync([&]() {

0 commit comments

Comments
 (0)