ReactiveDrop / reactivedrop_public_src

Alien Swarm: Reactive Drop game source code and issue tracker.
https://reactivedrop.com
124 stars 36 forks source link

Game folder server locking #624

Closed mithrand0 closed 11 months ago

mithrand0 commented 1 year ago

Some users (try) run multiple instances from the same game installation folder. This results in unreliable behavior, starting with workshop items not being downloaded, partially downloaded, or other interference.

We should lock the game folder with lock_exclusive at start, allowing only one instance at a time from it.

jhh8 commented 1 year ago

I disagree, there are more positives about allowing that. You dont need to install multiple copies of the game to run multiple servers (many saved gigabytes) its also possible to implement cross-server chatting with vscript. Issue with workshop is solvable if you run one server first and let it install everything, then launch the other servers

mithrand0 commented 1 year ago

You can disagree, but Steam SDK states the files are not to be touched:

https://partner.steamgames.com/doc/api/ISteamUGC:

Do not access the workshop item on disk until the Callback DownloadItemResult_t is called.

This has to do with file locking of Steam UGC content.

If want to support multiple instances, make it official. Right now it causes issues.

Issue with workshop is solvable if you run one server first and let it install everything, then launch the other servers

Sounds not very workable.. please share the script you use on your servers for this.

jhh8 commented 1 year ago

so what you're saying is when two instances are running, one tries to update and another one is accessing it, the addon files get corrupted, set to read only forever or something and server is not able to update them ever again, even if owner starts running only one instance like a normal server?

mithrand0 commented 1 year ago

yes, I have seen that case.

it is hard to reproduce, because of the exact timing, but when it happens, you need to throw away the workshop and steam ugc folders. That is why I decided to go separate folders in the past, solves a lot of issues.

mithrand0 commented 1 year ago

Sourcemod sort of has a similar issue when sharing it's data: https://wiki.alliedmods.net/Multiple_or_Forked_Servers_(SourceMod)

Seems Left 4 Dead 2 implemented a -fork <num> parameter to support multiple servers from the same game folder.

BenLubar commented 1 year ago

Might be able to just set each server instance to use a separate workshop folder

mithrand0 commented 1 year ago

Keep in mind, if the folder is shared, steamcmd can't be reliable used to update the game between server restarts. Also, if workshop has separate folders, the benefit of a shared install become smaller.

If space is the issue, better look into ways to remove textures and sounds from the server install, theoretically those shouldn't be needed on a server and I can imagine they might eat up a considerable amount of size.

mithrand0 commented 11 months ago

I wrote this small utility for dedicated server: https://github.com/mithrand0/srcds-guardian

With that, I think this makes the issue obsolete.