Fix race between dex-file registration and class-loader deletion
We keep track of class-loaders by having a list with jweak references
to the dex-caches. When we register a new dex-file we check that the
dex-cache hasn't already been registered with a different
class-loader. We decoded the jweak and performed this check this
without any locks however meaning we could race with class-loader
cleanup. This could cause CHECK failures as we try to decode a deleted
jweak.
Bug: 147206162
Test: ./art/test/run-test --create-runner --host --prebuild --compact-dex-level fast --optimizing --no-relocate --runtime-option -Xcheck:jni 2001-virtual-structural-multithread
./art/tools/parallel_run.py
Change-Id: Ibeb12ec3d42f7972d09b155b7c24743266897a54
2 files changed