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

Video-related crashes on some maps due to apparently negative duration #17345

Closed
xeome opened this issue Mar 19, 2022 · 22 comments
Closed

Video-related crashes on some maps due to apparently negative duration #17345

xeome opened this issue Mar 19, 2022 · 22 comments
Labels
area:storyboard osu!framework issue Can't resolve this without changes to osu!framework. platform/linux

Comments

@xeome
Copy link

xeome commented Mar 19, 2022

Type

Crash to desktop

Bug description

system information:
operating system: endeavouros (arch based)
kernel: latest zen kernel
gpu: gtx 760
gpu driver version: 470.103.01-1
i start a map and it crashes, log from terminal

Unhandled exception. System.ArgumentException: '0' cannot be greater than -0.001.
   at System.Math.ThrowMinMaxException[T](T min, T max)
   at osu.Framework.Graphics.Animations.AnimationClockComposite.get_PlaybackPosition()
   at osu.Framework.Graphics.Video.Video.Update()
   at osu.Framework.Graphics.Drawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Graphics.Containers.CompositeDrawable.UpdateSubTree()
   at osu.Framework.Platform.GameHost.UpdateFrame()
   at osu.Framework.Threading.GameThread.processFrame()
--- End of stack trace from previous location ---
   at osu.Framework.Platform.GameHost.<>c__DisplayClass126_0.<abortExecutionFromException>b__0()
   at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal()
   at osu.Framework.Threading.Scheduler.Update()
   at osu.Framework.Threading.GameThread.processFrame()
   at osu.Framework.Threading.GameThread.RunSingleFrame()
   at osu.Framework.Platform.ThreadRunner.RunMainLoop()
   at osu.Framework.Platform.GameHost.windowUpdate()
   at osu.Framework.Platform.SDL2DesktopWindow.Run()
   at osu.Framework.Platform.GameHost.Run(Game game)
   at osu.Desktop.Program.Main(String[] args) in /var/lib/buildkite-agent/builds/debian-gnu-linux-vm-2/ppy/osu/osu.Desktop/Program.cs:line 109
[1]    25924 IOT instruction (core dumped)  ./osu.AppImage

Screenshots or videos

No response

Version

2022.319.0-lazer

Logs

database.log
network.log
performance.log
runtime.log

@bdach
Copy link
Collaborator

bdach commented Mar 19, 2022

the logs do not contain the crash trace you've pasted in, so you must have started the game after the crash again. we explicitly ask not to do that in the template because the logs are now unusable.

please link the map on which this occurs.

@bdach bdach added the missing details Can't move forward without more details from the reporter label Mar 19, 2022
@xeome
Copy link
Author

xeome commented Mar 19, 2022

im sorry, im updating the logs
the map

@enoslayd
Copy link

Have you tried to play the map with video turned off?

@bdach
Copy link
Collaborator

bdach commented Mar 19, 2022

@enoslayd turning video off is not a valid solution. this looks like an actual bug. please do not suggest such things.

@xeome
Copy link
Author

xeome commented Mar 19, 2022

i have updated the logs on the main issue post
but here they are again:
database.log
network.log
performance.log
runtime.log

@xeome
Copy link
Author

xeome commented Mar 19, 2022

ok logs didn't include the crash trace again for some reason...
i did it again, these logs include it:
database.log
network.log
performance.log
runtime.log

video showing the crash:

simplescreenrecorder-2022-03-19_17.50.13.mp4

@xeome
Copy link
Author

xeome commented Mar 19, 2022

any other information needed?

@bdach
Copy link
Collaborator

bdach commented Mar 19, 2022

i can't reproduce this locally but i think i can see how this can happen. no more info needed thanks.

@bdach bdach added osu!framework issue Can't resolve this without changes to osu!framework. area:storyboard and removed missing details Can't move forward without more details from the reporter labels Mar 19, 2022
@bdach
Copy link
Collaborator

bdach commented Mar 19, 2022

so i'm reasonably sure this is going to boil down to formatContext->duration being negative here:

https://github.com/ppy/osu-framework/blob/cd289a0adafdbe1660446a86719c7436b40f7338/osu.Framework/Graphics/Video/VideoDecoder.cs#L340-L343

@Opelkuh do you know if it is perhaps possible that the aforementioned value is negative? i'm guessing it is -1 in this reported case, leading to a clamp failure multiple layers down the line. i don't think there's anything more intelligent to be done here than fail decoding entirely?

link map for reference, maybe someone else will be able to repro: https://osu.ppy.sh/beatmapsets/1643234#osu/3354107

@bdach bdach changed the title crash when starting a map Video-relating crashes on some maps due to apparently negative duration Mar 19, 2022
@bdach bdach changed the title Video-relating crashes on some maps due to apparently negative duration Video-related crashes on some maps due to apparently negative duration Mar 19, 2022
@alikindsys
Copy link
Contributor

can't repro on windows, seems to be platform specific.

@bdach
Copy link
Collaborator

bdach commented Mar 19, 2022

yes it will be. it's likely to be linux-specific due to use of VDPAU, probably even ffmpeg-version-specific. saying you can't repro when i already said i can't either brings 0 value.

@Opelkuh
Copy link
Contributor

Opelkuh commented Mar 19, 2022

The duration can be negative if the video stream doesn't provide it. I don't know if there are video containers that do this but it's the case with e.g. RTSP streams. Stopping decoding in that case is probably the safest bet.

But I'm not sure what's causing it here, the video file does have duration set correctly.

I reprod the crash in osu-framework by hardcoding a RTSP stream as the input:

diff --git a/osu.Framework/Graphics/Video/VideoDecoder.cs b/osu.Framework/Graphics/Video/VideoDecoder.cs
--- a/osu.Framework/Graphics/Video/VideoDecoder.cs	(revision 14ed4f4ac0a05e1ce48ec18d019536ad0262114b)
+++ b/osu.Framework/Graphics/Video/VideoDecoder.cs	(date 1647710347145)
@@ -318,10 +318,10 @@
 
             var fcPtr = ffmpeg.avformat_alloc_context();
             formatContext = fcPtr;
-            formatContext->pb = ioContext;
+            // formatContext->pb = ioContext;
             formatContext->flags |= AGffmpeg.AVFMT_FLAG_GENPTS; // required for most HW decoders as they only read `pts`
 
-            int openInputResult = ffmpeg.avformat_open_input(&fcPtr, "dummy", null, null);
+            int openInputResult = ffmpeg.avformat_open_input(&fcPtr, "rtsp://rtsp.stream/pattern", null, null);
             inputOpened = openInputResult >= 0;
             if (!inputOpened)
                 throw new InvalidOperationException($"Error opening file or stream: {getErrorMessage(openInputResult)}");

@bdach
Copy link
Collaborator

bdach commented Mar 19, 2022

we may be unable to reproduce due to ffmpeg version differences...

@xeome please post the output of ffmpeg -version on your machine.

@smoogipoo
Copy link
Contributor

smoogipoo commented Mar 22, 2022

I can repro the crash.

$ ffmpeg -version
ffmpeg version n5.0 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil      57. 17.100 / 57. 17.100
libavcodec     59. 18.100 / 59. 18.100
libavformat    59. 16.100 / 59. 16.100
libavdevice    59.  4.100 / 59.  4.100
libavfilter     8. 24.100 /  8. 24.100
libswscale      6.  4.100 /  6.  4.100
libswresample   4.  3.100 /  4.  3.100
libpostproc    56.  3.100 / 56.  3.100

5.0 seems pretty big (I think 4.0 is the latest supported by o!f right now?)

@frenzibyte
Copy link
Member

frenzibyte commented Apr 2, 2022

osu!framework seems to run on FFmpeg 4.3.3 as of now, and the issue will probably hide once the proper FFmpeg libraries get shipped with the linux builds (ppy/osu-framework#4349), to then become apparent once we update to FFmpeg 5.0 (ppy/osu-framework#5051).

Perhaps this sort of issue should be bundled within ppy/osu-framework#5051 instead.

@huupoke
Copy link

huupoke commented Apr 13, 2022

A temporary workaround to make video work again, is to override the library loading path to make it use the 4.4 version.
env LD_LIBRARY_PATH=<path_to_ffmpeg_4.4_libraries>:"$LD_LIBRARY_PATH" <path_to_osu_executable>

Arch Linux users can install the ffmpeg4.4 package and set their LD_LIBRARY_PATH to /usr/lib/ffmpeg4.4:"$LD_LIBRARY_PATH"

@ThatOneCalculator
Copy link

Adding onto this:

Editing line 7 of /usr/share/applications/osu-lazer.desktop to

Exec=env OSU_EXTERNAL_UPDATE_PROVIDER=1 LD_LIBRARY_PATH=/usr/lib/ffmpeg4.4:"$LD_LIBRARY_PATH" /usr/bin/osu-lazer

does the trick really well for launching from a gui menu

@itsMapleLeaf
Copy link
Contributor

Adding onto this:

Editing line 7 of /usr/share/applications/osu-lazer.desktop to

Exec=env OSU_EXTERNAL_UPDATE_PROVIDER=1 LD_LIBRARY_PATH=/usr/lib/ffmpeg4.4:"$LD_LIBRARY_PATH" /usr/bin/osu-lazer

does the trick really well for launching from a gui menu

Can confirm, this fixed the issue for me, and also made my videos work again

@peppy
Copy link
Member

peppy commented Apr 21, 2022

Tracking a fix for this at ppy/osu-framework#4349.

@ThatOneCalculator

This comment was marked as off-topic.

tutacat pushed a commit to tutacat/osu-lazer-bin that referenced this issue Sep 26, 2022
@Jordan-Jay
Copy link

This issue has been fixed as this map doesn't crash Lazer anymore. 👍

@bdach
Copy link
Collaborator

bdach commented Nov 5, 2022

That's because we're shipping FFmpeg inside the appimage, as described above. Closing as resolved.

@bdach bdach closed this as completed Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:storyboard osu!framework issue Can't resolve this without changes to osu!framework. platform/linux
Projects
None yet
Development

No branches or pull requests