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

crash with 'no more slots for eglGetProcAddress' errors when running triangles example on 'arm-linux-androideabi' target #1375

Open
rjanicek opened this issue Dec 18, 2015 · 5 comments
Labels

Comments

@rjanicek
Copy link

  • followed steps in 'android-rs-glue'
  • Ubuntu 15.10 in VirtualBox VM
  • android-ndk-r10e-linux-x86_64
  • android-sdk_r24.4.1-linux
  • rustc 1.7.0-dev (ce7bc5193 2015-12-16)
  • cargo build --example triangle --target=arm-linux-androideabi
  • changed types to expected to fix build errors see: 'mismatched types' errors when building 'arm-linux-androideabi' target #1374
  • copied apk to Nexus 9
  • attached Android Device Monitor
  • running caused errors and crash
  • using same steps above, I was able to build and run android-rs-glue example which seemed to run ok
12-17 21:38:50.270: W/linker(2911): /data/app/com.example.native_activity-1/lib/arm/libmain.so: is missing DT_SONAME will use basename as a replacement: "libmain.so"
12-17 21:38:50.347: V/threaded_app(2911): Creating: 0xab548810
12-17 21:38:50.348: V/threaded_app(2911): Config: mcc=0 mnc=0 lang=en cnt=US orien=2 touch=3 dens=320 keys=1 nav=1 keysHid=3 navHid=0 sdk=23 size=4 long=1 modetype=1 modenight=1
12-17 21:38:50.348: V/threaded_app(2911): Start: 0xab548810
12-17 21:38:50.352: D/RustAndroidGlueStdouterr(2911): Entering android_main
12-17 21:38:50.354: D/RustAndroidGlueStdouterr(2911): created application thread
12-17 21:38:50.355: V/threaded_app(2911): activityState=10
12-17 21:38:50.355: V/threaded_app(2911): Resume: 0xab548810
12-17 21:38:50.355: V/threaded_app(2911): activityState=11
12-17 21:38:50.379: V/threaded_app(2911): InputQueueCreated: 0xab548810 -- 0xab7422d0
12-17 21:38:50.380: V/threaded_app(2911): APP_CMD_INPUT_CHANGED
12-17 21:38:50.380: V/threaded_app(2911): Attaching input queue to looper
12-17 21:38:50.400: V/threaded_app(2911): NativeWindowCreated: 0xab548810 -- 0xab7731a0
12-17 21:38:50.400: V/threaded_app(2911): APP_CMD_INIT_WINDOW
12-17 21:38:50.401: V/threaded_app(2911): WindowFocusChanged: 0xab548810 -- 1
12-17 21:38:50.404: I/Keyboard.Facilitator(16857): onFinishInput()
12-17 21:38:50.420: I/ActivityManager(608): Displayed com.example.native_activity/android.app.NativeActivity: +413ms (total +6m43s492ms)
12-17 21:38:50.655: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMaterialiv")
12-17 21:38:50.655: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexEnvfvEXT")
12-17 21:38:50.655: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexEnvivEXT")
12-17 21:38:50.655: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexGendvEXT")
12-17 21:38:50.655: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexGenfvEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexGenivEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexImageEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexLevelParameterfvEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexLevelParameterivEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexParameterIivEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexParameterIuivEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexParameterfvEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetMultiTexParameterivEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetNamedBufferParameteri64v")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetNamedBufferParameteriv")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetNamedBufferParameterivEXT")
12-17 21:38:50.656: E/libEGL(2911): no more slots for eglGetProcAddress("glGetNamedBufferPointerv")
.
.
.
... hundreds more 'no more slots for eglGetProcAddress' errors...
.
.
.
12-17 21:38:50.756: D/RustAndroidGlueStdouterr(2911): thread '<unnamed>' panicked at 'gl function was not loaded', /home/rjanicek/kinetic/glium/target/arm-linux-androideabi/debug/build/glium-04d27c05ea16a55b/out/gl_bindings.rs:7241
12-17 21:38:52.960: V/threaded_app(2911): New input event: type=2
12-17 21:38:52.961: D/RustAndroidGlueStdouterr(2911): thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', ../rust/src/libcore/result.rs:688
12-17 21:38:52.961: A/libc(2911): Fatal signal 4 (SIGILL), code 1, fault addr 0xe25e2278 in tid 2924 (native_activity)
12-17 21:38:53.038: A/DEBUG(213): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-17 21:38:53.038: A/DEBUG(213): Build fingerprint: 'google/volantis/flounder:6.0.1/MMB29K/2419427:user/release-keys'
12-17 21:38:53.038: A/DEBUG(213): Revision: '0'
12-17 21:38:53.038: A/DEBUG(213): ABI: 'arm'
12-17 21:38:53.039: A/DEBUG(213): pid: 2911, tid: 2924, name: native_activity  >>> com.example.native_activity <<<
12-17 21:38:53.039: A/DEBUG(213): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xe25e2278
12-17 21:38:53.059: A/DEBUG(213):     r0 00000000  r1 00000000  r2 00000001  r3 00000001
12-17 21:38:53.060: A/DEBUG(213):     r4 e1824040  r5 e26e0d84  r6 e1846000  r7 e26d1840
12-17 21:38:53.060: A/DEBUG(213):     r8 e26e0d84  r9 e1824040  sl 00000650  fp f44812d8
12-17 21:38:53.060: A/DEBUG(213):     ip 00000008  sp f4481070  lr e25e2888  pc e25e2278  cpsr 800f0010
12-17 21:38:53.089: A/DEBUG(213): backtrace:
12-17 21:38:53.089: A/DEBUG(213):     #00 pc 00424278  /data/app/com.example.native_activity-1/lib/arm/libmain.so (rust_panic+252)
12-17 21:38:53.090: A/DEBUG(213):     #01 pc 003f2e58  /data/app/com.example.native_activity-1/lib/arm/libmain.so (sys_common::unwind::begin_unwind_inner::hd47d97c1a03de63cQQs+756)
12-17 21:38:53.090: A/DEBUG(213):     #02 pc 003f3dcc  /data/app/com.example.native_activity-1/lib/arm/libmain.so (sys_common::unwind::begin_unwind_fmt::h41e837144ac0f3bdWPs+176)
12-17 21:38:53.090: A/DEBUG(213):     #03 pc 00424328  /data/app/com.example.native_activity-1/lib/arm/libmain.so (rust_begin_unwind+64)
12-17 21:38:53.090: A/DEBUG(213):     #04 pc 0046dd60  /data/app/com.example.native_activity-1/lib/arm/libmain.so (panicking::panic_fmt::h826c3c48f653f928PnK+52)
12-17 21:38:53.090: A/DEBUG(213):     #05 pc 003e47b4  /data/app/com.example.native_activity-1/lib/arm/libmain.so (result::Result$LT$T$C$$u20$E$GT$::unwrap::unwrap::h6292243384297862783+372)
12-17 21:38:53.090: A/DEBUG(213):     #06 pc 003e2a90  /data/app/com.example.native_activity-1/lib/arm/libmain.so (send_event::h7305715ab3c91bc5rCc+764)
12-17 21:38:53.090: A/DEBUG(213):     #07 pc 003ed72c  /data/app/com.example.native_activity-1/lib/arm/libmain.so (inputs_callback::__rust_abi+1472)
12-17 21:38:53.090: A/DEBUG(213):     #08 pc 003ed160  /data/app/com.example.native_activity-1/lib/arm/libmain.so (inputs_callback::h3035ab2696dfda91rDc+28)
12-17 21:38:53.091: A/DEBUG(213):     #09 pc 004a6330  /data/app/com.example.native_activity-1/lib/arm/libmain.so (process_input+160)
12-17 21:38:53.425: W/ActivityManager(608):   Force finishing activity com.example.native_activity/android.app.NativeActivity
12-17 21:38:53.425: A/DEBUG(213): Tombstone written to: /data/tombstones/tombstone_05
12-17 21:38:53.426: E/DEBUG(213): AM write failed: Broken pipe
12-17 21:38:53.438: I/BootReceiver(608): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
12-17 21:38:53.475: E/JavaBinder(608): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 112)
12-17 21:38:53.477: I/WindowState(608): WIN DEATH: Window{bb9061f u0 com.example.native_activity/android.app.NativeActivity}
12-17 21:38:53.477: W/InputDispatcher(608): channel 'bb9061f com.example.native_activity/android.app.NativeActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
12-17 21:38:53.477: E/InputDispatcher(608): channel 'bb9061f com.example.native_activity/android.app.NativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-17 21:38:53.477: W/InputDispatcher(608): Attempted to unregister already unregistered input channel 'bb9061f com.example.native_activity/android.app.NativeActivity (server)'
12-17 21:38:53.480: W/ActivityManager(608): Exception thrown during pause
12-17 21:38:53.480: W/ActivityManager(608): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
12-17 21:38:53.480: W/ActivityManager(608):     at android.os.BinderProxy.transactNative(Native Method)
12-17 21:38:53.480: W/ActivityManager(608):     at android.os.BinderProxy.transact(Binder.java:503)
12-17 21:38:53.480: W/ActivityManager(608):     at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:867)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2907)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2763)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2760)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:12037)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11933)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12622)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12129)
12-17 21:38:53.480: W/ActivityManager(608):     at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
12-17 21:38:53.485: I/Zygote(222): Process 2911 exited due to signal (4)
12-17 21:38:53.486: E/lowmemorykiller(166): Error opening /proc/2911/oom_score_adj; errno=2
12-17 21:38:53.493: I/ActivityManager(608): Process com.example.native_activity (pid 2911) has died

@tomaka
Copy link
Member

tomaka commented Dec 18, 2015

It looks like this is a bug on some Android devices :-/

@tomaka tomaka added the T-bug label Dec 18, 2015
@tomaka
Copy link
Member

tomaka commented Dec 18, 2015

As far as I know, the only way to fix this is to link at compile-time to GL.so instead of using eglGetProcAddress. That's what Servo is doing.

However there's no way for the user to tell at compile-time which version of OpenGL is expected. This means that by default we would have to limit ourselves to OpenGL ES 2.0 even on devices that support version 3.

@rjanicek
Copy link
Author

Would it be feasible to add a cargo feature to allow developer to chose if they would like a 'compatibility' mode that would enable GL.SO ?

@rikusalminen
Copy link

Looks like you can only load 64 extension pointers with Android AOSP's libEGL wrapper: https://github.com/cozybit/aosp-frameworks-base/blob/master/opengl/libs/EGL/getProcAddress.cpp#L85

Some vendors may apply downstream changes to AOSP to work around this limitation.

As a workaround, glium could not attempt to load some extensions that are obviously not available in the current context (e.g. glMaterial* on GLES).

As a practical note, there are very few cases where you actually don't know at compile time whether you'll be running on Big-GL or GLES (when shipping an end-user game/application, not middleware like glium). In particular on Android, where very few devices have Big-GL. Perhaps the best (least bad) workaround is to use an ugly #ifdef android here?

@paroj
Copy link

paroj commented Oct 2, 2017

we got this issue in OGRE as well:
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=93565

a viable workaround is to use dlsym instead of eglGetProcAddress on android:
https://github.com/OGRECave/ogre/blob/master/RenderSystems/GLES2/src/glesw.c#L106-L116

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