Synchronize on parcel for LazyValue methods
With the changes introduced in ag/18795008, the parcel underlying a Bundle's LazyValues is recycled once all the LazyValues have been unwrapped. This has introduced a new race condition. If a key with an wrapped LazyValue is accessed (in thread A), while simultaneously a different thread (B) writes the bundle to a Parcel, B may check the parcel is unrecycled before A finishes unwrapping it, then try to copy the parcel after it is recycled by A. To avoid this, we now synchronize on the parcel in all methods where it's contents need to be accessed after the initial check. Bug: 267096262 Test: Debugged with break points in critical section to reproduce before and after fix Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest Change-Id: I055d31892e46574b9e450ece7f5042a9eb185c40
Loading
Please register or sign in to comment