mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 113 forks source link

AM Video Crashing #720

Closed sergiohinniger closed 1 year ago

sergiohinniger commented 2 years ago

I recently have experienced AM crashing when i leave the video looping (in rpi4 complied with mmal and xinerama). I saw that Oomek have fix such issue in attractplus in that commit: https://github.com/oomek/attractplus/commit/71022a3cec4775d0d2c2d278889bbd42a9800259 So i have used his fix in attract, manually editing src/fe_image.cpp from line 797, compiled and it worked, so AM is not crashing anymore. Maybe his solution should be adopted in AM.

OzFalcon commented 2 years ago

Update: Looks like they are separate issues. https://github.com/mickelson/attract/blob/c209088df7ca5afda17f928e17056092b9874ccd/src/fe_image.cpp#L800 Though the location is somewhat different in attractplus.

Is this the same issue? https://github.com/mickelson/attract/issues/717 https://github.com/mickelson/attract/commit/7c351f74d242fc84343e74f1b544051b1dd0813e

sergiohinniger commented 2 years ago

Apparently its not the same issue. Just compiled the current attract version and after less than 30 minutes attract crashed. With oomek fix i left my system more than 12 hours running and attract didn't crash.

OzFalcon commented 2 years ago

You will have to give some more detail on what your doing. Layout, Video file etc. I am unable to reproduce the crash on my Debian box. Could be a Pi related issue.....? I just ran AM with a 4 frame video file for 7 hours with no apparent mem leaks or crashes.

sergiohinniger commented 2 years ago

Here is a loglevel debug until the problem appears. I am using hyperspin.nut as layout: https://pastebin.com/xt6uyMAw

mickelson commented 2 years ago

my dev computer has recently self destructed, but this is something I will look into once I’m up and running again!

On Jun 5, 2022, at 11:28 AM, sergiohinniger @.***> wrote:

 I recently have experienced AM crashing when i leave the video looping (in rpi4 complied with mmal and xinerama). I saw that Oomek have fix such issue in attractplus in that commit: @.*** So i have used his fix in attract, manually editing src/fe_image.cpp from line 797, compiled and it worked, so AM is not crashing anymore. Maybe his solution should be adopted in AM.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

OzFalcon commented 2 years ago

terminate called without an active exception Error decoding video (receiving frame): End of file End Video Thread - /home/pi/.attract/menu-art/snap/Handhelds.mp4

  • bit_rate=188740, width=320, height=240
  • displayed=0
  • average qscore=0 Aborted ]0;pi@retropie: ~pi@retropie:~ $ stopxeexit exit

Does it crash if your looping a video using the basic layout or is it only the hyperspin Theme Loader?

sergiohinniger commented 2 years ago

Actually, after some testing i realize that the crash happens when in it is in the screensaver. The screensaver loads video, images and logos that start to play and loop. You can see a lot of videos being loaded by the screensaver in that log.

OzFalcon commented 2 years ago

Crash confirmed in under a minute when running video in the screensaver (Using Basic layout). (Switching off all modes except Movie Collage is the quickest way to cause AM to crash)

Just compiled with https://github.com/oomek/attractplus/commit/71022a3cec4775d0d2c2d278889bbd42a9800259 And it hasn't crashed yet and memory usage looks normal.

stazna01 commented 1 year ago

I'm having this exact same issue on a Pi 4 (screensaver videos always eventually crash attractmode). It's not a specific video that causes it, as I finally removed all but 3 snap videos, and while it would loop and play every video fine for awhile, eventually attractmode would crash and I'd get the same error. It does happen faster if using movie collage, but it eventually happens even when using the single movie option (usually takes a little over an hour with single movie mode). If I have no video snaps, the machine goes to a black screen during screensaver time, but it never crashes, so it's definitely the screensaver videos.

---begin error--- terminate called without an active exception Error decoding video (sending packet): End of file /usr/bin/attract: line 12: 720 aborted LD_LIBRARY_PATH="/opt/retropie/supplementary/attractmode/sfml/lib" "/opt/retropie/supplementary/attractmode/bin/attract" "$@" ---end error---

The videos are all from emumovies, and standard quality or high quality versions make no difference. I even tried re-encoding to 30 frames per second, but still the same issue. I also tried setting both mmal and software for video processing.

kwyxz commented 1 year ago

I am having a similar issue, seemingly very random, during screen saver. I am on a Raspberry Pi 4 using kms, and the latest Raspbian. Videos are all encoded for mmal, using these specs:

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 356 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)

Compiled attract with debug symbols and ran through gdb for a few hours, here's what I get when it crashes:

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0xf5e91804 in __GI_abort () at abort.c:79
#2  0xf60e6f88 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#3  0xf60e4acc in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#4  0xf60e4b58 in std::terminate() ()
   from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#5  0x004135c4 in std::thread::operator= (this=0x88aab4, __t=...)
    at /usr/include/c++/10/thread:170
#6  0x0041073c in FeVideoImp::play (this=0x88aa60) at src/media.cpp:551
#7  0x004114f0 in FeMedia::play (this=0x737228) at src/media.cpp:879
#8  0x0037b6f8 in FeTextureContainer::set_play_state (this=0x99cd58, play=true)
    at src/fe_image.cpp:800
#9  0x0037da9c in FeImage::setVideoPlaying (this=0x999ac0, f=true)
    at src/fe_image.cpp:1468
#10 0x003c8958 in Sqrat::SqMember<FeImage, void>::Func1<bool, true> (
    vm=0x9a9500) at extlibs/sqrat/include/sqrat/sqratMemberMethods.h:2583
#11 0x00467b08 in SQVM::CallNative (this=0x9a9500, nclosure=0x83b6b0, nargs=2, 
    newbase=36, retval=..., suspend=@0xfffedfcf: 255)
    at extlibs/squirrel/squirrel/sqvm.cpp:1163
#12 0x00469410 in SQVM::Call (this=0x9a9500, closure=..., nparams=2, 
    stackbase=36, outres=..., raiseerror=1)
    at extlibs/squirrel/squirrel/sqvm.cpp:1530
#13 0x004494f8 in sq_call (v=0x9a9500, params=2, retval=0, raiseerror=1)
    at extlibs/squirrel/squirrel/sqapi.cpp:1086
#14 0x003adfa0 in Sqrat::sqVarSet (vm=0x9a9500)
    at extlibs/sqrat/include/sqrat/sqratMemberMethods.h:4063
#15 0x00467b08 in SQVM::CallNative (this=0x9a9500, nclosure=0x841b10, nargs=3, 
--Type <RET> for more, q to quit, c to continue without paging--
    newbase=31, retval=..., suspend=@0xfffee0af: false)
    at extlibs/squirrel/squirrel/sqvm.cpp:1163
#16 0x00469410 in SQVM::Call (this=0x9a9500, closure=..., nparams=3, 
    stackbase=31, outres=..., raiseerror=0)
    at extlibs/squirrel/squirrel/sqvm.cpp:1530
#17 0x00468814 in SQVM::FallBackSet (this=0x9a9500, self=..., key=..., val=...)
    at extlibs/squirrel/squirrel/sqvm.cpp:1346
#18 0x004685dc in SQVM::Set (this=0x9a9500, self=..., key=..., val=..., 
    selfidx=3) at extlibs/squirrel/squirrel/sqvm.cpp:1317
#19 0x0046435c in SQVM::Execute (this=0x9a9500, closure=..., nargs=2, 
    stackbase=15, outres=..., raiseerror=1, et=SQVM::ET_CALL)
    at extlibs/squirrel/squirrel/sqvm.cpp:817
#20 0x004693dc in SQVM::Call (this=0x9a9500, closure=..., nparams=2, 
    stackbase=15, outres=..., raiseerror=1)
    at extlibs/squirrel/squirrel/sqvm.cpp:1526
#21 0x004494f8 in sq_call (v=0x9a9500, params=2, retval=0, raiseerror=1)
    at extlibs/squirrel/squirrel/sqapi.cpp:1086
#22 0x003b8c48 in Sqrat::Function::Execute<int> (this=0x81e2a4, a1=92621951)
    at extlibs/sqrat/include/sqrat/sqratFunction.h:686
#23 0x003a6538 in FeVM::on_tick (this=0xfffeea18) at src/fe_vm.cpp:1196
#24 0x0040d1c8 in main (argc=5, argv=0xfffef664) at src/main.cpp:1080

I am using the latest git version of attract and sfml-pi. Cheers!

mickelson commented 1 year ago

Hi thanks for the reports and info. I've not been able to reproduce this myself locally but it looks to be an error during video thread creation. I think the code in the following pull request should fix it, if you could test and let me know that would be appreciated: https://github.com/mickelson/attract/pull/734

kwyxz commented 1 year ago

Thanks @mickelson ! Built and running now. Sometimes it takes several hours to crash on my Pi 4, I will let it run and will keep you posted.

kwyxz commented 1 year ago

It's been running for almost 48 hours now with no crash, as far as I am concerned #734 is a valid fix for my issue.

mickelson commented 1 year ago

awesome, thanks for testing!

On Mon, Jan 9, 2023 at 7:15 PM kwyxz @.***> wrote:

It's been running for almost 48 hours now with no crash, as far as I am concerned #734 https://github.com/mickelson/attract/pull/734 is a valid fix for my issue.

— Reply to this email directly, view it on GitHub https://github.com/mickelson/attract/issues/720#issuecomment-1376671632, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDN6Q42DFHZDMZ7NGIVGALWRTH5LANCNFSM5X5NIREQ . You are receiving this because you were mentioned.Message ID: @.***>

mickelson commented 1 year ago

Fixed with #734