RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

Crash at ManagerRender.drawScreen

Open insidefun opened this issue 4 years ago • 29 comments

RTMP, OpenGlView, No filters, Front camera

Fatal Exception: java.lang.RuntimeException: drawScreen end. GL error: 1285
       at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:126)
       at com.pedro.encoder.input.gl.render.ScreenRender.draw(ScreenRender.java:115)
       at com.pedro.encoder.input.gl.render.ManagerRender.drawScreen(ManagerRender.java:66)
       at com.pedro.rtplibrary.view.OpenGlView.run(OpenGlView.java:144)
       at java.lang.Thread.run(Thread.java:929)

insidefun avatar Dec 11 '20 12:12 insidefun

That error means OutOfMemory. Do you have any way to reproduce it? Do you have this error with all devices?

pedroSG94 avatar Dec 14 '20 09:12 pedroSG94

image

Based on firebase info, devices had enought memory

insidefun avatar Dec 14 '20 13:12 insidefun

Acording with android documentation 1285 is out of memory: https://developer.android.com/reference/android/opengl/GLES20#GL_OUT_OF_MEMORY

The question is, why only in certains devices? Do you have any way to know if your user is streaming long time before get this crash? Maybe I'm not releasing something properly

pedroSG94 avatar Dec 14 '20 14:12 pedroSG94

I'm facing a similar issue mostly on Samsung devices image

Fatal Exception: java.lang.RuntimeException: drawScreen end. GL error: 1285
       at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:142)
       at com.pedro.encoder.input.gl.render.ScreenRender.draw(ScreenRender.java:131)
       at com.pedro.encoder.input.gl.render.ManagerRender.drawScreen(ManagerRender.java:76)
       at com.pedro.rtplibrary.view.OpenGlView.run(OpenGlView.java:189)
       at java.lang.Thread.run(Thread.java:764)

After debugging with the Android Studio profiler I didn't find any leaks 😞

linean avatar May 04 '22 13:05 linean

Hello,

If possible, let me know if you are using any filter and which one. Also, if you can get time streaming until you get that crash, device model and android api.

This crash seems really difficult to reproduce and I'm not sure about the reason so it is hard to fix.

pedroSG94 avatar May 07 '22 20:05 pedroSG94

I'm using BlurFilterRender. These crashes are not super frequent so from my perspective it's a low prio thing.

Based on the logs, crashes are pretty random. Sometimes they occur after a few seconds of streaming and somethimes after user leaves the screen. It's also possible that these are caused by other leakage elsewhere in the application 🤷

If I manage to find some pattern or more details I'll post them here 🤞

linean avatar May 09 '22 10:05 linean

@linean Have you solved it? I have the same problem

MrAlanWei avatar May 24 '22 08:05 MrAlanWei

Unfortunately no, crashes seems pretty random. Luckily they doesn't affect a significant number of users 🤷

linean avatar May 24 '22 08:05 linean

If anyone could find a way to reproduce the error report it here. Since in OpenGL documentation the error code is an out of memory I only can assume a GPU memory overflow. If you have any way to report GPU memory state when you receive that error, this could be helpful

pedroSG94 avatar May 25 '22 20:05 pedroSG94

I have the same error on Samsung Galaxy S21. It's happen all the time. Without any filter. openGL_crash-01

minonger avatar Oct 27 '22 22:10 minonger

@minonger were you able to fix it? Are there any special conditions to it happening? Like using WiFi/5G / reconnecting / going to background and back?

mkrn avatar Aug 15 '23 09:08 mkrn

Have you solved it? I'm facing this problem now. I'm using both ImageFilter and TextFilter together. App still in development. There were no problems in short-term tests. I suddenly encountered this error while broadcasting for more than 20 minutes. Test device is Redmi Note 11 pro. 3.5gb free memory and 35gb available disk. I'm using mobile internet.

altunbayrakergun avatar Feb 25 '24 19:02 altunbayrakergun

Hello,

This error is really random and I'm not able to reproduce it consistently to solve.

If you can reproduce it, test this and tell me the result:

  • Try to stream without filters to discard problems with filters. If you can't reproduce the error without filters, then test with only one filter to try find the filter that produce problems.
  • If you are streaming in background or you have rotation support. Try to stream in foreground all time and block screen orientation. This is to discard a problem related with the preview lifecycle.

Remember that this is an out of memory. Can you check the GPU memory usage? Maybe you can find a pattern

pedroSG94 avatar Feb 25 '24 19:02 pedroSG94

Thank you for quick reply @pedroSG94 . Tests still continue. So propably I'll reproduce it. App currently doesn't support rotation. It only supports landscape and only streams foreground. I thought maybe the behavior was being disrupted for a reason like "preventing accidental screen touching". I'll let you know immediately when reproduce it again.

altunbayrakergun avatar Feb 25 '24 19:02 altunbayrakergun

Hello,

I did a refactor to GlInterface (OpenGlView and GlStreamInterface) that maybe solved this error. If possible try update the libary to version 2.4.0 and let me know if the problem is solved or reduced.

pedroSG94 avatar Mar 02 '24 21:03 pedroSG94

I followed the user experience for a while and found the error. The activity was set to sensorlandscape. This error occurred when the user made a movement that caused a 180-degree rotation while holding the device. After changing the sensorlandscape setting to landscape, the problem disappeared. Also thank you for your revision. I will include it in the next refactoring process.

altunbayrakergun avatar Mar 08 '24 07:03 altunbayrakergun

It is worth adding that the problem only occurred if the screen was rotated while using filters. There is no problem with rotation when there is no filter.

altunbayrakergun avatar Mar 08 '24 07:03 altunbayrakergun

Hi @pedroSG94, Today I have found that this issue occurs for AndroidViewFilterRender, if it has isHardwareMode forced to be false. I've not checked any other filter, my orientation is always horizontal. I hope, it will help you with finding solution.

Feureth avatar Mar 11 '24 14:03 Feureth

Hello,

@Feureth are you using library version 2.4.0?

pedroSG94 avatar Mar 11 '24 15:03 pedroSG94

Yes

Feureth avatar Mar 11 '24 16:03 Feureth