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

Launching multiple instances of Minecraft Java Edition in Windows may clobber latest.log file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 22w03a
    • None
    • Confirmed
    • Debug
    • Low
    • Platform

      Summary:

      The second instance of minecraft rotates `latest.log` while the first instance of minecraft continues to write messages. This will eventually result in the second instance destroying the first instance's log messages.  The bundled logging configuration file should be changed to avoid a collision, or the launcher should allow a user to override the logging configuration.

      Steps to Reproduce:

      1. Launch Minecraft Java Edition using any launcher profile.
      2. Collect log messages by joining a multiplayer server or opening a single player world, and run in-game commands.
      3. Launch another instance of Minecraft Java Edition using the same profile. log4j attempts to rotate `latest.log` currently opened by previous instance (?!)
      4. Continue to collect log messages in previous instance of Minecraft Java Edition.
      5. Reexamine `latest.log` and note the following:
        • The second instance is writing messages to the beginning of the file
        • The first instance continues to write messages to its last known position in the file, creating a gap of null bytes in the file

      It is possible for the second instance of minecraft to consume the zero-byte buffer, eventually catch up to the first instance of minecraft, and destroy log messages from the first instance.

      Additionally, the user cannot override the built-in log4j configuration file, as the launcher appends the `-Dlog4j.configurationFile=` command line option after the user's launcher profile JVM arguments. The user must derive a custom minecraft version by stripping out the configuration option from the version configuration.

      Possible Solutions:

      1. The bundled log4j configuration file may be updated to guard against clobbering when multiple instances of minecraft are running
      2. The launcher should prepend, rather than append, carefully chosen options to the command line; allowing the user to override some command line arguments

            Unassigned Unassigned
            fastcall22 - -
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              CHK: