Nimdy / Dedicated_Valheim_Server_Script

Valheim Server Manager . Supports: ValheimPlus, Bepinex, Multi-world, Multi-Lang, Update, Backup, Restore and more: Built for Linux
GNU Affero General Public License v3.0
697 stars 120 forks source link

Question: How often is world backed up? #20

Closed FordMustang0288 closed 3 years ago

FordMustang0288 commented 3 years ago

Players on my server were noticing some instability (chests were not operable for instance) and so I shut it down and restarted it. In doing so, they estimated that they lost about 30 min of progress.

How often is the world backed up by default?

Thank you!

siamgo commented 3 years ago

I was just about to research how to back up, but it is doing it automatically? That would save some work, but then I am also very interested in hearing the answer to your question :)

And what amazing work with this script makes creation of a server so easy.

Nimdy commented 3 years ago

30 mins by default from the Valheim game code.

I am adding a manual/automatic backup function (really easy)

However, after reading tons and tons of reports from others (not script related, game related) tons of corrupted .db files. I am not sure what people are doing to their servers but mine has been up for 5-6 days now and we are on day 300+ in game, zero issues, zero corruption and we have 10 people on 24/7.

I really would like to see the logs before and after somebody has corrupted issues. I think a lot of these events are happening within the Windows environments and not so much in the Linux environments.

Here are some things I am guessing that are causing issues:

People adding them self as admins and building quickly with others connected (P2P connections/data transfer suck) ---Valheim used a flat file database.... so data coming from the connected peers needs to be repeated and leads to inputting errors and inconsistencies within the data.

People shutting down and starting services for no other reasons but to add/remove admins/whitelist/ban --- Again flat file DB... just drama.

Here is a possible solution to minimize corrupted data:

---Before shutting down services. Have everybody logout of the server and do a force save (how to force save...idk UPDATE: as admin you can do a manual save. Press F5 type save.)

---Decay rate needs to increase on items not picked up... too many artifacts laying around Pick up your Loot (Decay rate should happen 5 mins before Valheim server conducts a automatic save (if items are not within range a player made object--delete), this would be great.

---Two DB files should be created: One Master and one Shadow 1:1. Shadow file is the only file being checked for integrity, should shadow file fail integrity checks, conduct clean up and then apply to master. (Must be a better way to do this)

Just brainstorming here....


diegosps commented 3 years ago

If I'm running the local client with my server, I can f5 and type save to force save the game. If an admin do this with the dedicated server, will the world be saved?

Nimdy commented 3 years ago

I do not know... I have not done anything as admin.... I just dont trust the flatfile database yet.... I think this where stuff get jacked up.

My server is currently 5-6 days running.... day 380+ and I have 10 people on 24/7. Never had any issues. Mainly because I do not poke around on production servers. I will later spin up a dev box... and break it for science

FordMustang0288 commented 3 years ago

I would be curious what the F5->"save" option does with a dedicated server. If you think you will be experimenting later, I think I will wait to hear your results on this @Nimdy. I do think if that command works, this would ideally be what we want to do before shutting it down.

I ran your script and started the server. We have 6-8 players at a time. I did NOT muck around with any of the admin stuff...that all remains as default. Again, we noticed issues with chests unusable, etc. I did STOP the server and then rebooted the VM. Those who were building something noticed that the construction was not up to date. For me, I was not building but I noticed a commonly open door was now closed.

It is likely that when I restarted the server last night, I might have been between two save cycles and thus lost a little bit of progression. The force save option would be key here.

1) You may have mentioned it before, but where is the log file that you would be interested in?

2) Is there a way to see WHEN/IF the server has saved (assuming it is in the log file)?

Pendora2017 commented 3 years ago

@Nimdy i'm not too deep into this flat file format but with all this disadvantages that you mentioned ... does valheim have a future with that? From my understanding this structure/this base setup is a total disaster.

Did you found some statements or background infos from the developer to this? Maybe there is a good reason after all?

Pendora2017 commented 3 years ago

And to answer the initial question how often the world ist saved: Today with release v0.145.6 the server saves the data every 20 mins by default

diegosps commented 3 years ago

Also from the patch notes:

I tried the save command and it returned a message saying it was saving. But I didn't restart the server to test it.

devdavi commented 3 years ago
  1. Is there a way to see WHEN/IF the server has saved (assuming it is in the log file)?

systemctl status valheimserver.service will display the server information. 2 of the lines near the bottom will show a timestamp with Saved and World Saved -- on different lines. ctrl+z to close that screen.