Android Question ANR after setting targetSdkVersion="35"

Alessandro71

Well-Known Member
Licensed User
Longtime User
since i've updated my app to targetSdkVersion="35", the play console vitals has begun showing an ANR event that wasn't present before
1754479413284.png


1754479452234.png


i did no code changes to the app other than setting the manifest file as per https://www.b4x.com/android/forum/threads/targetsdkversion-35-requirement.167604/

i also have no clue about what is "jdk.internal.misc.Unsafe.park"

the Pre-launch report also did not show any stability of performance issues
 

drgottjr

Expert
Licensed User
Longtime User
this particular issue is not new, so it isn't necessarily related to sdk35. the report describes jdk.internal.misc.Unsafe.park. it is a kind of "wait" used in conjunction with a thread pool.

my understanding is that you cannot call jdk.internal.misc.Unsafe.park yourself, so if you're coding in b4a, then the use of thread pools is probably beyond your control. even if you are coding in java and use the executors class for running background threads, jdk.internal.misc.Unsafe.park is used by the system to make sure things don't get out of hand.

if the system has called jdk.internal.misc.Unsafe.park when running a thread, and it times out waiting for that thread or if the thread is interrupted, this can cause an anr if the main thread has been waiting for some background thread (which has been run using the executors class). if you google "jdk.internal.misc.Unsafe.park", you'll see it is a known issue. network problems are an example of what might cause the exception.
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
known facts so far:
1) issue has begun with the upload of the SDK35 version: see the chart, no issue before July 17
2) no code changes in the app besides setting the options in the manifest for SDK 35 and edge-to-edge opt out

since it's an ANR and not a crash, i have no crash report and no idea of where/when it happens.
the app has no network connections, pure B4A, no inline java.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
this particular issue is not new, so it isn't necessarily related to sdk35. the report describes jdk.internal.misc.Unsafe.park. it is a kind of "wait" used in conjunction with a thread pool.
I'm not familiar with such ANR issue and it isn't related to Wait For or resumable subs (which do not lock anything).

There isn't enough information in this report to say anything.
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
There isn't enough information in this report to say anything.
I understand, and I also have no clue how to pinpoint the affected code: I'm just tracking this issue in case someone else might get the same error and will be able to better define it.
 
Upvote 0
Top