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
Unexpected frame stutters at regular intervals (GC related) #11800
Comments
There's nothing to work with in this report, nor is this reproducible for us. We cannot solve per-user performance issues like this sorry. If you happen to come up with some kind of profiling or further information please feel free to attach it to this issue thread and we will re-visit it. |
I am experiencing the exact same issue, and I have a few things to add to hopefully help solve this:
@pinembour, what DE are you using? I'm using KDE Plasma, maybe that could be a factor (though I doubt it)? |
If you want to rule out garbage collection, you can try clicking "clear all caches" at the bottom of settings. This will force the harshest garbage collection level (which will almost never run). You can also see garbage collections as they show up as dots on the frame graph, but keep in mind they may not necessarily be the cause but the result (the runtime sees that nothing is happening so it runs a GC). The spike will show on both graphs because draw is dependent on update. If there's no update run, there is nothing to draw on the screen so it will wait on the update to arrive. If it shows as "work" on both then it's guaranteed to be a draw-side issue (update blocking draw will show as sleep time on the draw thread). This 99.9999999999% rules out garbage collection, and points to a GPU, driver, or GL code issue. We can't really work further without you performing profiling on your system to find what is causing the gpu pipeline blocking. What I can say is that we don't experience this on Windows or macOS, so it is likely driver or hardware specific. |
Thank you for that crazy fast reply!
I did that, and just like you said, there are dots appearing on each of those spikes (red, yellow, and green ones if that matters).
I used Feel completely free to request any more info, I really want this to get figured out, as it's actually really annoying when playing. |
Are those after manually pressing the button in settings? I may have not been clear: that button will cause a stutter (it does for me as well, for around 10ms) because it's doing a lot of clean-up that usually would not occur. The trace output you provide may be useful if you can confirm (or provide a second set of trace output) during the actual stutters you are experiencing during gameplay or otherwise. |
Ah, sorry. These are actual stutters recorded during normal gameplay. I didn't press that putton at all during those traces. |
I'm glad I'm not the only one facing this issue, we might be able to figure something out here. Every point you added @Micha-ohne-el applies to me as well. I can also add that the time between each stutter seems to be dependent on the difficulty. For example on one song, in an easy 4k map the stutters may appear every 11s or so, but in a harder 7k map they would appear every 8s. ( I can also see a difference, although smaller, between a 4k easy and a harder 4k.)
I am using gnome, also tried with sway so I could rule out mutter, with no amelioration.
I'm not sure it matters, but the spike is actually visible on all 4 graphs |
I was thinking the same thing, but I thought I was imagining it (since the stutters don't always take the same amount of time, I thought it was just a coincidence that harder maps tended to have more severe stutters).
Yeah, seems as though the issue is within osu!.
Yes, for me the Audio and Input graphs show it in blue (meaning Sleep), which makes sense if they're also dependent on Update like Draw is. |
Please do not test using mania. This is the only ruleset which has not been optimised for memory usage. Test using the main menu (since you say you can reproduce there) or in another ruleset. |
Okay I'll keep that in mind, but I can still see that the difficulty correlates with the time between stutters in osu or taiko. |
I'm not sure the blame falls fully on osu!. I remember the game working fine not that long ago, but even a build from november has the same issue atm. Are you using Arch or a derivative ? I'm using Arch, but when I tried a liveusb of Fedora I couldn't reproduce the issue. |
So I recorded two more stutters with very controlled conditions so that they can be reproduced: |
Yeah, I remember that too, and I can also confirm the exact same thing, even older builds produce this behavior for me, despite me being reasonably sure that those builds worked fine for me before.
Yes, I'm using Manjaro, which is Arch-based. |
It could be, but I have no idea what the specific package would be. |
I'm willing to look into this and potentially point you in the right direction if you can record a trace in the standard dotnet format using |
Here is the trace from my system, with the exact same procedure @Micha-ohne-el described earlier. |
@peppy, thank you for considering this! If anything interesting happens related to this, or if I manage to fix it, I'll post my findings in here. |
Second trace (from #11800 (comment)): This is definitely looking to be a very deep GC execution. Not something we generally see happen, so it's curious as to why it's running. If possible, could you provide a longer trace where you stay at the main menu the whole time, but encounter two of these stutters? I'd like to cross-compare them to make sure it's the same thing each time. Also could you please specify your general memory stats (used / free / swap available?) GC trigger reason:
GC stats:
Weirdly it looks to start as a gen1, which shouldn't take this long in the first place, but the full log shows it going deeper? Also note that the GC isn't even under much load...
|
First trace (from #11800 (comment)) GC trigger reason:
GC stats:
This one is shorter, at 42ms, but that's still longer than we can live with. Very weird indeed.
|
Going to reopen to track this as it looks like an actual issue. The reason question here is that you both say that it worked fine at one point in time, which would point to a change in the way we are allocating memory or the underlying runtime. We recently switched to .NET 5 which could definitely have introduced some issues like this, but since you have already tried older builds (which should have the .NET runtime bundled) I'm not so sure.. Can you confirm that when you are checking old builds, you are using the AppImage, and not self-compiling or otherwise? |
Thank you for reopening and taking a closer look at it. I'll send a trace with multiple stutters in a few minutes. |
The important part is that when you are testing on the old build, you are using the AppImage, or explicitly compiling with the older .NET runtime (3.x should do fine). Conversely, ensure you are building using .NET 5 when building the newer release (although I believe this is a requirement these days, so should be enforced at compile time). |
Yes, I was using the AppImage, both with the most recent build, as well as the one from November last year. This is why I still think the issue is with Arch somehow. I actually reinstalled my entire system yesterday (for a different reason) and the issue still persists. Maybe I should install a non-Arch based distro and see if the issue persists? Definitely very weird. I'm currently on mobile, but I'll provide more traces and memory stats when I get on my PC. |
Here are two new traces. trace-new with a current version of the AppImage, trace-old with a version from november, still using an AppImage, 2020.1114.0. I definitely did not encounter the issue last november, but I do now. Both traces were recorded with dotnet 5.0.3.sdk103 |
Just for confirmation, can you show how you are running the appimage? The .NET runtime should be bundled inside, so I want to confirm you aren't somehow forcing the old version to run on .NET 5 (which is your system installed runtime/sdk version), as this is feasible and could mean a lot in figuring out where this regressed. |
We've made some pretty large improvements on this front. Things are still not perfect but I'm going to remove this from a milestone task for the time being. We still have some ongoing tasks which will further improve the situation. Please feel free to report back with further profiling in subsequent builds. |
Just posting back for future reference... https://osu.ppy.sh/beatmapsets/519505#osu/1906276 played with osu!mania is a good way to see the stutters in full effect: |
I experience some lag spikes while playing beatmaps. I haven't noticed those lag spikes for quite a while.
It also appears to happen more often when I limit the game to 160FPS via NVIDIA Control Panel. Screenshots or videos showing encountered issue: YouTube
osu!lazer version: Logs: |
Hard to say - nothing's changed in the last little while that would make them more prominent, but these spikes have been occurring for a long time now. It would be better to show the frame time by pressing Ctrl+F11 once more to get the graphs to show. You could also try running osu! with |
SummaryJust the next days I was not able to reproduce it. It's so weird. Probably some driver issues? For the sake of completeness, here are two recordings using the same pc, same osu version etc.. At least I can tell you that osu! is running at 600-700FPS on my machine (in multi-thread mode and when I'm not recording) 😄 Single threaded videoYouTube Multi threaded videoYouTube |
You don't need to keep reporting back. We know with absolutely 100% confidence that there is an issue, even if you're not experiencing it. |
Does this help? This PR fix an issue which is causing periodical long GC on gen 1, to verify whether it helps we need either use nightly build or 6.0 RTM for testing. |
Improvement looks to be marginal at best. Left is net6-rc1, right is compiled from master: As I mentioned in the thread, there seems to be a difference in how the GC tunes its gen1 heap size on Linux vs Windows, resulting in making it too large on Linux and triggering collections less frequently than we'd like. That's the primary issue here. The .NET team have yet to respond, unfortunately... |
How about the new standalone region based GC? (it can be built from source and consumed via setting DOTNET_GCName to the path of built clrgc.dll). It's not finished yet but worth a try in my opinion. |
Regions currently segfaults during gameplay. I also posted a repro for that in the comment I linked. |
An update on regions - they've since fixed the segfaults but it doesn't look like regions are helping, unfortunately. I still have to do my own investigation because it seems like Linux vs Windows allocates different budgets for Gen0, which is probably a bug that's somehow translating to regions as well. |
As a workaround until this is resolved, is there some way to prevent garbage collection during gameplay (provided the user has enough memory)? It would be preferable to have a massive garbage collection spike when the song is over, rather than periodic spikes throughout the song. I'm experiencing this issue on both Linux and Windows, which makes playing on Lazer infeasible currently. Also I noticed that on June 13th, Peppy added the tag "platform:linux" to this issue. Though multiple users have reported this occurring on Windows. Including #13969 which was closed as a duplicate of this. So it seems this is not platform-specific. |
If you read the issue you linked, you will notice that I say it is in no way related to this. It is also related to vRAM being exceeded as the user points out. There are no required workarounds for this issue on windows because it doesn't occur. If you are having performance issues, please open a new discussion thread. Make sure to test using the default skin and settings before doing so, as we have found some skins can cause issues due to excessively large resources. |
I'm not sure exactly which release resolved the issue. But I'm happy to report that at some point between 2022.1101 and 2022.1117, all stuttering issues have been resolved for me on Linux. |
Great to hear! Most likely the latest release. |
Going to tentatively close this for the time being. |
Seems i have the same problem on Windows, screenshot: version: 2022.1228.0 |
That's not GC. Swap buffer can be caused by anything. Definitely not this issue. Please wait for future performance updates. |
Describe the bug:
A few times per map I encounter a stutter that makes frame time for one frame spike. The screenshot shows the issue in mania but I encounter it in every game mode.
From what I saw, nothing in the logs seems to happen at the same time as the stutter.
I can reproduce this issue with stock or custom kernel, 5.10 or 5.11, amd gpu or nvidia, built from source or using appimage.
Screenshots or videos showing encountered issue:
osu!lazer version:
2021.212.0.r106.86faa7f465-1, reproductible with 2021.109.0-1 and anything in between, did not try anything earlier
Logs:
logs.zip
The text was updated successfully, but these errors were encountered: