MangoHud Crash In Transport Fever 2 A `proc_vram` Bug Report And Analysis

by StackCamp Team 74 views

This article addresses a critical bug encountered in the Linux native version of Transport Fever 2 when using MangoHud. Specifically, the issue arises from the introduction of the proc_vram option in MangoHud, which leads to a crash during the game's execution. This bug report details the problem, including the steps to reproduce it, relevant hardware and software information, and debug logs to aid in resolving the issue. For users experiencing crashes with Transport Fever 2 and MangoHud, this article aims to provide a comprehensive understanding of the problem and potential solutions.

Bug Description: Crash Caused by proc_vram Option

The main issue reported is a crash in the native Linux version of Transport Fever 2, triggered by the proc_vram option introduced in MangoHud commit [1042aaa752ab5be72ac112f09fcae12b948286cd]. This crash occurs regardless of whether the proc_vram setting is enabled or disabled. The error message indicates an out-of-range exception within the basic_string::substr function, suggesting a problem with string manipulation related to the new option. The game terminates abruptly with a core dump, making it unplayable with the affected MangoHud version.

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 10) > this->size() (which is 9)
This option is not available. Please see --help for all possible usages.
/mnt/Games/steam/common/Transport Fever 2/run.sh: line 8: 244380 Aborted                    (core dumped) LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./TransportFever2

Hardware and Software Information

To provide a clear picture of the issue, it's essential to list the relevant hardware and software details. The user reporting the bug is running Arch Linux and has identified the first problematic commit as [1042aaa752ab5be72ac112f09fcae12b948286cd], which introduces the proc_vram option. The graphics card in use is an RX 9070 XT. This information is critical for developers to understand the environment in which the bug occurs and to replicate the issue for debugging purposes.

Detailed Breakdown of the Affected System

  • Operating System: Arch Linux, known for its rolling-release model and focus on providing the latest software versions, offers a modern environment for gaming but can sometimes expose compatibility issues more readily than stable-release distributions.
  • MangoHud Version: The specific commit [1042aaa752ab5be72ac112f09fcae12b948286cd] is the point at which the bug was introduced. This commit adds the proc_vram option, which is intended to display the VRAM usage of individual processes. However, it inadvertently causes a crash in Transport Fever 2.
  • Graphics Card: The AMD Radeon RX 9070 XT is a high-performance GPU. Issues with specific GPU models or driver versions can sometimes lead to crashes or other unexpected behavior in games and applications.
  • Error Message Analysis: The error message terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 10) > this->size() (which is 9) indicates that the program is trying to access a substring beyond the bounds of a string. This typically happens when the starting position or the length of the substring is incorrectly calculated. In the context of MangoHud, this suggests there might be an issue with how the proc_vram option is parsing or processing data, leading to an invalid string operation.

Steps to Reproduce the Crash

To effectively address the bug, it is crucial to have clear steps to reproduce the issue. This allows developers to quickly verify the problem and test potential fixes. The steps provided are straightforward and can be followed by anyone with the necessary setup:

  1. Install MangoHud version 1042aaa752ab5be72ac112f09fcae12b948286cd or later: This step ensures that the affected version of MangoHud is in use. Users may need to build MangoHud from source or use a package manager to install the specific commit.
  2. Launch the native Linux version of Transport Fever 2: This step involves starting the game through Steam or another game launcher. The native Linux version is essential, as the bug is specific to this platform.

By following these steps, users should be able to reliably reproduce the crash, which is a critical first step in resolving the issue.

Detailed Explanation of the Reproduction Steps

  • MangoHud Installation: Installing the correct version of MangoHud is crucial. This might involve cloning the MangoHud repository from GitHub, checking out the specific commit (1042aaa752ab5be72ac112f09fcae12b948286cd), and building the software using the provided build tools (e.g., make and sudo make install). Alternatively, if a package is available for the distribution, installing the specific version through the package manager might be an option.
  • Launching Transport Fever 2: The game should be launched through the standard method, typically via Steam. It's important to ensure that the native Linux version of the game is being run, as this bug specifically affects that version. This might involve verifying the game files through Steam or ensuring that the correct launch options are set.

Additional Context: Debug Log Analysis

The debug log provided offers valuable insights into the state of MangoHud and the system at the time of the crash. Analyzing this log can help pinpoint the exact cause of the issue. Here is a breakdown of the key parts of the log:

  • MangoHud Version: The log confirms the version of MangoHud being used (v0.8.1-94-ga4b64a2+), which aligns with the reported commit.
  • Configuration Loading: MangoHud attempts to load configuration files from various locations (/mnt/Games/steam/common/Transport Fever 2/MangoHud.conf, /home/nodscher/.config/MangoHud/TransportFever2.conf, /etc/MangoHud.conf, /home/nodscher/.config/MangoHud/MangoHud.conf). The log shows that it successfully parses the user-specific configuration file (/home/nodscher/.config/MangoHud/MangoHud.conf).
  • Parameter Parsing: The log lists the parameters being used by MangoHud, including gpu_stats, gpu_power, cpu_stats, cpu_mhz, vram, procmem, and importantly, proc_vram. This confirms that the proc_vram option is being parsed and enabled, which is consistent with the bug report.
  • System Information: The log includes system information such as RAM size, CPU model, kernel version, OS, and GPU model. This information is helpful for understanding the system environment in which the crash occurs.
  • GPU and Driver Details: The log shows that the GPU is an AMD Radeon RX 9070 XT (RADV GFX1201) and confirms the present mode as IMMEDIATE. This can be useful for identifying potential driver-related issues.
  • GPU Driver: The log confirms that the GPU driver is "amdgpu".
  • Process FDInfo: The log also includes the path to the process FDInfo directory (/proc/244380/fdinfo), which could be relevant for debugging file descriptor-related issues.

Implications of the Log Analysis

The log analysis indicates that MangoHud is correctly parsing the proc_vram option and attempting to use it. The fact that the crash occurs regardless of whether the option is explicitly enabled or disabled suggests that the issue might be in the code that handles the option's initialization or default behavior. The std::out_of_range error further points to a problem with string manipulation, likely within the context of reading or processing process-specific VRAM information.

Conclusion: Addressing the proc_vram Crash in Transport Fever 2

The crash in Transport Fever 2 caused by the proc_vram option in MangoHud is a significant issue that affects the usability of the overlay for users of the native Linux version of the game. By providing a detailed bug report, including steps to reproduce the issue, hardware and software information, and debug logs, the user has laid the groundwork for a fix. Further investigation by MangoHud developers is needed to pinpoint the exact cause of the std::out_of_range error and implement a solution. Potential areas of focus include the code that parses and processes process-specific VRAM data, as well as the initialization and default behavior of the proc_vram option.

Recommendations for Users

In the meantime, users experiencing this crash should avoid using MangoHud versions including and after commit [1042aaa752ab5be72ac112f09fcae12b948286cd] with Transport Fever 2. If monitoring system performance is crucial, an alternative overlay or monitoring tool may be necessary until a fix is available. Users can also track the issue on the MangoHud GitHub repository for updates and potential workarounds.

This comprehensive analysis aims to provide both users and developers with a clear understanding of the bug and the steps needed to resolve it, ensuring a smoother gaming experience for Transport Fever 2 players on Linux.