archives

Asynchronous calls and error handling

I would like to hear your experience and opinion about error handling as related to asynchronous messaging.

If I read correctly, Erlang uses a separate thread for error handling, which supports custom handlers. I find it difficult to see how such a scheme can be used for error recovery in concurrent programs. Does the handler match the sender of the message that caused an error? How does that sender put things together in a coherent state after its handler is called?

I am thinking of a completely different approach for dodo which uses the traditional exception handling mechanism.

My idea is to delay the error reporting until the caller stops to receive a reply from the callee. The main problem with that is that the caller may never wait for a reply, and the error needs to be cleared before another message is sent (new session). Effectively the context changed and the previous error is no longer relevant.

To address that reuse of the same channel for a new session should be discouraged. That looks like a problem that does not need to exist, so I am hoping you can help me here.

Discussions I think may be relevant on LtU:
Error handling strategies
Erlang concurrency: why asynchronious messages?