I had to catch all exceptions (to mark the session as dirty) because user code in the callback could throw any (Runtime) exception in addition to the `IOException`.