You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With coroutines it’s pretty common to use Call.enqueue() in the implementation of an Authenticator or Interceptor.
This ends badly because if the Dispatcher’s is at its configured limit there’s no thread to serve the enqueued call, and the overall network stack can deadlock!
We’ve documented this a bit, but it’s still a hazard. Especially when features like suspend on Wire gRPC and Retrofit make it very easy to use a background thread without even knowing it.
Rather than broadly warning everyone of the dangers of this antipattern, we should just make it so enqueued calls made on OkHttp’s Dispatcher thread don’t count against dispatcher limits. Those calls should be performed immediately. This will avoid deadlocks and remove a footgun from our API.
yschimke, ColtonIdle, ErnestG, agustinn1233 and rob4226