Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-228430

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.17.1 Pre-release 1
    • 1.17
    • None
    • Confirmed
    • (Unassigned)

      Since 1.17-pre1 and also in 1.17, Minecraft almost always gets stuck for over a minute very early in the boot process seemingly doing nothing (no CPU usage).
      This did not occur in any version prior (confirmed for 21w20a).

      Sometimes, this pause only takes 3-4 seconds, but most of the time, it's doing the long con.

      This long pause can be seen in the log:

      [16:15:46] [main/WARN] [PerfDataUtil]: Failed to add PDH Counter: \Auslagerungsdatei(_Total)% Usage, Error code: 0xC0000BB8
      [16:15:46] [main/WARN] [PerfCounterQueryHandler]: Failed to add counter for PDH object: Auslagerungsdatei
      [16:15:46] [main/WARN] [PerfCounterQuery]: Disabling further attempts to query Paging File.
      [16:17:03] [Render thread/INFO] [YggdrasilAuthenticationService]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'

      The log line just before the pause stems from oshi, which was updated from 1.1 to 5.3.4 in 1.17-pre1 and it is using the newest version 5.7.4 in 1.17.

      Looking into it's code, the very next action after logging "Disabling further attempts to query ..." is to query the WMI as can be seen here:
      https://github.com/oshi/oshi/blob/4f56e5ba786121a00779e83af0cbf73ecf57b592/oshi-core/src/main/java/oshi/util/platform/windows/PerfCounterQuery.java#L105-L112

      This query is using a timeout value, which is set via the oshi.util.wmi.timeout field inside the oshi.properties file (inside e.g. oshi-core-5.7.4.jar) and that is currently set to -1, meaning no timeout.

      This makes me think it is stuck querying the WMI (for some other unknown reason).

      I wanted to try and change the timeout, but I'm not sure how, since it's part of oshi-core-5.7.4.jar and modifying it would cause it getting redownloaded (at least with the launcher I'm using).

       

      While this does look like oshi is the cause, I'm not 100% certain, which is why I'm reporting it here first.

            Unassigned Unassigned
            Fourmisain Fourmisain
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: