My game is having intermittent crashes on Android, seemingly unrelated to anything specific in the game. I haven’t been able to get a logcat of these, until just now.
Unfortunately the errors are not making much sense to me. Possible culprits are:
When do the crashes happen? At startup? Completely at random? Can something be linked to the crashes in some way? Incoming push/local notification? System callback of some kind?
Unfortunately it appears randomly, but always when in game. Nothing unusual appears to be happening that triggers it, just a sudden force close without a warning. We haven’t seen this on iOS.
The first crash mentions sounds. Try running the game with the sounds disabled (either don’t play them or use the app manifest to exclude the sounds system).
Good plan, will try that. I forgot to post a video of the crash above:
ps. I’m using this code to catch crashes:
local function handle_previous_session_crash()
local handle = crash.load_previous()
if handle then
local str = ""
-- Backtrace
local backtrace = crash.get_backtrace(handle)
if backtrace then
for k,v in pairs(backtrace) do
str = str .. tostring(k) .. ": " .. tostring(v) .. "\n"
end
end
-- Extra data
local extra_data = crash.get_extra_data(handle)
if extra_data then
str = str .. extra_data
end
if gameanalytics then
gameanalytics.addErrorEvent {
severity = "Critical",
message = str
}
end
crash.release(handle)
end
end
I’m not really sure why that would fail.
Recent changes are ofc adding support for sound speed, and threading.
Are you using sound speeds other than 1?
The other thing I can think of is that if the sound data somehow isn’t thread safe. Are the crashes occurring while some collection proxy is unloaded?
The crashes only seem to happen in game, and during gameplay no collection proxies are loaded/unloaded.
My first thought was a memory leak, but I haven’t been able to produce any every increasing numbers when testing.
I’ll do a sound stress test to see if that can nudge us closer to that holy grail that is a repro project.
Update: A stress test playing playing all sounds in the game at random (up to 32 simultaneous sounds) at the same time as continuously loading/unloading a collection proxy (using Monarch, like the game) doesn’t cause a crash.
It throws this warning every now and then, though:
ERROR:DLIB: …/src/dlib/socket.cpp( 109 ): SOCKET: Unknown result code 1
WARNING:DLIB: Failed to send announce message (-1000)
Please also test without sound in the game and see if you can get it to crash. Create an app manifest with sound excluded: Defold App Manifest generator
I built two versions of the game; one excluding sound in the manifest and one with sound kept in. Same code base - the manifest was the only difference.
After, literally, hours worth of playing I was not able to crash the one without sound. I was able to crash the one with sound after 20 minutes or so: logcat.txt
Both builds were tested on the same phone, Pixel 5.
It affects the Android build of our game, because all players risk getting a crash when a sound is stopped. If you play for long enough, a crash is virtually guaranteed, which is not ideal.
@totebo a possible solution for now is to use the new option in 1.2.175 to disable the sound thread (if that is what is causing the problem you are experiencing):