Valheim server wakes from sleep immediately after going to sleep

OS Name/Version: debian 12.0.0

Product Name/Version: AMP Release “Decadeus” v2.4.5.4

Problem Description:
Hey there,
I have set up a Valheim server on my system and it all works for the most part. However, the sleep function does not seem to work properly. Whenever the server is scheduled to go to sleep, it does, but immediately starts back up. There is no time in-between. As soon as the server finished going to sleep, it immediately wakes up. Not sure what the issue is. It’s set to go to sleep after 3 minutes right now, but I have tried different intervals and they don’t change anything about the behavior. Setting it to sleep manually does the same thing. It instantly wakes back up. In the console output, the only thing of note I can find is the following, though I’m not even sure if it is related. Obviously, the line with the ERROR is highlighted red, but I have no idea what it means.

Znet OnDestroy
Net scene destroyed
ERROR: object '' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Steps to reproduce:

  • start Valheimserver
  • set to sleep from the console button/ wait for auto sleep etc.
  • wakes from sleep immediately

Actions taken to resolve so far:
I tried restarting the instance, the server application, AMP, the machine it’s running on.
I have enabled and disabled and changed the values of different sleep settings: “enable sleep mode”, “sleep on start”, Sleep mode delay", “Doze delay”, “start on boot” for the instance itself etc. Nothing I have done seemed to fix it. I also took my server private (turned off public in the settings) thinking maybe someone was auto-pinging me or something. I am not using Valheim plus btw, just vanilla everything.

I would love to know how I can fix this, I would rather not have the server fully on when most of the time it’s not needed.

After a bunch more testing I narrowed it down a bit. I did a fresh OS install and installed AMP from scratch. I tried running it on a different Vm too. I have the same issue there as well. However, I can replicate it now and it seems to correspond to the portforwarding being turned on for some reason. I have ports 2456-2458 open on my router and direct them toward the server using UDP. Everything works as intended. Players can join from outside the LAN, the server shows up on Valheim’s server list etc. However, sleep does not work as I would expect. The server wakes immediately after going to sleep. If I disable port forwarding to this server, sleep works again. Naturally, it is no longer accessible from outside the LAN. Weirdly, keeping portforwarding on and disabling the public setting for the server in AMP does not prevent this issue. Maybe that helps narrow it down for you, I don’t really know. Given that not forwarding ports to the server fixes the issue though, it might also just be a bug with the valheim server? I really don’t know.

Essentially this:
PF ON & Public → wakes
PF ON & No Public → wakes
PF OFF & Public → Sleeps
PF OFF & No Public → Sleeps

My firewall rules look like this:

realuser@debianAMP:~$ sudo su -1
[sudo] password for realuser:
root@debianAMP:~# ampinstmgr dumpfirewall
[Info] AMP Instance Manager v2.4.5.4 built 26/06/2023 18:20
[Info] Stream: Mainline / Release built by CUBECODERS/buildbot on CCL-DEV
[Info] Using UFW firewall.
[Info] TCP/2223 (AMP: ADS01: FileManagerPlugin.SFTP.SFTPPortNumber)
[Info] TCP/2224 (AMP: Valheim01: FileManagerPlugin. SFTP.SFTPPortNumber)
[Info] TCP/2456 (AMP: Valheim01: Generic Module. App. Application Port1)
[Info] UDP/2456 (AMP: Valheim01: Generic Module. App. ApplicationPort1)
[Info] TCP/2457 (AMP: Valheim01: Generic Module. App. ApplicationPort2)
[Info] UDP/2457 (AMP: Valheim01: Generic Module. App. ApplicationPort2)
[Info] TCP/2223 (AMP: ADS01: FileManagerPlugin. SFTP.SFTPPortNumber)
[Info] TCP/2224 (AMP: Valheim@1: FileManagerPlugin. SFTP.SFTPPortNumber)
[Info] TCP/2456 (AMP: Valheim01: Generic Module. App. ApplicationPort1)
[Info] UDP/2456 (AMP: Valheim01: Generic Module. App. Application Port1)
[Info] TCP/2457 (AMP: Valheim01: Generic Module. App. ApplicationPort2)
[Info] UDP/2457 (AMP: Valheim01: Generic Module. App. ApplicationPort2)
root@debianAMP:~# |

Not sure why the output looks this weird or if it is related to the problem, checking ufw directly gives me this:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.