okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

Thread Unsafe detection for Sink, Source, Filesystem, Response etc.

Open yschimke opened this issue 4 years ago • 1 comments

The class of bugs like https://github.com/square/okhttp/issues/6723 are tricky to hunt down. We should consider how to wrap key Okio or OkHttp abstractions to detect unsafe thread use.

Maybe one that records and warns on switching threads, or concurrent use, or after a failure prints out the observed threads for any operation failing with a RuntimeException.

yschimke avatar Jun 23 '21 04:06 yschimke

Probably also dual reading of a response? like a debug call to .string() before continuing to consume.

yschimke avatar Jun 27 '21 17:06 yschimke

No current plans, and most recent issue was actually a WebSocket concurrency bug.

yschimke avatar May 20 '23 20:05 yschimke

I think it's nice to have something like this, we're currently having a hard time troubleshooting inconsistent Segments... This doesn't happen a lot though

wylswz avatar Feb 21 '24 06:02 wylswz