You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logging: Add better logging on IPC server-side failures
Motivation: when trying to add a new unit test ran into a confusing error
"(remote):0: failed: remote exception: Called null capability" caused by
forgetting to make a FooInterface.initThreadMap call during initialization and
these logging prints would have made it easier to see where the error was
coming from and debug.
<< "IPC server error request #" << req << ", missing thread to execute request";
159
159
throwstd::runtime_error("invalid thread handle");
160
160
}
161
+
}, [&server, req](::kj::Exception&& e) {
162
+
// Detect when getLocalServer call fails. The serverInvoke function
163
+
// will print the full exception object after this, but it is worth
164
+
// printing an additional message here because a failure here is
165
+
// probably caused by failing to pass a ThreadMap object from the
166
+
// server to the client before this call. Specifically what happens
167
+
// if there was not a prior IPC call returning a ThreadMap, is that
168
+
// the client's Connection::m_thread_map member will be null when
169
+
// the client is making this IPC, and when it uses
170
+
// m_thread_map.makeThreadRequest() as part of this IPC, the
171
+
// makeThread request will appear to succeed due to Cap'n Proto's
172
+
// request pipelining, but actually return a null Thread::Client
173
+
// capability, and when that capability is passed to getLocalServer
174
+
// it will fail with an error here: "(remote):0: failed: remote
175
+
// exception: Called null capability" that's pretty opaque, so good
176
+
// to print a more specific message.
177
+
server.m_context.loop->log()
178
+
<< "IPC server error request #" << req << " CapabilityServerSet<Thread>::getLocalServer call failed, did you forget to provide a ThreadMap to the client prior to this IPC call?";
179
+
returnkj::mv(e);
161
180
})
162
181
// Wait for the invocation to finish before returning to the caller.
0 commit comments