retrowars/retrowars

[Space invaders] crash when score is around 300.000

Closed this issue · 7 comments

Describe the bug
As I described in the title the game crash when I reach a score 250.000 - 300.000.
I always had that bug from a very previous release.
It happened in both effects retro and non retro.

To Reproduce
Just playing until it crashes.

Expected behavior
Thank you so much for your effort to developing!

Smartphone (please complete the following information):

  • Device: Motorola one hyper
  • Android Version: 11
  • Version RPFS31.Q1-21-20-10

Hi @piojpub. Thank you so much for taking the time to report the issue, especially with such detail about the device, version, etc. Unfortunately I've completely failed to observe this behaviour so am unable to even investigate, let alone fix. For that reason, I'm going to close this issue.

Please do reopen if you feel it is still happening on recent versions, or if you are able to provide any additional information (output from logcat would be the most helpful).

If anyone else is able to observe this and provide additional details or logcat output, please post here and we'll continue investigating.

Hello,

I had the same issue on another device, in this case even earlier than 300.000 points of score :
Moto X4 (payton)
LineageOS 19-20220628-NIGHTLY-payton
Android 12

Here the logcat (only the tail when the issue happened):

07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.InsetsStateController$$ExternalSyntheticLambda1.run(Unknown Source:2)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator.executeAfterPrepareSurfacesRunnables(WindowAnimator.java:345)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator.animate(WindowAnimator.java:226)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator.lambda$new$1$WindowAnimator(WindowAnimator.java:106)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator$$ExternalSyntheticLambda0.doFrame(Unknown Source:2)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer.doCallbacks(Choreographer.java:845)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer.doFrame(Choreographer.java:775)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Handler.handleCallback(Handler.java:938)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Handler.dispatchMessage(Handler.java:99)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Looper.loopOnce(Looper.java:201)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Looper.loop(Looper.java:288)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.HandlerThread.run(HandlerThread.java:67)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.ServiceThread.run(ServiceThread.java:44)
07-02 17:10:32.744  1947  1947 D audio_hw_primary: disable_audio_route: reset and update mixer path: low-latency-playback
07-02 17:10:32.745  1947  1947 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(0) new_snd_devices(0)
07-02 17:10:32.745  1947  1947 I msm8974_platform: platform_get_custom_mtmx_params: no matching param with id 0 ip_ch 2 op_ch 2 uc_id 1 snd_dev 2
07-02 17:10:32.745  1947  1947 D hardware_info: hw_info_append_hw_type : device_name = speaker
07-02 17:10:32.745  1947  1947 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(0) new_snd_devices(0)
07-02 17:10:32.745  1947  1947 D audio_hw_primary: out_standby: exit
07-02 17:10:32.769  1945  1968 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x7865324a60
07-02 17:10:32.796  1588  1680 W ActivityManager: setHasOverlayUi called on unknown pid: 6974
07-02 17:10:32.804  1588  1680 I ActivityTaskManager: Config changes=20000480 {1.0 ?mcc?mnc [it_IT] ldltr sw411dp w411dp h691dp 420dpi nrml long hdr widecg port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1878) mMaxBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.3 s.122 fontWeightAdjustment=0}
07-02 17:10:32.815     0     0 E [  578.653572,6] msm_dwc3_perf_vote_work: in_perf_mode:0, interrupts in last sample:147
07-02 17:10:32.811  1588  1680 W ActivityTaskManager: Current config: {1.0 ?mcc?mnc [it_IT] ldltr sw411dp w731dp h371dp 420dpi nrml long hdr widecg land night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1920, 1080) mAppBounds=Rect(0, 0 - 1920, 1038) mMaxBounds=Rect(0, 0 - 1920, 1080) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_90} as.3 s.122 fontWeightAdjustment=0} unchanged for IME proc com.android.inputmethod.latin
07-02 17:10:32.814  1588  1680 I WindowManager: Override config changes=20000480 {1.0 ?mcc?mnc [it_IT] ldltr sw411dp w411dp h691dp 420dpi nrml long hdr widecg port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1878) mMaxBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.3 s.122 fontWeightAdjustment=0} for displayId=0
07-02 17:10:32.818  1588  1680 V ActivityTaskManager: Sending to IME proc com.android.inputmethod.latin new config {1.0 ?mcc?mnc [it_IT] ldltr sw411dp w411dp h691dp 420dpi nrml long hdr widecg port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1878) mMaxBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} as.3 s.122 fontWeightAdjustment=0}
07-02 17:10:32.878  1588  1680 I InputManager-JNI: Viewport [0] to add: local:0, isActive: true
07-02 17:10:32.883   855   855 E BpTransactionCompletedListener: Failed to transact (-32)
07-02 17:10:32.883   855   855 E BpTransactionCompletedListener: Failed to transact (-32)
07-02 17:10:32.892  1588  1681 W ActivityTaskManager: Can't find TaskDisplayArea to determine support for multi window. Task id=505 attached=false
07-02 17:10:32.892  1588  1681 W ActivityTaskManager: Can't find TaskDisplayArea to determine support for multi window. Task id=505 attached=false
07-02 17:10:32.898  1588  1895 I InputReader: Reconfiguring input devices, changes=DISPLAY_INFO | 
07-02 17:10:32.899  1588  1895 I InputReader: Device reconfigured: id=2, name='focaltech_ts', size 1080x1920, orientation 0, mode 1, display id 0
07-02 17:10:32.905   855  1287 I BpBinder: onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
07-02 17:10:32.905  2032  2032 D StatusBar: Received new disable state. Old: enaihbcrso.qingr | New: enaihbcrso.qingr
07-02 17:10:32.952   855  1287 I BpBinder: onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
07-02 17:10:33.056   793  1272 W qti_sensors_hal: processInd: MOT_DISPROT Data: -1.0
07-02 17:10:33.686   793  1272 W qti_sensors_hal: processInd: MOT_DISPROT Data:  1.0
07-02 17:10:33.740  1588  3350 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service org.kustom.widget/.WidgetService
07-02 17:10:33.741  1588  3350 I ActivityManager: Background started FGS: Allowed [callingPackage: org.kustom.widget; callingUid: 10182; uidState: FGS ; intent: Intent { cmp=org.kustom.widget/.WidgetService }; code:PROC_STATE_FGS; tempAllowListReason:<null>; targetSdkVersion:29; callerTargetSdkVersion:29; startForegroundCount:1; bindFromPackage:null]
07-02 17:10:33.752  1588  3350 W ActivityManager: Receiver with filter android.content.IntentFilter@323b8ba already registered for pid 3758, callerPackage is org.kustom.widget
07-02 17:10:33.754  1588  3350 W ActivityManager: Receiver with filter android.content.IntentFilter@25a836b already registered for pid 3758, callerPackage is org.kustom.widget
07-02 17:10:33.766  3758  4059 I KWGTSh  : Requesting network update, force false, location only false, text false, bitmap false
07-02 17:10:33.776  1588  3350 W ProcessStats: Tracking association SourceState{17cff74 system/1000 BTopFgs #7714} whose proc state 2 is better than process ProcessState{fc64c9d com.google.android.gms.persistent/10127 pkg=com.google.android.gms} proc state 3 (2032 skipped)
07-02 17:10:34.726   793   914 W qti_sensors_hal: processReportInd: lux: 130, ch0: 37, ch1: 51, pData: 3, pOffset: 62
07-02 17:10:34.736   793  1272 W qti_sensors_hal: processInd: MOT_DISPROT Data: -1.0
07-02 17:10:34.812     0     0 E [  580.661560,6] msm_dwc3_perf_vote_work: in_perf_mode:0, interrupts in last sample:117
07-02 17:10:35.648  1947  1947 D audio_hw_primary: out_standby: enter: stream (0xea3c4330) usecase(0: deep-buffer-playback)
07-02 17:10:35.790     0     0 E [  581.642289,0] q6asm_callback: payload size of 8 is less than expected.
07-02 17:10:35.791   793  1272 W qti_sensors_hal: processInd: MOT_DISPROT Data:  1.0
07-02 17:10:35.832   793   914 W qti_sensors_hal: processReportInd: lux: 157, ch0: 44, ch1: 58, pData: 3, pOffset: 62
07-02 17:10:35.838  1947  1947 D audio_hw_primary: disable_audio_route: reset and update mixer path: deep-buffer-playback
07-02 17:10:35.840  1947  1947 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(0) new_snd_devices(0)
07-02 17:10:35.840  1947  1947 I msm8974_platform: platform_get_custom_mtmx_params: no matching param with id 0 ip_ch 2 op_ch 2 uc_id 0 snd_dev 2
07-02 17:10:35.840  1947  1947 D hardware_info: hw_info_append_hw_type : device_name = speaker
07-02 17:10:35.840  1947  1947 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)
07-02 17:10:35.845  1947  1947 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(0) new_snd_devices(0)
07-02 17:10:35.859  1947  1947 D audio_hw_primary: out_standby: exit

I hope is helpful to solving it.

Thank you so much!

Oh thank you so much for the quick response and the logcat. This is great! (not that it is broken, but that you are able to catch logcats). Unfortunately this doesn't have anything specifically relating to retrowars in it. The closest I can see is a stacktrace:

07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.InsetsStateController$$ExternalSyntheticLambda1.run(Unknown Source:2)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator.executeAfterPrepareSurfacesRunnables(WindowAnimator.java:345)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator.animate(WindowAnimator.java:226)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator.lambda$new$1$WindowAnimator(WindowAnimator.java:106)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.wm.WindowAnimator$$ExternalSyntheticLambda0.doFrame(Unknown Source:2)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer.doCallbacks(Choreographer.java:845)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer.doFrame(Choreographer.java:775)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Handler.handleCallback(Handler.java:938)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Handler.dispatchMessage(Handler.java:99)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Looper.loopOnce(Looper.java:201)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.Looper.loop(Looper.java:288)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at android.os.HandlerThread.run(HandlerThread.java:67)
07-02 17:10:32.737  1588  1681 W WindowManager: 	at com.android.server.ServiceThread.run(ServiceThread.java:44)

... but that isn't the full stacktrace, so unable to learn much for it.

If you're logback output is qutie noisy, one trick can be to do one of the following:

Only show error level messages:

adb logcat *:E

Only show output from the com.serwylo.retrowars package:

A lot messier, not really supported perfectly, and these random StackOverflow answers assume you are on Linux and the game is already running on your Android phone...

adb logcat --pid=$(adb shell pidof -s com.serwylo.retrowars)

Hopefully we can catch something important in the wild and when we know what the issue is, the fix should be straightforward. Thanks again.

Hi!

I'm not sure if I undertstood exactly what you want to tell me... But in any case this is the whole result with this command:

adb logcat --pid=$(adb shell pidof -s com.serwylo.retrowars)
pastebin ...and yes, I'm Linux user.

Hopefully I helped you.

Thanks for your effort.

Caught it in the wild, thanks!

07-20 13:40:14.834 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.834 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.834 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.834 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.843 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.844 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.844 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.844 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.844 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.844 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.852 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.852 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.852 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.852 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.978 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.978 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.978 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.978 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.978 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.978 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.979 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.979 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-20 13:40:14.979 10297 10318 W Adreno-GSL: <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-20 13:40:14.979 10297 10318 E Adreno-GSL: <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
--------- beginning of crash
07-20 13:40:17.874 10297 10318 E AndroidRuntime: FATAL EXCEPTION: GLThread 30
07-20 13:40:17.874 10297 10318 E AndroidRuntime: Process: com.serwylo.retrowars, PID: 10297
07-20 13:40:17.874 10297 10318 E AndroidRuntime: java.lang.IllegalArgumentException: Error compiling shader: 
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:164)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:127)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:87)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.games.spaceinvaders.SpaceInvadersGameScreen.renderGame(SpaceInvadersGameScreen.kt:115)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.games.GameScreen$render$1$1.invoke(GameScreen.kt:466)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.games.GameScreen$render$1$1.invoke(GameScreen.kt:464)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.ui.GameViewport.renderIn(GameViewport.kt:42)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.games.GameScreen$render$1.invoke(GameScreen.kt:464)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.games.GameScreen$render$1.invoke(GameScreen.kt:463)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.UiAssets$Effects.render(UiAssets.kt:95)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.serwylo.retrowars.games.GameScreen.render(GameScreen.kt:463)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.badlogic.gdx.Game.render(Game.java:46)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:471)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1573)
07-20 13:40:17.874 10297 10318 E AndroidRuntime: 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
07-20 13:40:17.945 10297 10318 I Process : Sending signal. PID: 10297 SIG: 9

This is exactly what was needed (and the context leading up to it is also helpful), so thanks so much for following up on this. I'll start searching around to see what is going on here because it looks a little... interesting... :)

Okay great, I can see my mistake, and why it only impacts SpaceInvadersGame, and also why it happens after a high score.

  • There is a memory leak.
  • It is caused by creating a SpriteBatch every single frame that we render.
  • Constructing a SpriteBatch is a heavy thing to do, it compiles a new shader every time it is created.
  • It only affects Space Invaders because that is the only one that actually draws textures to the screen (the barriers), hence requiring a SpriteBatch.
  • It only happens intermittently and at high scores because it depends on how long the game has run and therefore how much memory has been consumed. My P30 Pro has 8GB of memory so I an not good enough at Space Invaders to be alive for that long 😄.

I think I have a fix, and have tagged v0.31.4 for F-Droid to pick up and build in the coming days. Thanks for your patience and assistance, hope this gets the issue fixed. Please do post back here after this release is out to let me know if it has addressed the issue.

I'm very glad that my contribution was helpfully : )
Good Job!!!