Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested

My android app has a page who owns unityplayer. While quick open my page, then leave this page, the app will crash. I have add unityplayer.pause() in activity’s onPause method. After pause() was called, I still find Unity log. Is there anyone can help me ?

The main crash log is :
Unity : [EGL] Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
CRASH : Cause: null pointer dereference

There is my crash stack and event log:
01-04 06:15:08.817 997 7079 I am_proc_start: [0,32736,10077,com.laurel.test,activity,com.laurel.test/.main.MainActivity]
01-04 06:15:08.904 997 7079 I am_restart_activity: [0,81389276,13158,com.laurel.test/.main.MainActivity]
01-04 06:15:08.909 997 7079 I am_set_resumed_activity: [0,com.laurel.test/.main.MainActivity,minimalResumeActivityLocked]

01-04 06:15:09.302 997 7079 I am_create_activity: [0,161111133,13159,com.sportq.fit.swatch/.activity.SplashActivity,android.intent.action.MAIN,NULL,NULL,270532608]

//call UnitySendMessage method
01-04 06:15:09.435 32736 32736 D test_unity: [test_unity][main]UnityPlayerPresenter updatePet action = Idle
01-04 06:15:09.437 32736 32736 D test_unity: [test_unity][main]UnityPlayerPresenter updatePetBg themeBgStr = default_theme_bg.png

//The activity has call onPause
01-04 06:15:09.458 32736 32736 I am_on_resume_called: [0,com.laurel.test.main.MainActivity,LAUNCH_ACTIVITY]
01-04 06:15:09.489 32736 32736 I am_on_paused_called: [0,com.laurel.test.main.MainActivity,handlePauseActivity]

//Unity not pause, Still Run.
01-04 06:15:10.202 32736 32756 I Unity : SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 4, Memory = 878mb
01-04 06:15:10.202 32736 32756 I Unity : SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf), 0 little (mask: 0x0)
01-04 06:15:10.203 32736 32756 I Unity : ApplicationInfo com.laurel.test version 1.0.3_1327099_210324 build fb576606-0503-4166-b17e-667680997a00
01-04 06:15:10.203 32736 32756 I Unity : Built from ‘2020.1/china_unity/release’ branch, Version ‘2020.1.14f1c1 (c509e564d0e4)’, Build type ‘Release’, Scripting Backend ‘il2cpp’, CPU ‘armeabi-v7a’, Stripping ‘Enabled’

01-04 06:15:10.835 590 1006 E BufferQueueProducer: [SurfaceView - com.laurel.test/com.laurel.test.main.MainActivity#0] connect: BufferQueue has been abandoned
01-04 06:15:10.836 32736 32756 E libEGL : eglCreateWindowSurface: native_window_api_connect (win=0x903f7808) failed (0xffffffed) (already connected to another API?)
01-04 06:15:10.836 32736 32756 E libEGL : eglCreateWindowSurface:693 error 3003 (EGL_BAD_ALLOC)
01-04 06:15:10.836 32736 32756 E Unity : [EGL] Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
01-04 06:15:10.836 32736 32756 E Unity : (Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 148)
01-04 06:15:10.836 32736 32756 E Unity :
01-04 06:15:10.856 32736 32756 E CRASH : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-04 06:15:10.856 32736 32756 E CRASH : Version ‘2020.1.14f1c1 (c509e564d0e4)’, Build type ‘Release’, Scripting Backend ‘il2cpp’, CPU ‘armeabi-v7a’
01-04 06:15:10.856 32736 32756 E CRASH : Build fingerprint: ‘OPPO/OW20W1/OW20W1:8.1.0/OPM1.171019.026.11_A.16.210327195018/01:user/release-keys’
01-04 06:15:10.856 32736 32756 E CRASH : Revision: ‘0’
01-04 06:15:10.856 32736 32756 E CRASH : ABI: ‘arm’
01-04 06:15:10.856 32736 32756 E CRASH : Timestamp: 2019-01-04 06:15:10+0800
01-04 06:15:10.856 32736 32756 E CRASH : pid: 32736, tid: 32756, name: UnityMain >>> com.laurel.test <<<
01-04 06:15:10.857 32736 32756 E CRASH : uid: 10077
01-04 06:15:10.857 32736 32756 E CRASH : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
01-04 06:15:10.857 32736 32756 E CRASH : Cause: null pointer dereference
01-04 06:15:10.857 32736 32756 E CRASH : r0 00000000 r1 8ffbdee0 r2 00000041 r3 80000000
01-04 06:15:10.857 32736 32756 E CRASH : r4 8d64b8e8 r5 8d64bc84 r6 8d4c2730 r7 8eec3740
01-04 06:15:10.857 32736 32756 E CRASH : r8 8d64b8e8 r9 8d649380 r10 8eec3740 r11 8eec38dc
01-04 06:15:10.857 32736 32756 E CRASH : ip aa621d98 sp 8eec36f0 lr 8f9088d0 pc 8f867cfc
01-04 06:15:10.857 32736 32756 E CRASH :
01-04 06:15:10.857 32736 32756 E CRASH : backtrace:
01-04 06:15:10.857 32736 32756 E CRASH : #00 pc 00160cfc /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.857 32736 32756 E CRASH : #01 pc 002018cc /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.857 32736 32756 E CRASH : #02 pc 00201528 /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.857 32736 32756 E CRASH : #03 pc 001ef7e4 /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.857 32736 32756 E CRASH : #04 pc 001eee40 /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #05 pc 0048374b /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #06 pc 00366a0c /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #07 pc 00366c80 /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #08 pc 001d941b /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #09 pc 001cbde5 /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #10 pc 001cc8fb /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #11 pc 001da68d /data/app/TestUnityDemo/lib/arm/libunity.so (BuildId: 0a868cfcc1b0df5cd820392dbcb7f3226723cf1d)
01-04 06:15:10.858 32736 32756 E CRASH : #12 pc 0001c7eb /data/app/TestUnityDemo/oat/arm/TestUnityDemo.odex (BuildId: 764bb7df4970f32519b1f7a045865a35edc7dd9f)

The activity’s destroy method run before unity init.
01-04 06:15:10.181 997 2733 I am_finish_activity: [0,81389276,13158,com.laurel.test/.main.MainActivity,app-request]
01-04 06:15:10.202 32736 32756 I Unity : SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 4, Memory = 878mb

If the unity can’t stop UnityPlayer init action after activity finish , Unity should not crash ,even if it got egl window failed.
Am i right? Did Anyone have the same problem as me?

Is the phone’s system 's problem?

Does your application have Optimized Frame Pacing enabled? If so, does disabling that option in PlayerSettings resolve the crash?

Yes, the Optimized Frame Pacing enabled is checked. I will try your suggestion,Thank you very much.