Wesley1808 / ServerCore

A mod that aims to optimize the minecraft server.
75 stars 11 forks source link

servercore.toml reset to default on restart, and settings aren't applied #94

Closed herebecush closed 6 months ago

herebecush commented 6 months ago

Describe the bug We're setting up a new MC server and having tested a lot of the ServerCore settings they don't seem to take effect. Additionally, the servercore.toml file is reset to default on restarting either the server itself or the MC server. We've tested this both with and without using /servercore config reload before shutting down

Update: What's interesting is that if we set animal_activation_range that does seem to take effect live, but we can't then save that value (and of course it's overridden on restart)

Reproduce Option 1:

  1. Make changes in servercore.toml while MC server running (none made inside MC)
  2. Run /servercore config reload in MC
  3. Changes do not apply
  4. Run /stop in MC
  5. Restart the service running MC
  6. servercore.toml was overritten with the default file

Option 2: (expected to fail, I think?)

  1. Make changes in MC directly
  2. Run /servercore config reload in MC
  3. Restart the service running MC
  4. servercore.toml was overwritten with the default file

Expected behavior A clear description of what you expected to happen. When changes are made, they should apply to the MC world after using /servercore config reload, ideally in both directions on whichever is the newer value, since one of us MC server admins is a techy - me - and the other is not, so while I would always change settings inside the .toml file, the other admin will do it solely inside MC. We have made sure we're saving changes at different times so there's no conflict.

Versions -Latest is not a version! ServerCore: servercore-fabric-1.4.0-1.20.3.jar Minecraft: 1.20.4

Mod incompatibilities List any installed mods you think might play a role in causing this bug. N/A

Wesley1808 commented 6 months ago

For option 1, what are the changes you're making to the file (exactly)? Could you provide the toml file of the modified version before it resets?

And yes, option 2 is supposed to fail. If you want to save ingame changes immediately to the config file you should use /servercore config save (or it should do so when the server shuts down).

Logs might also help to determine the issue. Servercore for example logs when it fails to load config entries and has to reset them to default.

herebecush commented 6 months ago

Thanks for the quick resposne!

Here is a diff of the changes we made: https://www.diffchecker.com/jiPPxu1f/

Left side shows the default settings (the one which overrides our settings on every startup) and the right side shows our desired settings

Edit: If I want to provide log files for ServerCore, where would I find these?

Wesley1808 commented 6 months ago

The config looks alright, so I doubt its that. Regarding the log files I'm just referring to the usual console log (logs folder).

If that doesnt show any errors I'm not sure what could cause this, unless the other admin changes values ingame but never saves (/sc config save) them and you happen to edit the config file during that same server session (session referring to server start until server shutdown), as that would cause it to overwrite the config file with ingame changes during shutdown. But that doesn't really make sense either, because I think settings were applying correctly ingame? Just that it always fails to load the config at startup?

herebecush commented 6 months ago

As outlined above we made sure not to do that for that exact reason. Also the minecraft folder (and all children) is set to its own user + group ownership, so nothing is owned by root on the server or anything like that. We'll do some testing with and without other mods and I'll come back to you - if you could leave this issue open in the meantime

herebecush commented 6 months ago
image

So having checked the server logs on startup, I think we found the issue... see above, it was just a config error. Boy do I feel stupid 😂

Wesley1808 commented 6 months ago

Well yeah, that'd certainly do the trick. I also somehow managed to overlook it in the diff checker so you're not the only one that missed it :P

herebecush commented 6 months ago

Ok so the above fixed the config file reloading defaults on each startup, which makes a whole lot of sense now.

However, there's still the issue of settings not taking effect. For example, we set view-distance: -1 in server.properties to avoid the default being written. We loaded in and ran /servercore status, it of course shows 'View Distance: -1'.

However, we then did the following: /servercore config dynamic max_view_distance 32 /servercore config save /servercore config reload /reload

Nothing had changed when we then ran /servercore status

Whenever we use /sc settings it works changing values, but doesn't write the file. When we use /sc config it changes the file but doesn't apply to the game. Even after a save.

Thoughts?

herebecush commented 6 months ago

@Wesley1808 Just tagging you after the comment above since I notice this got closed but isn't resolved completely

Wesley1808 commented 6 months ago

I'm not sure what's wrong here? What are you expecting it to do?

/sc settings don't write to file because they are purely temporary values within the context of the dynamic performance config.

The values in /sc config only determine the maximum and minimum values that the dynamic system can set them to. Not the "current" value. It will only start trying to change the viewdistance if all prior 'settings' (depending on the order in the config) have already been set to their minimum and the MSPT is still too high.

herebecush commented 6 months ago

Ahhhhhhh that makes much more sense, thank you for this info. We were under the impression that this was supposed to set settings at the time, but it's good to know this is how it actually works!

Nevermind then, we'll keep this in place to help our dynamic performance but it seems the mod is working as intended and we were just misunderstanding the scope.

Thanks for all your help and your quick responses!