ppy / osu-stable-issues

Report critical osu-stable issues here
60 stars 11 forks source link

Small Lag Spikes during gameplay #816

Closed Mysidian closed 2 years ago

Mysidian commented 3 years ago

During short and long osu sessions, sometimes I got some microstuttering/small lag spikes, idk why this happens, no third-party apps, no google chrome no discord, lastest osu stable version, updated nvidia drivers, etc etc...

thx for helping

Posted some options in this image

image

and this is a video about the issue

https://user-images.githubusercontent.com/82321696/129450935-3df97868-c92a-4df7-977f-9ce99d72c971.mp4

peppy commented 3 years ago

Please run under cutting edge and turn on performance logging in settings, then send your performance.log files (there may be several of them) after this happens.

Mysidian commented 3 years ago

Sorry for late, this is what I have on performance.log files

performance.log

peppy commented 3 years ago

The attached performance log only shows you being at the menu. Are you sure you didn't restart osu! after reproducing the issue? The logs are cleared each time you start the game.

AriizuCA commented 2 years ago

Hi, I am also having a similar issue and would like some help with how to fix it. Cross posting this from the osu! forums since it isn't gaining any traction.

Problem Details: I've been noticing an increase in spiked frames while playing. These spiked frames can be severe enough to easily break combo at random intervals. Under "Video or screenshot showing the problem," these are the videos of the worse spikes which would easily break combo. While playing, there are also many micro spikes which are noticeable but do not impede gameplay that were not recorded. I switched to Cutting Edge in order to generate a performance log for the play session and noticed a decrease in the severity of the spiking issue; on stable I would experience sometimes a full second or two of spiked frames and scores wouldn't submit because of it. Frequency of spikes are still an issue though and has been ongoing for at least a couple of months with it becoming more common lately. Any help is appreciated!

Computer Specs: Processor: Ryzen 7 5800X GPU: GeForce RTX 3080 RAM: 32 GB (2 x 16 GB) DDR4 OS: Windows 10 Home 10.0.19043 Build 19043

Programs Running While Playing/Streaming: (I kind of need these to be running for my stream setup) Chrome OBS gosumemory osu!StreamCompanion KeyOverlay Streamlabs Chat Bot Snaz chatterino Discord

Some Solutions I've tried: osu! wiki Performance Troubleshooting osu! - How To Fix Lag Spikes & Stuttering How to Make osu! Run Better: The Basics

Video or screenshot showing the problem: These videos are from February 21st, 2022 and document a majority of the spiked frames that I experienced throughout the play session along with timestamps synchronized with the uptime counter in the top right. 00:25:22 00:29:49 01:39:31 02:12:46 02:22:34 02:47:26 03:41:50 04:07:46

osu! version: Cutting Edge 20220221

timelessnesses commented 2 years ago

maybe try stable version first?

AriizuCA commented 2 years ago

I'm uncertain if stable generates a performance log like cutting edge does. Stable also was what I've been running most of the time, but has been the worst offender for the spiked frames in terms of length that the frames freeze. Only switched to cutting edge for the last week since it is slightly more stable with the spiked frames. This happened while on stable and I had several other moments where the game would seemingly freeze up for more than a second, causing scores to no longer be submitted even after I completed a map. In those cases, I wouldn't die in game even if there should have been notes while the longer spike plays out. The game would just continue normally after frames return and HP would not drop. On the one's that I could recover on and pass the map, I would get an error message and not see the score submitted on the leaderboards, as if the score was an offline play or something and score would remain in locals. I do not have these moments documented, but they happened within the last month, and it happened twice before switching to cutting edge. It might take time to find if they are important enough to find.

smoogipoo commented 2 years ago

A few ideas:

AriizuCA commented 2 years ago

After playing for several hours: Steam was not running in the background so no issue there. No prior games were played before hand. Closed Discord but still got a frame spike. Closed Chrome & Discord and still got a frame spike. Restarting and running osu! immediately, with no other programs running aside from some that get minimized to system tray (Nvida settings/ShareX/etc.), got a single spike frame at the start of one map. Overall though, no micro spikes, game played very smooth, and that one spike frame at the beginning of the map might have been a loading issue. Performance.log from after restarting PC.

peppy commented 2 years ago

Can you elaborate on how the final test went smooth vs the two before it? I'm a bit confused as to how you're testing there. If the restart was the only difference, can you also try after a restart with discord/chrome still open and confirm it's still smooth?

If that's the case, keep track of what you are doing after the restart until the lag starts to occur again (to the best you can). Things like putting the PC to sleep, locking it, running certain games. If we can isolate this down to something that's happening on your PC which triggers the lag permanently from that point onwards, we may be able to find a solution (for either just you or something more universal).

I'm also interested to know whether switching compatibility mode on after the lag spikes start helps at all. This will force the game to use DirectX, which we've found to be more resilient to external factors than OpenGL.

AriizuCA commented 2 years ago

To elaborate on why the game was more smooth after restarting PC. All of these tests have been ran with Unlimited Gameplay enabled. The counter at the bottom right corner of the screen hovered around 0.4-0.5ms directly after restarting with no other programs opened. When Chrome or Discord were opened, the game ran between 0.8-1.2ms with a lot more fluctuation. Running in Optimal also capped the game to 1.2ms.

Normally when I play osu!, it will be near the end of the day after my PC has been running for 12+ hours so not sure if that might cause issues. I have tried compatibility mode before but will test again tomorrow.

peppy commented 2 years ago

I'd highly recommend you don't run unlimited when testing this stuff. Or ever. Because it is known to add stutters caused by excessive garbage collection or GPU overloading.

Will wait to hear back on your subsequent results. Very likely that something is getting your system or GPU into a suboptimal state, by the sounds of it.

AriizuCA commented 2 years ago

Tested different settings to see if anything changes: (all these configurations are without restarting my computer as I wanted a standard baseline for testing)

Cutting Edge, Optimal, All Apps (standard configuration for stream)

Cutting Edge, Optimal, Compatibility Mode, All Apps

Cutting Edge, Optimal, Minimum Apps Opened (Included Twitch Chat, OBS)

Cutting Edge, Optimal, Compatibility Mode, Minimum Apps Opened

One of my viewers also suggested running the Ctrl+F11 graph which I was only running for the last configuration. Mostly appeared normal, though occasionally white tick spikes would appear on the graph. We discovered that these white ticks were caused by my keypad. Not sure if that is contributing to the issue but thought that I should note it.

peppy commented 2 years ago

If you can confirm that all spikes are white, and you can find the cause of the white spikes then you have found your issue.

AriizuCA commented 2 years ago

I'm not sure if the white spikes on the Ctrl+F11 graph are what is causing the spiked frames. They show up frequently on the graph, about 1-2 every second, and I didn't experience any spikes while the graph was open. This was due to testing for around 10 minutes before I had to stop streaming.

Here is a clip showing the white spikes on the graph for clarification. There is a break in the map and no white ticks appear since I am not tapping on my keyboard.

Will do more tests with the Ctrl+F11 graph open later today.

AriizuCA commented 2 years ago

This time I tested with the original first setup of Cutting Edge, Optimal, and All Stream Apps for a period of three hours while having the Ctrl+F11 graph open. What I noticed is that in the moments that laggyness or spiked frames occurred, the graph would either stagger or nearly stop in movement. This also happened when I was not getting good accuracy on a stream, so not sure if the issue is also tied to the sudden rendering of many 100's and 50's or that may be another cause to be looked into. Here is the performance log for the session.

I've clipped the instances where the graph was behaving in a weird way. During this three hour stream, I had 31 moments where frames were dropped from a variety of different severities. Most of the dropped frames were minimal frame drop moments which were recoverable or barely even noticeable. Eight moments were high frame drop moments which were recoverable but very noticeable. Three moments were spiked frames which were not recoverable and would guarantee a miss.

Minimal Frame Drop Examples: (6) 00:42:49 00:44:18 00:46:53 01:20:52 01:22:36 01:43:48

High Frame Drop Examples: (8) 00:10:47, 00:10:53 00:32:35 01:18:57 01:50:22 01:54:05 Here is the low accuracy stream where the frames dropped considerably. 02:27:07 02:47:09

Spiked Frames Examples: (3) 01:18:43 01:44:26 02:27:17

I would also like to note that I did have an issue in the past where the graph did a similar movement with frame issues and that was resolved by adjusting the polling rate of my mouse from 1000 Hz to 500 Hz. It is still at the 500 Hz setting due to that and I had tried adjusting the polling rate weeks ago (before implementing cutting edge or optimal, or after reviewing that the graphs were doing the same thing in todays stream) with it not fixing the spiked frames. May have to adjust the polling rate again tomorrow to see if it changes anything with cutting edge and optimal enabled.

peppy commented 2 years ago

Thanks for the reports, these are useful. I'll go through them and see if there are any issues that could potentially be improved from our end.

But also let me say that.. I feel to some extent as a developer that we are in the position to only fail. Each of the external applications you are running on stream are likely rendering via webkit, which is known to cause issues when run adjacent to 3d apps. In addition, they are reading from the process memory, which could also potentially cause issues.

I know we've already covered this but I just want to reinforce that this is very hard for us to do well at. Many people claim that "other game does fine", but that may just well be that when playing the other game there are less things interacting with it, as most games prohibit the kind of interactions that osu! is allowing.

Quite frustrating from our perspective, so thought I'd detail this.

Shouldn't need further details for now, will go through your logs over the next days.

peppy commented 2 years ago

@AriizuCA I've pushed a release to cutting edge with some initial changes that I'd like you to test. I have no idea whether it will solve your specific issues, but reading through your log it may help with a couple of spikes.

Note that it may also do nothing.

This will only have effect during gameplay. I've noticed you get a lot of spikes at song select and results screen, but these are unrelated to what I'm looking at for now.

AriizuCA commented 2 years ago

First off, I would like to thank you for taking the time out of your schedule to help me with this issue. If the main culprit is a third party application, then that is completely out of your control and I would never place blame on you for that. If it is a third party app, then I definitely want to help narrow down which one it is and have it documented so that others who might have a similar problem have an idea as to what might be causing it. It's just that I'm not too knowledgeable on this kind of stuff and most of my problem solving has been through brute force, so this thread has helped narrow down the issue a bit.

Testing today, I tried two different configurations on the latest update for Cutting Edge. Bad news was that it did not seem to change much with the spikes for the configuration of Cutting Edge, Optimal, and All Stream Apps (3 spiked frames in 50 minutes) as well as Cutting Edge, Optimal, Compatibility Mode, and All Stream Apps (2 spiked frames within 25 minutes).

Performance Logs for these sessions if you needed them:

Some good news though, was when I was running a barebones stream set up with the bare minimum apps (OBS, Chatterino (twitch chat), osu!, and my stream timer) on Cutting Edge and Optimal. The other day, it seemed that even if I was running this set up, I would still get spiked frames. Today, I ran this set up for nearly two hours without seeing any spiked frames, much less any minimum frame drops. After that, I tested with all apps relaunched and also did not get any frame rate loss for twenty minutes before I had to end stream.

Performance Log for Lagless Session:

This makes me wonder if launching osu! before any of the stream apps changes priority for how processes are handled for computer resources. Either way, it seems that one of the streaming apps that I am using is the culprit. Not 100% sure since this is the first session where the frame drops seemed to not exist after relaunching apps, but that was also for a small period of time so I will test this tomorrow.

peppy commented 2 years ago

Launching osu! first could potentially cause apps that were hooking on new application launch to not "see" osu!. Not sure if that's what's happening, but it's a theory. If you can continue to test one change at a time and figure which application is responsible we can probably take things further.

AriizuCA commented 2 years ago

[Configuration 1] So I tried running the game first then all the stream apps after and still had spiked frames (2 within 25 minutes). This was to test if it mattered what order the game and apps were opened, which doesn't seem to be the case. Will leave performance logs for each session if they matter at all.

[Configuration 2] Restarted the game first and then ran with Discord, Chrome, and the bare minimum of streaming apps to see if anything would change. Had no frame drops in a 45 minute period.

[Configuration 3] Restarted the game again, leaving all previously opened apps active while also adding gosumemory. This was to see if one of the apps that directly interacts with the game was causing the problem. No frame drops for 50 minutes.

[Configuration 4] Restarted game, closed gosumemory, and started StreamCompanion with the same though that maybe since it interacts with the game, that it could be the source of the spiked frames. Had no frame drops in 50 minutes.

[Configuration 5] Restarted game and had both gosumemory and StreamCompanion run at the same time with the second configuration of apps. The thought was, maybe the two apps aren't behaving well together. No spiked frames in a 45 minute period.

[Configuration 6] Restarted game and added the keyoverlay along with all of the previously used apps in the previous configuration. This test lasted 30 minutes and no spiked frames were detected.

I do find it strange that initial launching of the game as well as applications for streaming are causing spiked frames, but as soon as I restart them all, the spiked frames disappear. I might need to just keep running the game when it spikes and then close each app one by one to see if that helps determine which one is causing the issues.

In the end, restarting the game and apps after initial launch does seem to solve my initial issue in a roundabout way. Long term testing is still required to confirm this as most of the tests that I've done are with different configurations that only last about an hour. I would like to see how stable the resetting method is after 2-3 hours of gameplay. So tomorrow, I can test that or keeping the game open and closing individual apps over time while the spiked frames are happening.

AriizuCA commented 2 years ago

Updated to latest version of Cutting Edge (not sure if there was a change like the previous patch for this issue) and did not experience any spiked frames in todays stream with all my normal applications opened. Gameplay lasted for around 3.5 hours without any spiked frames. Here is the performance log.

Did notice that StreamCompanion doesn't see osu! so it wasn't working. Looked back at previous streams and noticed that it hasn't been working since March 2nd, I only every use it to display real-time UR. TheMad_N's comment on the previous patch notes seems to confirm a similar issue. Not 100% sure that it was StreamCompanion causing the spikes since I was still able to have spiked frames in the last two days with it not working. However, gosumemory, a very similar type of application, does work so not really sure why StreamCompanion broke.

Will stream again with the same configuration I had today to see if I can have 2 days in a row where no spiked frames occur.

AriizuCA commented 2 years ago

Still no spikes during stream for a three hour period. I asked a friend, who doesn't stream but was also experiencing spiked frames, and they said that their spiked frames have also disappeared in the last couple of days. I think whatever change that took place has resolved the spiked frame issue. Will report back in a week to confirm for certain that the spiked frames are gone. Thank you once again peppy for resolving this.

peppy commented 2 years ago

Great to hear. As a heads up, the windows key blocking changes have been rolled out to stable now.

AriizuCA commented 2 years ago

So after testing for a week on stable, I've not experienced any spiked frames outside of when a new StreamCompanion update occurred. This update v220309.20 states in the patch notes that it "fixed" the memory reading of IsReplay flag completely breaking SC (StreamCompanion) after latest osu! update. After testing with the latest version of StreamCompanion, the spiked frames returned. It is easy enough to not stream with StreamCompanion, but it does seem like the largest source of the spiked frames were due to it.

Not all the frame rate issues were StreamCompanion alone, since small drops in frames also used to happen even with StreamCompanion off, so the changes made in this thread have improved stability significantly for framerate for myself and hopefully for others who might have experienced similar issues. Once again, thank you for the help!

peppy commented 2 years ago

Thanks for the update. Are you planning on reporting the issue to stream companion's dev? It would be good to have an issue to link to so we can add this to our performance troubleshooting guide (https://osu.ppy.sh/help/wiki/Performance_Troubleshooting) suggesting people disable that app until it's confirmed it doesn't cause issues.

stevefan1999-personal commented 1 year ago

I also wanted to point out that I have a consistent lag spike on my Ryzen 3700X if I'm running memory hungry applications alongside osu like Edge (excuse me but I have 300 tabs).

My guts feelings pointed me to specific CPU configuration issue. As I'm running a 3700X it is a Zen 2 architecture, but for Zen architecture in general, memory access between CCX (think of it as a tiny NUMA cluster inside the same CPU package) have significant penalties due to cache coherence and synchronization.

So, for latency intensive software like DAWs and games especially rhythm games, it is strongly advised to schedule the program and the memory on the same CCX, but if you have another program that takes a huge chunk of memory, it is highly possible that the memory could be spilled all over different places, making memory scheduling difficult and often stored on non-optimal locations, hence the lag spikes.

This is so annoying on stable as I have to either drop my tabs from 300 to 60, or close the Edge browser entirely, but apparently the issue is gone on lazer.