this is an informal collection of my notes during my time as a beta tester for Team Fortress 2 Classic. various issues and bugs were encountered, and maybe this will serve as a crash course reference to debugging games in proton

attaching gdb, or, why the hell does the game crash?

it turns out to be relatively simple to get a debugger running on a game in proton.

PROTON_DUMP_DEBUG_COMMANDS=1 needs to be in your game's launch options

with that set, navigate a shell to /tmp/proton_<username> and you'll find several helpful scripts, like gdb_run, which will launch and attach the debugger to the game's process

for flatpak users, these scripts are in something like /home/<username>/.var/app/com.valvesoftware.Steam/.cache/tmp/proton_<username>

file descriptor gremlins, or, eventfd: Too many open files

as it turns out Proton uses ESYNC, a synchronization based on eventfd, which creates file descriptors, of which there is a maximum amount that can be created. normally you would think this is a Large Number™ but on my system this was only 4096, meaning rather quickly i would exhaust all descriptors and crash.

for further reading see README.esync

solution 1

upgrade to linux kernel 5.16 or greater, for FSYNC mode, which is based on futex2. Proton should automatically detect this and utilize it, and one can confirm this by checking proton logs for the line fsync: up and running.

see futex2.html for further reading

solution 2

raise your system's number of file descriptors. even if you use kernel 5.16 or greater, it's probably a good idea to raise this. systemd distros probably have a Large Number™ by default. other systems probably define this in /etc/security/limits.conf

add a line like * hard nofile 1048576

note that if you are running the flatpak version of steam, you may need to check the file descriptor limits within the container, though it should inherit the value of the host system