Device-only crash with Lua game on SDK 2.0


While working on my Lua game I started getting a crash pretty consistently (but always at different times) after upgrading to SDK 2.0. This only seems to happen when testing the game on device, and not in the simulator (which I mostly run on MacOS).

Looking at some of the crash reports (which I've also sent via Settings -> System -> Send Crash Report), and referencing this post by @dave it would appear, if I understand correctly, that the crash happens in firmware code, for example:

--- crash at 2023/06/27 23:55:31---
   r0:00000002    r1:20002313     r2:200023ea    r3: 00000002
  r12:0000000a    lr:080b3031     pc:080b3daa   psr: 61000000
 cfsr:00000082  hfsr:00000000  mmfar:5b14e494  bfar: 5b14e494
heap allocated: 7682112
Lua totalbytes=949649 GCdebt=-2000 GCestimate=937041 stacksize=42

--- crash at 2023/06/28 00:00:43---
   r0:60fe0010    r1:00000000     r2:60fe0410    r3: 60fe0350
  r12:00000006    lr:08022ac1     pc:080b2d9a   psr: 81000000
 cfsr:00000082  hfsr:00000000  mmfar:080eae84  bfar: 080eae84
heap allocated: 7690848
Lua totalbytes=993004 GCdebt=-6768 GCestimate=948234 stacksize=42

Is there anything else I can do to understand more about what could be causing this and debug, given the language I'm using here is Lua rather than C? Or is there anything else that stands out from those crash dumps that I may not be deciphering correctly?

Alternatively, am I able to get the prior firmware 1.13.7 from anywhere, to double check if this is an issue with 2.0 or something I'm causing somehow?

Hi, quick question about this issue, I was wondering if there was any more info logged on the system crash screen? Can you press B to see more info about the call stack?

Unfortunately it doesn't look like it :frowning_face: I should've mentioned that this generally shows up as an Error e0 so only offers the option to press A to reboot and the Error e0 URL. Hence my puzzlement at the moment as to what might be causing it :frowning_face:

Is this in code you could possibly share with me so I could try debugging this issue further? Of course it would be confidential, etc.

I was hoping to get some pointers to narrow it down to a more easily reproducible case before sharing code. However I'm almost done putting together a demo build for this game, which Panic was going to receive anyway, perhaps that could work when it's ready?

Hi, I'm experiencing a similar issue with my Lua app. It might help to look at these tickets together.

@wildbat Older versions of the SDK can be downloaded from here.

@wade If you want me to move my ticket into this thread and close the new one I started, lmk.

Thanks for this info, interesting that you are seeing issues around fileplayer.

@wildbat are you using the fileplayer api as well?

A demo app would be fine when it’s ready, that should be enough to get some idea of what’s going on.

@wade I'm not using the fileplayer API, as far as audio is concerned I'm using sampleplayer, channels, and instruments with synths and samples. I was having simulator crashes that looked related to channel:removeSource(), which I thought I may have been causing, so I tried removing all calls to both addSource and removeSource to narrow it down and, while that seemed to work around the simulator crashes, it left this console crash exposed. But now I'm wondering if audio may indeed be the pattern that connects all of these.

@pasha thanks, I was hoping to rollback the OS on the Playdate from 2.0 to 1.13.7 for testing (recovery firmware looks to be 1.11.x), but the SDK packages don't include a firmware image, unless I missed it?

@wildbat You're right, I can't find the old firmware either, sorry for misleading.

I'm nottt convinced it actually is the audio. Judging by where the crash occurs in my debug logs, it might be input querying or ui.crankIndicator. Unfortunately my device seems to stop crashing the minute I add new print flags for debugging. :disappointed_relieved: I'll investigate more when the crashes start up again.

Never mind, it doesn't seem to have to do with ui.crankIndicator nor anything else in my pd.update loop. I tried removing each block inside my pd.update code one at a time, and it didn't make a difference, the crash occurred regardless.

@wade Could you interpret either of our crash logs for us? Or follow up with any other updates?