Current status of Amiga emulation in Oreo
The Oreo release of Android broke several emulators and most of them have been fixed up to this date, but one particular exception is the Amiga emulator (UAE2All2) which will require more time to fix, or as an alternative, be replaced by a new emulator.
Some fixes in Oreo made some hidden bugs become evident in this emulator, making it crash when opening and closing the in-game menu. These bugs were found and fixed and initially it seemed that the problem was solved, but later I found that there is a random crash that happens sometimes when you open the in-game menu.
For a long time I kept this version in hold hoping to find a solution for the random crash, meanwhile the public version of the emulator just crashed at all times. So I finally decided that a random crash is better than a certain crash, even when deep inside I know that both alternatives are bad, although I don’t want people to wait any longer.
This random crash has been tracked down, but the error happens deep inside Android where I cannot see exactly what is causing it. If you are a developer, keep reading in case you may help me fix this problem.
Normal users will receive the update, but expect random crashes.
Bug details (for developers)
The Amiga emulator is SDL based, where they have a thread to update the GL surface. When the in-game menu is opened, this thread is “paused”, the screen neither the emulator is run and the GL thread keeps waiting in a loop.
Android performs all GUI operations in one thread, the “main” thread, so before the main menu is shown, this main thread pauses the GL thread, waits until the GL wait loop is being run and then opens the main menu. Sometimes, when Android is displaying the menu it enters a deadlock.
From the scarce thread dumps that I have seen, it seems to be a problem rendering the text. Apparently, there is no other thread doing something with the GUI so in theory this lock should never fail, but it fails.
The only stack trace available of this deadlock is native:
"ora.uae4all.sdl" sysTid=29880 #00 pc 00018dbc /system/lib/libc.so (syscall+28) #01 pc 000b38cd /system/lib/libart.so (_ZN3art17ConditionVariable16WaitHoldingLocksEPNS_6ThreadE+88) #02 pc 00192e73 /system/lib/libart.so (_ZN3art2gc4Heap26IncrementDisableThreadFlipEPNS_6ThreadE+278) #03 pc 00291367 /system/lib/libart.so (_ZN3art3JNI17GetStringCriticalEP7_JNIEnvP8_jstringPh+454) #04 pc 000d8469 /system/lib/libart.so (_ZN3art8CheckJNI22GetStringCharsInternalEPKcP7_JNIEnvP8_jstringPhbb+544) #05 pc 000cec6f /system/lib/libart.so (_ZN3art8CheckJNI17GetStringCriticalEP7_JNIEnvP8_jstringPh+22) #06 pc 000b8275 /system/lib/libandroid_runtime.so (_ZN7androidL37android_os_Parcel_writeInterfaceTokenEP7_JNIEnvP7_jc lassxP8_jstring+40) #07 pc 00800dab /system/framework/arm/boot-framework.oat (offset 0x5c7000) (android.app.admin.SecurityLog.readEventsO nWrapping [DEDUPED]+130) #08 pc 0001422f /dev/ashmem/dalvik-jit-code-cache (deleted)
The emulator is open source and the code is located in my github, if anybody wants to take a look, just send me a message for build instructions. Thanks in advance.
https://github.com/fcatrin/rxAmigaAddOn