okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

RealEventSource lost control on Error

Open chinafzy opened this issue 1 year ago • 1 comments

As shown in the code snippet, if an Error (such as OutOfMemoryError or StackOverflowError, which are common) is thrown at line 78, the catch block at line 81 will not catch this Error, and neither the onFailure nor onClose hooks will be called. Consequently, the processing flow will terminate silently. Therefore, it is recommended to catch Throwable instead.

okhttp_bug

chinafzy avatar Jun 30 '24 10:06 chinafzy

I think we've generally avoided handling Throwables as failures app can deal with.

The state of OkHttpClient is generally unknown, so I'm inclined to leave this as unhandled.

yschimke avatar Apr 26 '25 10:04 yschimke