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.
// which passes a ThreadMap reference from the client to the server,
169
+
// allowing the server to create threads to run IPC calls on the
170
+
// client, and also returns a ThreadMap reference from the server to
171
+
// the client, allowing the client to create threads on the server.
172
+
// (Typically the latter ThreadMap is used more often because there
173
+
// are more client-to-server calls.)
174
+
//
175
+
// If the other side of the connection did not previously get a
176
+
// ThreadMap reference from this side of the connection, when the
177
+
// other side calls `m_thread_map.makeThreadRequest()` in
178
+
// `BuildField` above, `m_thread_map` will be null, but that call
179
+
// will not fail immediately due to Cap'n Proto's request pipelining
180
+
// and delayed execution. Instead that call will return an invalid
181
+
// Thread reference, and when that reference is passed to this side
182
+
// of the connection as `thread_client` above, the
183
+
// `getLocalServer(thread_client)` call there will be the first
184
+
// thing to overtly fail, leading to an error here.
185
+
//
186
+
// Potentially there are also other things that could cause errors
187
+
// here, but this is the mostly likely cause.
188
+
//
189
+
// The log statement here is not strictly necessary since the same
190
+
// exception will also be logged in serverInvoke, but this logging
191
+
// may provide extra context that could be helpful for debugging.
192
+
server.m_context.loop->log()
193
+
<< "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?";
194
+
returnkj::mv(e);
161
195
})
162
196
// Wait for the invocation to finish before returning to the caller.
0 commit comments