circuitpython: CircuitPython 4.x hang on PyGamer after about 10 minutes of while loop playing stereo audio

I’ve got a CircuitPython hang that I’ve seen on 4.1.0 rc0 and rc1 if I leave some code running. Takes about ten minutes on a PyGamer to hang, it’s not predictable but will do it on about one in four executions. The serial connection (Windows 8.1 desktop) becomes disconnected but probably with no close (tapping a key in terminal window makes it realise the PyGamer’s gone away) and the CIRCUITPY becomes inaccessible. I left the PyGamer screen illuminated and that’s almost same printed line as I see on serial out. I say almost because I get one extra line on the USB serial rather than screen which surprises me a little. If I reset it doesn’t do that safe mode thing. I tried 4.0.2 and it didn’t seem to do it but because this occurs infrequently I can’t say for sure whether 4.0.2 is ok or not.

The output to DAC stops changing too.

I’ve got GND/A0/A1 from Feather style connector on the back connected to a 'scope. I also have the standard small speaker attached but it’s not enabled by the code. I wouldn’t expect that to affect things.

I have not seen any MemoryError exceptions during development - seems unlikely memory is being exceeded and certainly no exception seen on output.

I don’t have a JLink debugger setup so am a bit limited on gathering more data on this.

Will supply code later.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 32 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I believe this was fixed by adafruit/samd-peripherals#29. Please feel free to re-open if it reproduces on current CircuitPython. (The fix was probably first in CircuitPython 5.0.0, btw)

Yes, we have stack checking: https://github.com/adafruit/circuitpython/blob/master/py/stackctrl.c#L55. The VM interpreter does a check at opportune times, and there’s a 1kB safety area. Most routines don’t allocate large chunks of stuff on the stack.