nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
955 stars 53 forks source link

[Regression] - mGBA Suite Crashes on NBA 1.7 #301

Closed Zenjir0 closed 1 year ago

Zenjir0 commented 1 year ago

When you try to run endrift's gba-suite on NanoBoyAdvance 1.7 some of the test will outright crash the program.

This behavior is easily replicated by running the latest suite.gba file (suite.gba date modified 3/27/2023) on NBA v1.7 and attempting to run the tests.

However the same suite.gba file runs without issue on all tests for NBA v1.6 and v1.5, and does not crash.

fleroviux commented 1 year ago

Weird. I use this test suite regularly for regression testing. That being said it's possible that I missed something. I'll take a look tonight.

Zenjir0 commented 1 year ago

For a sanity check I also did it on a completely separate system and v1.7 did crash on that one too. The suite.gba I am using has an MD5 hash of: 29A547D5C142750B012754BCC7DAEDBA Just in case it happens to be an issue with the suite for some odd reason, and it gets changed/updated between now and when it gets investigated.

Let me know if you want me to test anything.

fleroviux commented 1 year ago

Looks like this crash is connected to the recent implementation of the mGBA logging interface, which suite.gba uses to print out test results. The crash does not happen when running NanoBoyAdvance from the console (which is what I do most of the time). It incidentally also does not crash anymore on the latest commit which makes sure to flush stdout after every log message.

I wonder if the crash happens if nothing drains from stdout and its buffer eventually is being overrun.

fleroviux commented 1 year ago

Turns out fmt::print throws an exception if it fails to write to STDOUT. https://github.com/fmtlib/fmt/issues/1176

This is now accounted for by catching and ignoring the exception.

Zenjir0 commented 1 year ago

Glad to have helped and thank you for your contributions to GBA emulation.