Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback from exceptions accumulates on REPL on 4.1.0 #28

Closed
kevinjwalters opened this issue Aug 12, 2019 · 5 comments · Fixed by #40
Closed

Traceback from exceptions accumulates on REPL on 4.1.0 #28

kevinjwalters opened this issue Aug 12, 2019 · 5 comments · Fixed by #40

Comments

@kevinjwalters
Copy link

Observed on 4.1.0-rc.1 and briefly discussed on Discord. 4.1.0 has same issue with accumulation of stack trace stuff in Traceback output:

Adafruit CircuitPython 4.1.0 on 2019-08-03; Adafruit Metro M4 Express with samd51j19
>>> from adafruit_midi.program_change import ProgramChange
>>> ProgramChange(200) ### intentional illegal value
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_midi/program_change.py", line 56, in __init__
ValueError: Out of range
>>> ProgramChange(200) ### intentional illegal value
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_midi/program_change.py", line 56, in __init__
  File "<stdin>", line 1, in <module>
  File "adafruit_midi/program_change.py", line 56, in __init__
ValueError: Out of range
>>> ProgramChange(200) ### intentional illegal value
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_midi/program_change.py", line 56, in __init__
  File "<stdin>", line 1, in <module>
  File "adafruit_midi/program_change.py", line 56, in __init__
  File "<stdin>", line 1, in <module>
  File "adafruit_midi/program_change.py", line 56, in __init__
ValueError: Out of range
@kevinjwalters
Copy link
Author

kevinjwalters commented Aug 14, 2019

This seemed fairly harmless in REPL. Is it definitely REPL only? If not, is there any chance of leaking memory for applications with repeatedly/many caught exceptions? I'd guess not as the Traceback/text would only be prepared when it's not caught?

@tannewt
Copy link
Member

tannewt commented Aug 16, 2019

I assume it's REPL because it's the only case where an exception doesn't cause a VM reset. However, I haven't looked in detail yet so I may be wrong.

@tannewt
Copy link
Member

tannewt commented Dec 4, 2020

This is due to the MIDI library reusing ValueError: https://github.com/adafruit/Adafruit_CircuitPython_MIDI/blob/master/adafruit_midi/midi_message.py#L108-L109 I'll move this issue to the midi repo.

Instead, it should create a new exception each time.

@tannewt tannewt transferred this issue from adafruit/circuitpython Dec 4, 2020
jepler added a commit to jepler/Adafruit_CircuitPython_MIDI that referenced this issue Aug 7, 2021
jepler added a commit to jepler/Adafruit_CircuitPython_MIDI that referenced this issue Aug 7, 2021
jepler added a commit to jepler/Adafruit_CircuitPython_MIDI that referenced this issue Aug 7, 2021
jepler added a commit to jepler/Adafruit_CircuitPython_MIDI that referenced this issue Aug 8, 2021
@kevinjwalters
Copy link
Author

I just caught all exceptions including KeyboardInterrupt on 6.3.0 and that also accumulates in a similar fashion when reading from a powered off PMS5003 with adafruit_pm25.

@tannewt
Copy link
Member

tannewt commented Aug 24, 2021

Please try absolute latest and file a new issue if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants