I am working on modifying the Python (Avro RPC-based) HBase library to support Tornado's IOLoop (using AsyncHTTPClient under-the-covers).
Basic exception handling (via ExceptionStackContext) was added in the following commit:
The intention is to catch any thrown exception, return None to the caller, and stop the exception from bubbling up to other exception handlers. (Possible improvements include returning an object with non-None error attribute instead of returning None; the current approach is simply a starting point.)
I have a RequestHandler that performs several hundred calls using this library, waits for all calls to return, and then continues on to perform some additional computation before returning a response. In general, this works properly, regardless of whether any exceptions are thrown in any of these asynchronous Avro requests.
However, if an exception is thrown in any code that is run **after** all Avro responses are collected, an exception handler for one of the Avro requests is invoked. This, in turn, suppresses the exception (since the Avro exception handler explicitly stops the exception from propagating), which causes other very bad things to happen.
Where am I going wrong?
Thanks,
Michael