ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
24.1k stars 1.05k forks source link

SimRail - The Railway Simulator (1422130) #6458

Open jannis3005 opened 1 year ago

jannis3005 commented 1 year ago

Compatibility Report

System Information

I confirm:

steam-1422130.tar.gz

Symptoms

Poor Performance - to get about the same Framerate that I get on Windows with Ultra Settings, I have to drop them down to Medium on Linux. It's a huge difference in visual fidelity.

The game sometimes crashed. But it's very ocasional, so it's not easy to reproduce, it crashed about 3 times in 5 hours of paytime.

20230116192220_1

Reproduction

  1. Start the game
  2. Set graphics settings to Ultra
  3. Observe unplayable Framerate
  4. Drop Settings to Medium
  5. Game becomes playable but looks really bad
  6. Run game on same Hardware on Windows
  7. Game is really playable on Ultra using the same Hardware
kisak-valve commented 1 year ago

Hello @jannis3005, this line might be related to the performance overhead err:combase:RoGetActivationFactory Failed to find library for L"Windows.System.DispatcherQueue" due to how often it is being called:

grep 'Failed to find library for L"Windows.System.DispatcherQueue"' steam-1422130.log | wc -l
270059
jannis3005 commented 1 year ago

Yeah looks likely to be the issue. This is something that would have to be implemented right?

jannis3005 commented 1 year ago

It has gotten Worse. Now, whenever trying to load into a scenario or multiplayer, steam crashes, taking the game with it. I've attached the logs and the crash dump from steam.

Or maybe steam and the game both crash.

EDIT: Only happens on Wayland - does not occur on Xorg.

crash.tar.gz

kisak-valve commented 1 year ago

Hello @jannis3005, your minidump is a SIGSEGV in libnvidia-glcore.so.525.78.01 and your log hints that Steam is indeed dying from underneath the game as a result. The NVIDIA proprietary driver doesn't have an established history of being reliable with Wayland based user sessions and that crash should be reported to your video driver vendor.

matejdro commented 1 year ago

There is also one annoyance that is particularly serious for this game: whenever you make a click with a mouse, the cursor will jump back to the center of the screen. This makes repeated clicks of same (or close) train controls pretty frustrating process.

This is with i3 and X11, not sure if Wayland is any different.

EDIT: this only appears to be happening in driver mode, not in dispatcher mode. Apart from the mouse issue, game seems to be running file, albeit with less performance than in Windows (but still playable)

lyarenei commented 9 months ago

IIRC I think that the cursor was not resetting when running with proton 7. Anyway, after the big update in November, the cursor does not seem to reset anymore.

The only issues now seem to be:

Otherwise it's very much playable. Cannot talk about the performance difference between proton and native Windows as I don't have Windows installed right now.

kisak-valve commented 3 months ago

SimRail - The Railway Simulator (1422130)

Issue transferred from https://github.com/ValveSoftware/Proton/issues/7860. @Tropingenie posted on 2024-06-29T01:54:08:

Compatibility Report

System Information

I confirm:

Symptoms

Memory leak. Observed process was using ~8GB after an hour of gameplay, and upwards of 18GB after two.

Reproduction

  1. Launch game
  2. Play multiplayer in dispatch mode
  3. Observe memory usage continually increases, until OS deadlocks

steam-1422130.log

Bugbavka commented 3 months ago

@Tropingenie Try disabling game telemetry, if it helps with memory leak. Telemetry will stop, if the game cannot write to: <Steam_path>/steamapps/compatdata/1422130/pfx/drive_c/users/steamuser/AppData/LocalLow/SimKol/SimRail/logs/.

Use chmod -w <Steam_path>/steamapps/compatdata/1422130/pfx/drive_c/users/steamuser/AppData/LocalLow/SimKol/SimRail/logs/ to disable write access.

The leak can be brutal, managed to get on 110GB+ after few hours.

Tropingenie commented 3 months ago
  • Proton version: Default

Clarification: My proton default is set to 9.0-2

Tropingenie commented 3 months ago

@Tropingenie Try disabling game telemetry, if it helps with memory leak. Telemetry will stop, if the game cannot write to: <Steam_path>/steamapps/compatdata/1422130/pfx/drive_c/users/steamuser/AppData/LocalLow/SimKol/SimRail/logs/.

Use chmod -w <Steam_path>/steamapps/compatdata/1422130/pfx/drive_c/users/steamuser/AppData/LocalLow/SimKol/SimRail/logs/ to disable write access.

The leak can be brutal, managed to get on 110GB+ after few hours.

Doesn't seem to be a logging-related issue. I applied your suggestion, and after ~40 minutes the game was taking 10GB of RAM. Not sure why the rate increased, the only thing I can think of is more cars were passing my junction box this time.

After doing some more digging, I've found on the official and some mentions on Steam forums some mention of a memory leak on Windows with the most recent in January. Not sure how I missed those earlier, as I did check.

I ultimately used systemctl to limit the memory of the scope, since I use Flatpak Steam (an outdated explanation is in flatpak/flatpak#3439. For anyone who has the same problem I did, my workaround (at your own discretion--I offer no liability or warranty) was to run systemctl --user edit --force app-flatpak-com.valvesoftware.Steam-.scope and edit the override file to set the max memory per the resource control man. Note that this is limiting each Steam process to that much memory, i.e. all games, and only works with Flatpak Steam since Flatpak runs all its processes in a scope.

[Scope]
MemoryHigh=50%
MemoryMax=75%

One last edit: I dual boot Windows, so downloaded and ran the game on that machine. While I did see the memory peak at 10GB, the OS seems to handle it better. I'd guess there is still a memory leak, but this does mean the behavior is different between Proton and native.

Tropingenie commented 1 month ago

So doing a lot more digging, it seems as if this is an issue with DKVX, specifically on NVidia cards.

doitsujin/dxvk#1984 goes into detail how DKVX does not free VRAM allocations, making it more prone to video memory leaks; there's also a mention there how AMD cards handle the memory better and are thus less prone to the problem. doitsujin/dxvk#4118 also goes into some solutions. Both of these handle different games but are an avenue to explore (particularly the latter, which has some solutions I can try as a Hail Mary).

Even after swapping to Nobara, the memory leakage seems to be handled slightly better, and this most recent crash only killed XWayland (instead of locking up the whole system like it did on my Debian machine) despite me not limiting the memory usage in any way.

This most recent crash I was logging with PROTON_LOG=1 set, so I confirmed that at timestamp 42951 there was a memory error logged in dmesg:

[42951.369818] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00002d00] Failed to allocate NVKMS memory for GEM object
[42951.369978] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00002d00] Failed to allocate NVKMS memory for GEM object

Honestly, apart from buying an AMD card off Amazon or from my local MemoryExpress, I can't think of a decent approach to this. Part of me thinks that this is indeed an issue on Windows as well, and just not affecting that many people for whatever reason, but on the other hand I'm seeing DXVK issues which are specific to Linux. If anyone can lend a hand with reading the logs I'd appreciate it, otherwise I'll continue stabbing in the dark with some of the other solutions I'm pursuing.

Attached are the log files and dmesg output: SimRail_log_2024-08-29_21-19-42.txt

2024-08-29_22-42_Simrail_dmesg.txt

steam-1422130.log (via file.io, link expires in one year, ~300MiB)