question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tons of different PySDL2 crashes when tabbing in/out of application during loading or right after it finished

See original GitHub issue

Testing around, my PySDL2 app crashed (I think it was when I tabbed out with the home button):

08-07 06:45:31.743  1770  1770 V pythonutil: Checking pattern libcrypto.*\.so against libpython3.5m.so
08-07 06:45:31.743  1770  1770 V pythonutil: Loading library: crystax
08-07 06:45:31.752  1770  1770 V pythonutil: Loading library: SDL2
08-07 06:45:31.800  1770  1770 V pythonutil: Loading library: SDL2_image
08-07 06:45:31.803  1770  1770 V pythonutil: Loading library: SDL2_mixer
08-07 06:45:31.805  1770  1770 V pythonutil: Loading library: SDL2_ttf
08-07 06:45:31.807  1770  1770 V pythonutil: Loading library: python2.7
08-07 06:45:31.817  1770  1770 V pythonutil: Library loading error: dalvik.system.PathClassLoader[DexPathList[[zip file "/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/base.apk"],nativeLibraryDirectories=[/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm, /system/fake-libs, /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]] couldn't find "libpython2.7.so"
08-07 06:45:31.817  1770  1770 V pythonutil: Loading library: python3.5m
08-07 06:45:31.822  1770  1770 V pythonutil: Loading library: main
08-07 06:45:31.826  1770  1770 V pythonutil: Failed to load _io.so or unicodedata.so...but that's okay.
08-07 06:45:31.827  1770  1770 V pythonutil: Unsatisfied linker when loading ctypes
08-07 06:45:31.827  1770  1770 V pythonutil: Loaded everything!
08-07 06:45:31.912  1770  1770 V PythonActivity: Setting env vars for start.c and Python to use
08-07 06:45:31.914  1770  1770 V PythonActivity: Access to our meta-data...
08-07 06:45:31.917  1770  1770 I PythonActivity: Surface will NOT be transparent
08-07 06:45:31.955  1802  1816 I ActivityManager: Killing 29503:at.bitfire.davdroid/u0a73 (adj 906): empty #17
08-07 06:45:31.967  1770  1770 V SDL     : onDestroy()
08-07 06:45:31.975  1802  5506 D ActivityManager: cleanUpApplicationRecord -- 29503
08-07 06:45:31.979  1770  1770 I art     : System.exit called, status: 0
08-07 06:45:31.980  1770  1770 I AndroidRuntime: VM exiting with result code 0, cleanup skipped.
08-07 06:45:31.999  1802  1932 I ActivityManager: Process org.example.myapp (pid 1770) has died
08-07 06:45:31.999  1802  1932 D ActivityManager: cleanUpApplicationRecord -- 1770
08-07 06:45:32.000  1802  2645 D GraphicsStats: Buffer count: 8
08-07 06:45:32.000  1802  1860 W InputDispatcher: channel '15c8af1 org.example.myapp/org.kivy.android.PythonActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
08-07 06:45:32.000  1802  1860 E InputDispatcher: channel '15c8af1 org.example.myapp/org.kivy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
08-07 06:45:32.005  1802 15925 I WindowManager: WIN DEATH: Window{15c8af1 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-07 06:45:32.005  1802 15925 W InputDispatcher: Attempted to unregister already unregistered input channel '15c8af1 org.example.myapp/org.kivy.android.PythonActivity (server)'
08-07 06:45:32.005  1802 15925 W WindowManager: Force-removing child win Window{31bbf6a u0 SurfaceView - org.example.myapp/org.kivy.android.PythonActivity} from container Window{15c8af1 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-07 06:45:32.052  1802  1813 W WindowManager: Failed looking up window
08-07 06:45:32.052  1802  1813 W WindowManager: java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@eba7955 does not exist
08-07 06:45:32.052  1802  1813 W WindowManager: 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9469)
08-07 06:45:32.052  1802  1813 W WindowManager: 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9460)
08-07 06:45:32.052  1802  1813 W WindowManager: 	at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1807)
08-07 06:45:32.052  1802  1813 W WindowManager: 	at android.os.BinderProxy.sendDeathNotice(Binder.java:688)
08-07 06:45:32.052  1802  1813 I WindowManager: WIN DEATH: null
08-07 06:45:32.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:33.409  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:33.816  1802 15917 I ActivityManager: Setting hasTopUi=true for pid=1916
08-07 06:45:33.818  1916  1916 D PhoneStatusBar: disable: < expand ICONS* alerts SYSTEM_INFO* back home recent clock search quick_settings >
08-07 06:45:34.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:35.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:36.410  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:37.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:38.410  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:39.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:40.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 06:45:40.531  1802  1816 I ActivityManager: Waited long enough for: ServiceRecord{6066274 u0 com.fsck.k9/.service.PollService}
08-07 06:45:41.408  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ghostcommented, Aug 8, 2018

Well, it’s most likely me doing something wrong. But it would be useful to document this somewhere, the minimum events that need to be handled through SDL2 to avoid crashes like this. (Because it’s not really comparable on the desktop, where the program doesn’t crash due to this.) Anyway, I’ll close the issue for now

0reactions
ghostcommented, Aug 7, 2018

Ok, part of those crashes were because I got a window close event and didn’t handle it. Now that I do and free all resources of the window (along with SDL_DestroyWindow) once that happens, I am seeing this once I tab out and tab back in (crash happens when regaining focus / tabbing back in):

08-07 09:57:07.015  5677  5677 V pythonutil: Loaded everything!
08-07 09:57:07.019  5677  5677 V PythonActivity: Setting env vars for start.c and Python to use
08-07 09:57:07.019  5677  5677 V PythonActivity: Access to our meta-data...
08-07 09:57:07.021  5677  5677 I PythonActivity: Surface will NOT be transparent
08-07 09:57:07.051  5677  5677 V SDL     : surfaceCreated()
08-07 09:57:07.051  5677  5677 V SDL     : surfaceChanged()
08-07 09:57:07.051  5677  5677 V SDL     : pixel format RGB_565
08-07 09:57:07.053  5677  5677 V SDL     : Window size:540x924
08-07 09:57:07.083  1802  1814 D Sensors : setDelay: acc_delay=20000000, mag_delay=200000000
08-07 09:57:07.083  1802  1814 D Sensors : setDelay: handle=0, delay=20000000
08-07 09:57:07.088  5677  5752 I SDL     : SDL_Android_Init()
08-07 09:57:07.088  5677  5752 I SDL     : SDL_Android_Init() finished!
08-07 09:57:07.088  5677  5752 I python  : Initialize Python for Android
08-07 09:57:07.088  5677  5752 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
08-07 09:57:07.088  5677  5752 I python  : /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app
08-07 09:57:07.088  5677  5752 I python  : Preparing to initialize python
08-07 09:57:07.088  5677  5752 I python  : crystax_python exists
08-07 09:57:07.088  5677  5752 I python  : calculated paths to be...
08-07 09:57:07.088  5677  5752 I python  : /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/stdlib.zip:/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/modules
08-07 09:57:07.102  5677  5752 I python  : set wchar paths...
08-07 09:57:07.102  5677  5752 I python  : Initialized python
08-07 09:57:07.102  5677  5752 I python  : AND: Init threads
08-07 09:57:07.102  5677  5752 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 5752 (SDLThread)
08-07 09:57:07.103   176   176 W         : debuggerd: handling request: pid=5677 uid=10116 gid=10116 tid=5752
08-07 09:57:07.127  5754  5754 W debuggerd: type=1400 audit(0.0:197): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.127  5754  5754 W debuggerd: type=1400 audit(0.0:198): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:199): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:200): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:201): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:202): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:203): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:204): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:205): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.137  5754  5754 W debuggerd: type=1400 audit(0.0:206): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.147  5754  5754 W debuggerd: type=1400 audit(0.0:207): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.157  5754  5754 W debuggerd: type=1400 audit(0.0:208): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.171  1802  1838 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-07 09:57:07.172  1802  1825 D LuxLevels: bright hysteresis constant= 0.1, threshold=0.0, lux=0.0
08-07 09:57:07.172  1802  1825 D LuxLevels: dark hysteresis constant= 0.2, threshold=0.0, lux=0.0
08-07 09:57:07.176  5754  5754 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-07 09:57:07.176  5754  5754 F DEBUG   : LineageOS Version: '14.1-20180624-NIGHTLY-serranoltexx'
08-07 09:57:07.176  5754  5754 F DEBUG   : Build fingerprint: 'samsung/serranoltexx/serranolte:4.4.2/KOT49H/I9195XXUCNE6:user/release-keys'
08-07 09:57:07.176  5754  5754 F DEBUG   : Revision: '0'
08-07 09:57:07.176  5754  5754 F DEBUG   : ABI: 'arm'
08-07 09:57:07.176  5754  5754 F DEBUG   : pid: 5677, tid: 5752, name: SDLThread  >>> org.example.myapp <<<
08-07 09:57:07.176  5754  5754 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
08-07 09:57:07.176  5754  5754 F DEBUG   :     r0 9b72e3e0  r1 00000008  r2 26105147  r3 00000000
08-07 09:57:07.177  5754  5754 F DEBUG   :     r4 b6ccb4a6  r5 9b72e3e0  r6 b66fd008  r7 9ab6ee0c
08-07 09:57:07.177  5754  5754 F DEBUG   :     r8 9ab6ef0c  r9 9b676100  sl 00000000  fp 9ab6f080
08-07 09:57:07.177  5754  5754 F DEBUG   :     ip 9ce8fbdc  sp 9ab6edc0  lr 9ccbe0d5  pc 9ccbdb7e  cpsr 600e0030
08-07 09:57:07.177  5754  5754 W debuggerd: type=1400 audit(0.0:209): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.177  5754  5754 W debuggerd: type=1400 audit(0.0:210): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.177  5754  5754 W debuggerd: type=1400 audit(0.0:211): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.190  5754  5754 F DEBUG   : 
08-07 09:57:07.190  5754  5754 F DEBUG   : backtrace:
08-07 09:57:07.191  5754  5754 F DEBUG   :     #00 pc 0004cb7e  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm/libpython3.5m.so
08-07 09:57:07.191  5754  5754 F DEBUG   :     #01 pc 0004d0d1  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm/libpython3.5m.so
08-07 09:57:07.191  5754  5754 F DEBUG   :     #02 pc 0004d3cb  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm/libpython3.5m.so
08-07 09:57:07.191  5754  5754 F DEBUG   :     #03 pc 00060b27  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm/libpython3.5m.so
08-07 09:57:07.191  5754  5754 F DEBUG   :     #04 pc 00001045  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm/libmain.so
08-07 09:57:07.191  5754  5754 F DEBUG   :     #05 pc 00000dfd  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm/libmain.so
08-07 09:57:07.191  5754  5754 F DEBUG   :     #06 pc 00000aa1  /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/oat/arm/base.odex (offset 0x16000)
08-07 09:57:07.788  5754  5754 W debuggerd: type=1400 audit(0.0:212): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:07.788  5754  5754 W debuggerd: type=1400 audit(0.0:213): avc: denied { search } for name="expand" dev="tmpfs" ino=5981 scontext=u:r:debuggerd:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
08-07 09:57:08.034  5754  5754 E         : debuggerd: failed to kill process 5677: No such process
08-07 09:57:08.034  1802  5760 W ActivityManager:   Force finishing activity org.example.myapp/org.kivy.android.PythonActivity
08-07 09:57:08.038  1802  1820 I BootReceiver: Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
08-07 09:57:08.041   176   176 W         : debuggerd: resuming target 5677
08-07 09:57:08.093  1802 28875 I WindowManager: WIN DEATH: Window{7a28119 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-07 09:57:08.093  1802 28875 W WindowManager: Force-removing child win Window{cecca8c u0 SurfaceView - org.example.myapp/org.kivy.android.PythonActivity} from container Window{7a28119 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-07 09:57:08.094  1802 15925 D GraphicsStats: Buffer count: 10
08-07 09:57:08.094  1802  2645 I ActivityManager: Process org.example.myapp (pid 5677) has died
08-07 09:57:08.094  1802  2645 D ActivityManager: cleanUpApplicationRecord -- 5677
08-07 09:57:08.106  1802  1860 W InputDispatcher: channel 'd3e485 org.example.myapp/org.kivy.android.PythonActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
08-07 09:57:08.106  1802  1860 E InputDispatcher: channel 'd3e485 org.example.myapp/org.kivy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
08-07 09:57:08.108  1802  2203 W WindowManager: Failed looking up window
08-07 09:57:08.108  1802  2203 W WindowManager: java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@afe13bf does not exist
08-07 09:57:08.108  1802  2203 W WindowManager: 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9469)
08-07 09:57:08.108  1802  2203 W WindowManager: 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9460)
08-07 09:57:08.108  1802  2203 W WindowManager: 	at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1807)
08-07 09:57:08.108  1802  2203 W WindowManager: 	at android.os.BinderProxy.sendDeathNotice(Binder.java:688)
08-07 09:57:08.108  1802  2203 I WindowManager: WIN DEATH: null
08-07 09:57:08.108  1802  5506 I WindowManager: WIN DEATH: Window{866d30b u0 SurfaceView - org.example.myapp/org.kivy.android.PythonActivity}
08-07 09:57:08.117  1802  1932 I WindowManager: WIN DEATH: Window{d3e485 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-07 09:57:08.117  1802  1932 W InputDispatcher: Attempted to unregister already unregistered input channel 'd3e485 org.example.myapp/org.kivy.android.PythonActivity (server)'

It works fine on the desktop by the way, where I can close the window, see the window close properly processed and nothing crashes.

Also, how is this supposed to work anyway? When I tab out and the window closes, now the app has no window - how will it ever open one when gaining focus again? After all, I didn’t want to close it, I was forced to by python-for-android triggering a close event, so what is it supposed to show anyway once it regains focus…?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are some games more prone to crash when I Alt-Tab?
Noticed that with a lot of games, sometimes when you alt-tab during loading, or during gameplay, some games tend to crash, or even...
Read more >
Game crashes when alt-tabbing during loading after a match ...
3: Alt tab during the loading screen, causing the crash. The game crashes in such a ... It cannot close via steam, alt+f4...
Read more >
PC crashes after closing a game or alt tabbing
Whenever I finish closing a game or alt tabbing out of a game after playing for a while, the pc will go black...
Read more >
Windows 11 'Freeze Issue' When Alt-Tabbing From Any Game
A very common problem that players are encountering is the notorious Windows 11 'freeze' issue when alt-tabbing from a game.
Read more >
Alt-tab freezing - Technical Support - World of Warcraft Forums
Was directed here by BlizzCS on Twitter, hoping I can find some help. Recently the game has started freezing up when alt-tabbing back...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found