AMP Does Not Shutdown The Valheim Server Properly

  • 633 Views
  • Last Post 09 March 2021
pdxampuser posted this 14 February 2021

Os Version: Windows 10 PRO (build 19041.746)

Cube Coders Product: Amp 2.1.0.6

Module Used: Generic Module (Valheim)

Issue: After restarting the the Valheim server via AMP's "Status" page, game items stored on the server are missing.

Steps to Reproduce:
1. Start the Valheim server via AMP
2. Log your character into the server
3. Transfer an item from your character's inventory to a storage chest
4. Restart the server via AMP (either with "restart" or "stop" and "start" from AMP's "Status" page)
5. Log your character back into the server
6. Expected: The item you transferred from your character is still in the chest
7. Actual: The item you transferred from your character is missing from the chest

It suspect that AMP does not stop or restart the server properly. I have tried the steps to repro using the official way to run a dedicated server and shut down from Iron Gate Studios and I do not get this behavior (see below). I know this is not an official module yet, so I think we can expect some bugs and missing features. I just thought I would bring this to your attention in case you didn't know this was happening.

From Iron Gate's Velheim Dedicated Server Manual:
Stopping the Dedicated Server:
1. When you wish to stop running the server, it is important that you close it by pressing CTRL+C in the Command-window. If you close it by clicking the X in the window frame the Server may keep running in the background, we don’t really know!

Steps Tried to Resolve: None at this time

Order By: Standard | Newest | Votes
Cap980 posted this 16 February 2021

Yeah my users noticed this first restart as well after I moved our world over to AMP. For now I just use a webhook to post to a channel in my discord letting them know the reboot is 30 minutes out. They just log off for that period and wait for the reboot since the save interval is 30 minutes.

Hopefully Iron Gate will allow editing of the save interval at some point. 30 minutes is quite a long time. If it were a 5 minute loss of progress it wouldn't be that big of a deal, to us at least.

Mike posted this 16 February 2021

2108 has a tweak for this. But it only applies to newly created Valheim instances.

FantomByte posted this 16 February 2021

I'm on 2108 and can confirm with a new Valheim instance I'm still getting errors when stopping or restarting the server. after the error it just gives me the Kill option which doesn't allow the game to save.

Cap980 posted this 17 February 2021

I can confirm the behavior FantomByte described as well. I upgraded and created a fresh instance and both scheduled restarts thus far have hung and I had to kill them and manually restart the server.

Cap980 posted this 18 February 2021

Just wanted to update to provide more info on the issue. It seems that the server isn't actually hanging on shutdown, its just the status page that is showing it as shutting down. I checked the console while it was appearing to be "locked up" and the server was still running per the console. So it is just not starting the shutdown process from what I can tell.

Mike posted this 19 February 2021

Just took a check at this - it was a windows specific issue that meant AMP wasn't invoking taskkill properly (to request a safe shutdown) and it timed out after 30 seconds so it killed it. Next update will have a fix for this.

pdxampuser posted this 24 February 2021

Hey Mike,

Again, thanks for the quick replies and development as usual!

However, even after installing a fresh Valheim instance using the new 2.1.0.10 release, I still see the server is not shutting down properly and my steps to reproduce in my original post still fail. I still lose items on the server if you immediately shut down.

Anyone else seeing this still, or is it just me? ;-)

Thanks!

FantomByte posted this 25 February 2021

I finally got around to updating to 2.1.0.10 and it appears to be working. It's able to stop and restart without issues. I'll test out later today if it's saving the game when it stops.

pdxampuser posted this 09 March 2021

Hmm.. I just installed 2.1.0.12 thinking that might fix things, it didn't. In fact, the "Stop" button doesn't stop the server anymore and I have to use the "Kill" button instead. It also appears that the server side saving (see steps to repro above) is still not working after immediate shutdown (well... in my case kill).

Is anyone else experiencing these issues with the latest release?

Mike posted this 09 March 2021

Okay so the sum of it all:

  • A vanilla Valheim server shuts down properly so long as you're using an up-to-date Valheim template in AMP. Instances configured before 2.1.0.8 do not have this template and need reconfiguring.
  • Valheim Plus servers do not shut down properly regardless of the template using and in fact regardless of whether or not you're using AMP. Sending them the same SIGINT signal to the process does not cause it to cleanly exit.

I suspect the method they are using to mod a server without a proper modding system is causing it not to respond to signals properly.

If you're using Vanilla Valheim an older version of the template (or suspect you may be doing so) you can look at https://github.com/CubeCoders/AMPTemplates/blob/main/valheim.kvp which has the latest configuration, you'd want to replace all the lines except the ports and App.CommandLineVars as that contains your settings.

If you're using Valheim Plus I'd suggest raising a bug with the developers saying that it doesn't respond properly to requests to being shut down cleanly.

pdxampuser posted this 09 March 2021

Hey Mike,

Thanks again for the quick reply.

When I wrote my comment about using 2.1.0.12 I should have stated that I also installed a fresh instance of vanilla Valheim which should have picked up the new template. I doubled checked the github template against what I have in "\Instances\Valheim\Plugins\ADSModule\GenericTemplates" and it's the same.

If there's something else I can look at let me know.

Thanks!

Close