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
I work on an app, and had this emerging issue with retrofit blocking the UI Thread in Android 15 while when I test the same app installed on Android 12 using same recent retrofit 2.11 and okhttp 4.12 releases, I can't reproduce the issue.
The blocking takes place when the responding server, returns 503 unavailable service after request time out. It can be reproduced if you run proxy on port 443, which redirects requests to web server running on another port, and if you stop the web server, the proxy will try to connect to it and wait for few seconds until it times out, and Android has 16ms time limit for any process to run and render in UI Thread before ui thread blocking jarring can be observed degrading the user experience, and the proxy waits for response and takes more than several seconds and here where retrofit service running through enqueue causes the jarring.
I looked at every release changes from 12 to 15 and there is nothing related to the way I enqueue retrofit call. I tried to enclose enqueue and execute calls inside another Thread and it didn't make difference. It looks like at some point retrofit exits the Thread or makes early request to establish connection in the main thread, and as result of 503 unavailable service which takes several seconds to respond exceeding 16ms limit, it gets stuck in and blocks the UI Thread.
Please mind me for reporting this, as I'm not 100% sure if its a bug, it could be something wrong in my implementation causing the issue to take place when I execute e.g. following code inside fragment yet wonder why this doesnt happen in Android 12:-
I tried running fragmentView.setLayerType(View.LAYER_TYPE_HARDWARE, null); yet it didnt make difference.
Any suggestion would be appreciated, and if you can confirm this is a bug, please let me know on how I. can assisst if I can any further to get it fixed.
Hi there,
I work on an app, and had this emerging issue with retrofit blocking the UI Thread in Android 15 while when I test the same app installed on Android 12 using same recent retrofit 2.11 and okhttp 4.12 releases, I can't reproduce the issue.
The blocking takes place when the responding server, returns 503 unavailable service after request time out. It can be reproduced if you run proxy on port 443, which redirects requests to web server running on another port, and if you stop the web server, the proxy will try to connect to it and wait for few seconds until it times out, and Android has 16ms time limit for any process to run and render in UI Thread before ui thread blocking jarring can be observed degrading the user experience, and the proxy waits for response and takes more than several seconds and here where retrofit service running through enqueue causes the jarring.
This is on Android 15
https://github.com/user-attachments/assets/7eeeec43-b157-4387-9759-ebc03b9e24e2
This is on Android 12
https://github.com/user-attachments/assets/aeaaf8d8-eb3d-40b4-b636-1a82df5ee764
I looked at every release changes from 12 to 15 and there is nothing related to the way I enqueue retrofit call. I tried to enclose enqueue and execute calls inside another Thread and it didn't make difference. It looks like at some point retrofit exits the Thread or makes early request to establish connection in the main thread, and as result of 503 unavailable service which takes several seconds to respond exceeding 16ms limit, it gets stuck in and blocks the UI Thread.
Please mind me for reporting this, as I'm not 100% sure if its a bug, it could be something wrong in my implementation causing the issue to take place when I execute e.g. following code inside fragment yet wonder why this doesnt happen in Android 12:-
I tried running fragmentView.setLayerType(View.LAYER_TYPE_HARDWARE, null); yet it didnt make difference.
Any suggestion would be appreciated, and if you can confirm this is a bug, please let me know on how I. can assisst if I can any further to get it fixed.
With thanks.
Zakaria.
Source
https://developer.android.com/studio/profile/jank-detection
The text was updated successfully, but these errors were encountered: