Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException "AssetManager has been finalized!" #563

Closed
inio opened this issue Sep 12, 2018 · 12 comments
Closed

IllegalStateException "AssetManager has been finalized!" #563

inio opened this issue Sep 12, 2018 · 12 comments
Labels

Comments

@inio
Copy link

inio commented Sep 12, 2018

We've seen a couple reports of this issue.

In some situations, an ARCore operation will fail with a FatalException and the logcat will show:

java.lang.IllegalStateException: AssetManager has been finalized!
...
android.content.ContextWrapper.createPackageContext(ContextWrapper.java:851)

We are still searching for the root cause of this error.

@inio inio added the bug label Sep 12, 2018
@inio
Copy link
Author

inio commented Sep 12, 2018

Replying for bookkeeping purposes.

@inio
Copy link
Author

inio commented Sep 12, 2018

@wuzeqin and @Calence have seen this.

@inio
Copy link
Author

inio commented Sep 29, 2018

@siny-yao sees this show up as a crash in native code in session create, with the actual failure in art::ScopedCheck::CheckThread(_JNIEnv*) due to a pending exception (S7 issue in #584). @wuzeqin separately sees the art::ScopedCheck::CheckThread(_JNIEnv*) crash with an identical stack (#586), which I'm going to to assume is caused by the same pending exception.

@siny-yao
Copy link

which I'm going to to assume is caused by the same pending exception.

This seems to be the same problem

@inio
Copy link
Author

inio commented Sep 30, 2018

In previous attempts we'd been unable to reproduce this issue. To help test a workaround, could someone who is able to reliably reproduce this issue try the following?

In your Activity, add the following bits:

at the class scope:

static Context remoteArCoreContext;
static AssetManager remoteArCoreAssets;

in onCreate:

if (remoteArCoreContext == null) {
  remoteArCoreContext = createPackageContext("com.google.ar.core", 0);
  remoteArCoreAssets = remoteArCoreContext.getAssets();
}

Our current best theory is that this is actually an Android bug where the remote asset loader (that we use to load stuff from ARCore APK, like device calibration) is getting garbage collected and then can't be recreated. Holding a copy of it would prevent the garbage collection from happening.

@inio
Copy link
Author

inio commented Oct 1, 2018

@wuzeqin, @Calence, @siny-yao: If any of you can reliably produce the "AssetManager has been finalized" error, please try adding the above lines to your Activity and let me know if you are still able to produce the failure.

@wuzeqin
Copy link

wuzeqin commented Oct 8, 2018

I try your advice in SM-G9600/DS the "AssetManager has been finalized" error still occur .
Wacky thing is that once the crash occur, app reopen , ArSession_create method must crash.
But I found that when crash occurred , the only way to solve it was uninstalling the ARCore.apk and reloading a new one.
ps:Clean ARCore.apk data and cache both are useless

@inio
Copy link
Author

inio commented Oct 8, 2018

Thanks for trying that. Good news is we've found a way of reproducing this reliably and are looking into fixes.

@wuzeqin
Copy link

wuzeqin commented Oct 12, 2018

@inio May I ask you about the progress of fixing this bug ? Waitting for your good news. Thank you.

@inio
Copy link
Author

inio commented Oct 12, 2018

None yet, but haven't had cycles to look at this recently. Hoping to have some time before 1.6 branches.

@inio
Copy link
Author

inio commented Oct 18, 2018

We've just released an update (1.5.1) with a minor improvement on this: The crash some users started seeing in 1.5 should now be back to a FatalException during session create. This update is available through the Play Store and can be downloaded on our releases page.

@fredsa
Copy link
Contributor

fredsa commented Jan 10, 2019

Fixed in ARCore for Unity SDK 1.6.0

@fredsa fredsa closed this as completed Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants