mojira.dev

Fourmisain

Assigned

No issues.

Reported

MC-228430 Very long loading pause while booting the game ("Failed to add PDH Counter", caused by oshi) Fixed

Comments

(Final?) Update:

oshi-core-5.7.5 is now released and updating to it should close this issue.

 

The mentioned follow-up issue of F3+L freezing the game for a long time might only affect a handful of systems.

For some reason, the "Processor Information" performance counter can't be queried directly on my Win7 system, which is why it ends up querying WMI - but dbwiddis tested this on a Win7 VM and there it wasn't an issue.

 

For anyone reading:

This pausing/freezing issue can potentially be lessened by rebuilding performance counters. I have to warn however, that this is no easy task, it takes a lot of time, can potentially break things like .NET startup and the instructions don't fully work for Win7. For me it reduced the pause time from over 70s to about 3-7s.

Update:

We (by which I mean dbwiddis) managed to fix the boot pause by fixing a localization bug inside oshi (only non-English Windows machines should be affected by this issue).

The issue was that it couldn't find performance counters due to their localized names (as the warnings suggest) and was falling back to using WMI queries which can be very slow (usually 20+ seconds, 70+ on my system at least) when WMI hasn't "woken up" yet.

The original boot pause issue can be fixed by updating to oshi-core-5.7.5-SNAPSHOT.

 

That said, there's now a new issue that the same exact pause happens when pressing F3+L due to the use of `getProcessorCpuLoadTicks()`, which causes another slow WMI query.

This new issue should apply to all Windows systems as it doesn't appear to be a localization issue.

It is currently not clear if this can be fixed or if it needs to be worked around.

A possible workaround would be to simply asynchronously call `getProcessorCpuLoadTicks()` while booting, throwing away the answer. This should "wake up" WMI so the next possible F3+L profiling should be fast - but it's no guarantee.

I think I may have just confirmed it is indeed oshi that is taking up so much time.

Compiling it and running the SystemInfoTest (like explained here) produces the following log output:

2021-06-10 21:16:39.827 [INFO] SystemInfoTest - Initializing System...
2021-06-10 21:16:40.095 [INFO] SystemInfoTest - Checking computer system...
2021-06-10 21:16:40.153 [INFO] SystemInfoTest - Checking Processor...
2021-06-10 21:16:40.207 [INFO] SystemInfoTest - Checking Memory...
2021-06-10 21:17:55.063 [INFO] SystemInfoTest - Checking CPU...

As you can see, there's the over a minute long pause checking memory again, just like Minecraft while checking the pagefile.

I therefore went ahead and opened an issue over at the oshi issue tracker as well.