Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Component used: gamesdk
Version used: agdk-libraries-2023.3.0.0.zip
Devices/Android versions reproduced on:
Honor X9a 5G (Android 13)
,IQOO 12 Pro (Android 14)
,Realme C51s (Android 13)
We are getting a few user crash reports with the following callstacks:
and:
These callstacks are coming from a thread that I do not recognize (i.e. it wasn't created by me explicitly).
We don't have more info than this unfortunately.
I tried to inspect the source code. Usually this type of bugs mean that mThreadPool got resized/cleared while it was being accessed. But as far as I can see all accesses to mThreadPool are correctly guarded by mThreadPoolMutex.
However I did find these two oddities:
Oddity 1: Possible race condition
Because the listener is added before the threads are spawned, theoretically it is possible that
onSettingsChanged()
gets called before the mThreadPoolMutex is locked. This would causelaunchThreadsLocked()
to be called twice and end up with twice the amount of spawn threads as intended. This could be a bug.If this is actually happening, there would be other bugs too (e.g. mUseAffinity is still uninitialized and onSettingsChanged() will attempt to read from it).
It may be fixed by moving the
addListener()
call afterlaunchThreadsLocked()
.Oddity 2: mThreadPool is not reserved
A rare bug in copy or move semantics could cause this code to malfunction if reallocation becomes necessary. It may be wise to reserve first:
I doubt this is the cause of the bug though.