Mojo adds a flag to its trap events indicating whether the event came from a local API call or from an external stimulus (i.e. a real IPC event).
SimpleWatcher in turn uses this, if woken up on the right sequence, to decide whether to dispatch synchronously or schedule a dispatch task asynchronously: if the event came from OOP it's safe to dispatch synchronously without fear of re-entrancy.
The synchronous dispatch however can in turn trigger yet more traps to be tripped and thus more events to be fired. These events inherit the source of the original event, so if the original event came from a real IPC, all nested events will also appear to come from real IPC and can thus synchronously dispatch as well.
This is wrong. Nested trap events should appear to come from local API calls. Otherwise it's trivial for e.g. a bindings error handler to trigger infinite recursion by running on the same sequence as internal IPC and e.g. attempting (and failling) to reconnect a pipe each time.
Easy fix, mojo::edk::RequestContext should explicitly use LOCAL_API_CALL as its source when nested within ~RequestContext.
Comment 1 by bugdroid1@chromium.org
, Jun 1 2018