This occurs in the default Tomcat in Grails 3.2.5 though I suspect it will occur in all previous Tomcat versions as well. It appears that the Catalina AsyncContextImpl does not handle an exception thrown by the Runnable passed to start(), so no AsyncListeners are notified. I'm not sure whether this is a bug in Tomcat or not (my Google-fu didn't turn up whether AsyncContext.start() was supposed to notify any listeners).
See a demo here: https://github.com/sbearcsiro/grailsrxdemo. I would expect the EventSource should close and reconnect on the client after the Exception is thrown. Note also that a unit test won't display this problem as the Spring MockAsyncContext executes the start() call on the same thread, so the exception bubbles back into the RxJava Observable which does call onError with the exception.
It seems to me that in the case of a NewObservableResult argument to the RxResultTransformer it should, by default, subscribe on the AsyncContext.start() thread. This would match the behaviour if an Observable is passed in. PR incoming...
This occurs in the default Tomcat in Grails 3.2.5 though I suspect it will occur in all previous Tomcat versions as well. It appears that the Catalina AsyncContextImpl does not handle an exception thrown by the Runnable passed to start(), so no AsyncListeners are notified. I'm not sure whether this is a bug in Tomcat or not (my Google-fu didn't turn up whether AsyncContext.start() was supposed to notify any listeners).
See a demo here: https://github.com/sbearcsiro/grailsrxdemo. I would expect the
EventSource
should close and reconnect on the client after the Exception is thrown. Note also that a unit test won't display this problem as the SpringMockAsyncContext
executes thestart()
call on the same thread, so the exception bubbles back into the RxJava Observable which does callonError
with the exception.It seems to me that in the case of a
NewObservableResult
argument to theRxResultTransformer
it should, by default, subscribe on theAsyncContext.start()
thread. This would match the behaviour if anObservable
is passed in. PR incoming...