Error Handling

In synchronous RPC, a client makes a remote call and the call returns with either a success or failure code. Asynchronous RPC provides more opportunities for a call to fail, and these failures are handled differently depending on where and when they occur. The following table describes the ways in which a call can fail, and how it is handled.

Source of Failure How Handled
Client call to remote function fails. The call raises an exception. Neither the client nor the server must call RpcAsyncCompleteCall.
Client call to remote function fails because of a failure in the asynchronous mechanism. Client receives a "call complete" notification. RpcAsyncCompleteCall return value is the failure code.
Client issues cancel (either abortive or non-abortive). Server learns of cancel by calling RpcServerTestCancel. Server must still call RpcAsyncCompleteCall or RpcAsyncAbortCall to complete the call.
Client issues an abortive cancel. Client receives "call complete" notification. When client calls RpcAsyncCompleteCall, function returns RPC_S_CALLED_CANCELLED, unless the call failed, or completed before it was cancelled.
Call fails before server dispatched it. Failure handled by run time and client and server stubs.
The synchronous portion of the manager routine raises an exception. Run time catches exception and propagates it to the client.
Call fails after server calls RpcAsyncCompleteCall. Run time handles it; server is not notified.
Special Error Handling Cases for Pipes:
Client calls push and call fails. Push returns a failure code. Client must call RpcAsyncCompleteCall.
Client calls RpcAsyncCompleteCall before the in pipes are drained. Call fails with the appropriate pipe-filling error code.
Client calls pull and call fails. Pull returns a failure code. Client must call RpcAsyncCompleteCall.
Either client or server calls push or pull in the wrong order. Run time returns pipe-filling error status.
Server calls push and call fails. Push returns a failure code. Server must call RpcAsyncCompleteCall.
Server calls RpcAsyncCompleteCall before the pipes have been drained. The pipe call returns a pipe filling error status.
After the dispatch, a receive operation fails. The next time the server calls pull to receive pipe data, an error is returned.