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

Android asyncCancelLoad causing crash #7650

Open
akshaytaru2007 opened this issue Mar 11, 2024 · 6 comments
Open

Android asyncCancelLoad causing crash #7650

akshaytaru2007 opened this issue Mar 11, 2024 · 6 comments
Assignees
Labels
gltf Specific to glTF support

Comments

@akshaytaru2007
Copy link

⚠️ Issues not using this template will be systematically closed.

Describe the bug
I am getting the crash in Android which is pointing to resourceLoader asyncCancelLoad

To Reproduce
Steps to reproduce the behavior:
Code:

var asset: FilamentAsset? = null
        private set
private var resourceLoader: ResourceLoader

.
.
.

resourceLoader = ResourceLoader(engine, normalizeSkinningWeights)


fun loadModelEmbeddedGltf(buffer: Buffer) {
        
        destroyModel()
        asset = assetLoader.createAsset(buffer)
        asset?.let { asset ->
            
            this.resourceLoader.asyncBeginLoad(asset)
            this.animator = asset.instance.animator
            asset.releaseSourceData()
        }
    }



    fun destroyModel() {    
        resourceLoader.asyncCancelLoad()

        resourceLoader.evictResourceData()
        asset?.let { asset ->
            this.scene.removeEntities(asset.entities)
            assetLoader.destroyAsset(asset)
            this.asset = null
            this.animator = null
        }
    }

What I am trying to do:
I have model say Cube. Use can tap on it to change color. User can select different color and everytime user taps the model gets rendered.

Steps:

  1. I load my model when user taps and it calls loadModelEmbeddedGltf()
  2. If user taps multiple times, I am getting above error.

I m not sure why this is happening, I m trying to understand what is going wrong. I am just fixing the issue that I am facing.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Logs

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone64_arm64/emu64a:14/UE1A.230829.036.A1/11228894:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-03-11 19:43:11.842770963+0530
Process uptime: 310s
Cmdline: com.myapp.develop
pid: 16161, tid: 17606, name: JNISurfaceTextu  >>> com.myapp.develop <<<
uid: 10191
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xb400006c8b6ca18c
    x0  b400006ea2329210  x1  0000000002394a18  x2  000000000000000a  x3  0000000000000001
    x4  00000000000084fe  x5  0000000000002600  x6  00000000000026fe  x7  0000000000002801
    x8  0000006c52829d00  x9  000000002394a180  x10 0000000000000312  x11 0000000000000000
    x12 0000000000000000  x13 0000000000000000  x14 0000006c52829d50  x15 0000006c52829d60
    x16 b400006ea232a808  x17 00000000001fffbe  x18 0000006c4ea42000  x19 aaaaaaaaaaaaaaab
    x20 b400006ea2329210  x21 b400006c67d80170  x22 000000000000000c  x23 0000006c52829d00
    x24 b400006da225f500  x25 0000000000000008  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000001  x29 b400006c8b6ca180
    lr  0000006c8e7554ac  sp  0000006cfdcfb950  pc  0000006c8e75d670  pst 0000000000001000
1 total frames
backtrace:
      #00 pc 000000000015d670  /data/app/~~91yPX3rb5z0ROeuEN0ZHWA==/com.myapp.develop-hHxUCtAf_xZszGSo3fbORQ==/lib/arm64/libfilament-jni.so (BuildId: bbfa6b6da6f7e3152f06532e8d0ec8f193401536)

Desktop (please complete the following information):

  • OS: Android

Smartphone (please complete the following information):

  • Device: Emulator
  • OS: Android 14

Additional context
I am trying to understand the root cause of the problem.

@pixelflinger pixelflinger added the gltf Specific to glTF support label Mar 12, 2024
@akshaytaru2007
Copy link
Author

@poweifeng Any update on this?

@pixelflinger This happens when user taps very quickly. I can prevent that if I can get a callback from which let us know that view being rendered and view is rendered.
So, we can block UI and release once view is rendered.

I didn't find any such callback in documentation.

Thanks

@poweifeng
Copy link
Contributor

Sorry for the delay, I'll take a look in the next few days.

@akshaytaru2007
Copy link
Author

@poweifeng Did you get time to look into this? Please take a look, we are having crash in production.

@poweifeng
Copy link
Contributor

I did identify a crash, though I don't know if it's related to the crash here. But I'll update soon.

@poweifeng
Copy link
Contributor

I'm unable to reproduce your crash. Can you share the following:

  • a gltf (I assume glb?) file that crashes
  • the version of Filament that you're using.

Thanks!

@akshaytaru2007
Copy link
Author

@poweifeng I am trying to reproduce the bug in a different project so I can share the link.
Meanwhile, what do you think is the crash? I would appreciate your insights. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gltf Specific to glTF support
Projects
None yet
Development

No branches or pull requests

3 participants