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

render a large scene,get overflow #1895

Closed
geroge-d opened this issue Nov 19, 2019 · 5 comments
Closed

render a large scene,get overflow #1895

geroge-d opened this issue Nov 19, 2019 · 5 comments
Assignees
Labels
android Issue/feature request for Android only bug Something isn't working

Comments

@geroge-d
Copy link

Hi Guys
when I rendered a large scene,get the crash below.
JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump:
2019-11-19 18:55:07.613 java_vm_ext.cc:638] Last 10 entries (of 51200):
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51199: 0x7f5c9000 byte[] (14400 elements)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51198: 0x134b2b40 java.nio.HeapByteBuffer
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51197: 0x134b0f10 byte[] (7200 elements)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51196: 0x134b0ee0 java.nio.HeapByteBuffer
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51195: 0x134ae4a0 byte[] (10800 elements)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51194: 0x134ae470 java.nio.HeapByteBuffer
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51193: 0x13459c18 byte[] (768 elements)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51192: 0x13459be8 java.nio.HeapByteBuffer
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51191: 0x13458338 byte[] (6144 elements)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 51190: 0x13458308 java.nio.HeapByteBuffer
2019-11-19 18:55:07.613 java_vm_ext.cc:638] Summary:
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 24843 of java.nio.HeapByteBuffer (24843 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1554 of byte[] (768 elements) (1554 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1554 of byte[] (3072 elements) (1554 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1554 of byte[] (4608 elements) (1554 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1554 of byte[] (6144 elements) (1554 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1553 of byte[] (7200 elements) (1553 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1553 of byte[] (10800 elements) (1553 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1553 of byte[] (14400 elements) (1553 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1552 of byte[] (1800 elements) (1552 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 777 of android.graphics.Bitmap (1 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (1368 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (1440 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (2520 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (2592 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (5472 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (5760 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (8208 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (8640 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (10080 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (10368 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (10944 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (11520 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (15120 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (15552 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (20160 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 776 of byte[] (20736 elements) (776 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 340 of java.lang.Class (244 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 268 of java.nio.DirectByteBuffer (242 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 63 of java.lang.Thread (60 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 8 of android.os.HandlerThread (8 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 7 of android.app.LoadedApk$ReceiverDispatcher$InnerReceiver (7 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 5 of java.lang.ref.WeakReference (5 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 5 of android.database.ContentObserver$Transport (5 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 3 of java.lang.String (2 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 3 of java.lang.ThreadGroup (2 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 3 of android.view.ColorViewRootImplHooks$ColorW (3 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 3 of android.app.LoadedApk$ServiceDispatcher$InnerConnection (3 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 3 of android.content.ContentProvider$Transport (3 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 2 of dalvik.system.PathClassLoader (1 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 2 of android.opengl.EGLDisplay (1 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 2 of android.opengl.EGLSurface (1 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 2 of android.opengl.EGLContext (1 unique instances)
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.view.Choreographer$FrameSkipCallback
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of okio.AsyncTimeout$Watchdog
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of com.qualcomm.qti.Performance$PerfServiceDeathRecipient
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of dalvik.system.VMRuntime
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of com.android.okhttp.okio.AsyncTimeout$Watchdog
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.os.Binder
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.view.inputmethod.InputMethodManager$ControlledInputConnectionWrapper
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.view.WindowManagerGlobal$1
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.os.FileObserver$ObserverThread
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.bluetooth.BluetoothAdapter$1
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.view.inputmethod.InputMethodManager$1
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.hardware.display.DisplayManagerGlobal$DisplayManagerCallback
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.view.accessibility.AccessibilityManager$1
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.os.PersistableBundle$1
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.app.ActivityThread$ApplicationThread
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.net.ConnectivityThread
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.view.ThreadedRenderer$ProcessInitializer$1
2019-11-19 18:55:07.613 java_vm_ext.cc:638] 1 of android.telephony.PhoneStateListener$IPhoneStateListenerStub
2019-11-19 18:55:07.613 java_vm_ext.cc:638]
2019-11-19 18:55:08.071 runtime.cc:558] Runtime aborting...
2019-11-19 18:55:08.071 runtime.cc:558] Dumping all threads without appropriate locks held: thread list lock
2019-11-19 18:55:08.071 runtime.cc:558] All threads:
2019-11-19 18:55:08.071 runtime.cc:558] DALVIK THREADS (72):
2019-11-19 18:55:08.071 runtime.cc:558] "layer draw" prio=7 tid=72 Runnable
2019-11-19 18:55:08.071 runtime.cc:558] | group="" sCount=0 dsCount=0 flags=0 obj=0x163c0000 self=0x7c1f556800
2019-11-19 18:55:08.071 runtime.cc:558] | sysTid=30320 nice=-4 cgrp=default sched=0/0 handle=0x7c039b64f0
2019-11-19 18:55:08.071 runtime.cc:558] | state=R schedstat=( 43626218026 550427793 6483 ) utm=4188 stm=174 core=7 HZ=100
2019-11-19 18:55:08.071 runtime.cc:558] | stack=0x7c038b3000-0x7c038b5000 stackSize=1041KB
2019-11-19 18:55:08.071 runtime.cc:558] | held mutexes= "abort lock" "mutator lock"(shared held)
2019-11-19 18:55:08.071 runtime.cc:558] native: #00 pc 00000000003c3714 /system/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+220)
2019-11-19 18:55:08.071 runtime.cc:558] native: #1 pc 0000000000493568 /system/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits>&, bool, BacktraceMap*, bool) const+352)
2019-11-19 18:55:08.071 runtime.cc:558] native: #2 pc 00000000004ad168 /system/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+844)
2019-11-19 18:55:08.071 runtime.cc:558] native: #3 pc 00000000004a5fa8 /system/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+484)
2019-11-19 18:55:08.071 runtime.cc:558] native: #4 pc 00000000004a5220 /system/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits>&, bool)+500)
2019-11-19 18:55:08.071 runtime.cc:558] native: #5 pc 00000000004667b8 /system/lib64/libart.so (art::Runtime::Abort(char const*)+388)
2019-11-19 18:55:08.071 runtime.cc:558] native: #6 pc 0000000000008ce0 /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+724)
2019-11-19 18:55:08.071 runtime.cc:558] native: #7 pc 00000000002e827c /system/lib64/libart.so (art::JavaVMExt::AddGlobalRef(art::Thread*, art::ObjPtrart::mirror::Object)+304)
2019-11-19 18:55:08.071 runtime.cc:558] native: #8 pc 000000000032fd7c /system/lib64/libart.so (art::JNI::NewGlobalRef(_JNIEnv*, _jobject*)+612)
2019-11-19 18:55:08.071 runtime.cc:558] native: #9 pc 00000000000fe920 /system/lib64/libart.so (art::(anonymous namespace)::CheckJNI::NewRef(char const*, _JNIEnv*, _jobject*, art::IndirectRefKind)+760)
2019-11-19 18:55:08.071 runtime.cc:558] native: #10 pc 00000000001be80c /data/app/com.snapgify-FO0mkLh1FxDlyw71RhbR6w==/lib/arm64/libfilament-jni.so (_JNIEnv::NewGlobalRef(_jobject*)+48)
2019-11-19 18:55:08.071 runtime.cc:558] native: #11 pc 00000000001c9168 /data/app/com.snapgify-FO0mkLh1FxDlyw71RhbR6w==/lib/arm64/libfilament-jni.so (AutoBuffer::AutoBuffer(_JNIEnv*, _jobject*, int, bool)+116)
2019-11-19 18:55:08.071 runtime.cc:558] native: #12 pc 00000000001bbf50 /data/app/com.snapgify-FO0mkLh1FxDlyw71RhbR6w==/lib/arm64/libfilament-jni.so (Java_com_google_android_filament_IndexBuffer_nSetBuffer+124)
2019-11-19 18:55:08.071 runtime.cc:558] native: #13 pc 00000000005637e0 /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
2019-11-19 18:55:08.071 runtime.cc:558] native: #14 pc 0000000000123374 /dev/ashmem/dalvik-jit-code-cache (deleted) (com.google.android.filament.IndexBuffer.setBuffer+212)
2019-11-19 18:55:08.071 runtime.cc:558] native: #15 pc 00000000001295c4 /dev/ashmem/dalvik-jit-code-cache (deleted) (com.google.android.filament.IndexBuffer.setBuffer+68)

@romainguy
Copy link
Collaborator

Looks like global refs are either being leaked or there are too many of them. How many index/vertex buffers do you create? We should be releasing the refs after every upload. @bejado @prideout

@geroge-d
Copy link
Author

About 4000 index and vertex buffers.
Based our latest test, when render large scene, a lot crashes were caused by the following fix limitations:

  1. fixed size of OpenGLDriver ::mHandleArena
  2. fixed size of CommandBufferQueue::mCircularBuffer
    So In my opinion, it may be more flexible if Filament dynamicly increases these buffer size, for example to use a list of bucket memory, balance performance and flexibility

@romainguy
Copy link
Collaborator

I assume those 4,000 are visible in the frustum since they pass culling. While we could/should fix this, I would like to point out that 4,000 draw calls will lead to horrible CPU performance with current GL drivers.

@pixelflinger

@romainguy romainguy added android Issue/feature request for Android only bug Something isn't working labels Nov 21, 2019
@pixelflinger
Copy link
Collaborator

@geroge-d the current plan is not to dynamically grow those buffers, but to let you set their size when initializing the engine. This is not implemented yet.
Would that solution be satisfactory?

@pixelflinger
Copy link
Collaborator

duplicate of #2057

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issue/feature request for Android only bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants