NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.59k stars 13.07k forks source link

steam: tcmalloc issue in older native source games #292139

Open U2C9727A4 opened 4 months ago

U2C9727A4 commented 4 months ago

Describe the bug

In nixos-unstable, steam games (specifically TF2) has been unable to launch. rolling back to an older generation fixes the issue.

Steps To Reproduce

Steps to reproduce the behavior: idk, Perhaps a recently updated package is causing it?

Expected behavior

The game was supposed to launch properly, But it didnt.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.77, NixOS, 24.05 (Uakari), 24.05pre584422.a4d4fe8c5002`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"home-manager, nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

U2C9727A4 commented 4 months ago

side note: nix-info was ran on the generation that does run TF2

Jayman2000 commented 4 months ago

Could you post a log of what happens when you try to launch TF2? Specifically, here’s how you can get a log of TF2’s stdout and stderr:

  1. Open your Steam library.
  2. Right click on Team Fortress 2 and select “Properties…”
  3. Set the launch options to %command% &> log.txt
  4. Close out of the properties window.
  5. Launch TF2.

That will create a file named “log.txt” in TF2’s root folder. If you could post that log file, that would be super helpful.

U2C9727A4 commented 4 months ago

Could you post a log of what happens when you try to launch TF2? Specifically, here’s how you can get a log of TF2’s stdout and stderr:

1. Open your Steam library.

2. Right click on Team Fortress 2 and select “Properties…”

3. Set the launch options to `%command% &> log.txt`

4. Close out of the properties window.

5. Launch TF2.

That will create a file named “log.txt” in TF2’s root folder. If you could post that log file, that would be super helpful.

Heres the file

Its from the generation that cannot launch TF2

TF2.log

Jayman2000 commented 4 months ago

The log says

src/tcmalloc.cc:278] Attempt to free invalid pointer 0xa705af0

which indicates that you’re experiencing this TF2 bug. Try this workaround.

U2C9727A4 commented 4 months ago

Thats weird, If i use an older generation TF2 launches perfectly fine, but not on a newer generation

Jayman2000 commented 4 months ago

Does the workaround fix TF2 for you?

Atemu commented 4 months ago

@U2C9727A4 could you do a first-parent bisect on nixos-unstable to figure out which exact commit it was?

CertainLach commented 4 months ago

Also affects SteamVR: https://github.com/ValveSoftware/SteamVR-for-Linux/issues/579#issuecomment-1907231748

New version of Mesa uses aligned_alloc, which isn't implemented in TF2/SteamVR provided tcmalloc.so, thus this memory allocation is done using NixOS's glibc

However, after Mesa finished using this allocation, it tries to free memory using tcmalloc.so, and tcmalloc has no idea about this allocation, because it was done by other allocator (Attempt to free invalid pointer)

Thats weird, If i use an older generation TF2 launches perfectly fine, but not on a newer generation

This is caused by updated Mesa.

U2C9727A4 commented 3 months ago

Also affects SteamVR: ValveSoftware/SteamVR-for-Linux#579 (comment)

New version of Mesa uses aligned_alloc, which isn't implemented in TF2/SteamVR provided tcmalloc.so, thus this memory allocation is done using NixOS's glibc

However, after Mesa finished using this allocation, it tries to free memory using tcmalloc.so, and tcmalloc has no idea about this allocation, because it was done by other allocator (Attempt to free invalid pointer)

Thats weird, If i use an older generation TF2 launches perfectly fine, but not on a newer generation

This is caused by updated Mesa.

Was the developers of mesa notified about this bug?

CertainLach commented 3 months ago

Was the developers of mesa notified about this bug?

This is not the mesa bug, it is just steam bundling old version of tcmalloc.so

devurandom commented 3 months ago

Was the developers of mesa notified about this bug?

This is not the mesa bug, it is just steam bundling old version of tcmalloc.so

Where is that library located?

I see these libtcmalloc.so:

Is TF2 an x86-32 binary, not x86-64?

Jayman2000 commented 3 months ago

Where is that library located?

$TF2_FOLDER/bin/libtcmalloc_minimal.so.4

Is TF2 an x86-32 binary, not x86-64?

TF2 is 32-bit only, unless you opt in to the x64_test beta branch.