r/admincraft 1d ago

Help/Question Server Closes when screen isn't connected on Windows/Teamviewer

I have a server from an old PC that I really just put in a corner and remote into with Teamviewer, but at some point it just started closing my minecraft server when Teamviewer disconnects. It doesn't turn off the PC, I can remote back in and still see the folder left open, but the server process itself just shuts down. The logs show just a hard cut-off like it was forcefully stopped. I suspect it's related to not having any other monitor connected to it so it could be some kind of sleep mode or newish inactivity detection coming from windows. I've been meaning to set up a dual boot linux OS on it at some point anyways but in the meantime (windows has been giving me a ton of headaches, but I don't have a spare hard drive to backup everything which is a whole other issue) does anyone know if there is a way to prevent this?

5 Upvotes

14 comments sorted by

1

u/Simulacra-01 Server Owner 1d ago

I had this issue and it turned out to be something to do with how Java interacts with the display driver.

I’m currently at work and cannot remember the switch I added to my .bat file but as soon as I get home I’ll post what fixed this for me.

2

u/ChronoSpidey 1d ago

this would be lifesaving thank you

1

u/Simulacra-01 Server Owner 1d ago

Ok, so I added the following to the main java -Xms6G -Xmx6G -jar paper 26.2-xxx.jar —nogui line of my main .bat file:

-Dsun.java2d.d3d=false

The result was:

java -Dsun.java2d.d3d=false -Xms6G -Xmx6G -jar paper 26.2-xxx.jar —nogui

This basically prevents an EXCEPTION_ACCESS_VIOLATION in awt.dll when disconnecting from an RDP session.

Hope it helps

1

u/ChronoSpidey 1d ago

hmm the arg doesn't seem to be doing it, but I did find logs (weirdly seperated from the logs folder) that seem like exactly what you've described. not sure if I've added them with the weird forge args.txt format wrong or because I'm on the semi unique gtnh Minecraft/java configuration of 1.7 but works with java 17-25.

1

u/Simulacra-01 Server Owner 1d ago

Yeah mine was the same and generated a .txt file in the root of the servers directory.

1

u/Dragontech97 1d ago

Is it “nogui”?

1

u/Simulacra-01 Server Owner 1d ago

No it was something to do with how Java interacts with the display driver when switching to the RDP session.

1

u/Dragontech97 1d ago

Ah so specifically a Windows thing?

1

u/Simulacra-01 Server Owner 1d ago

Yeah I think so, also the only info I could find relating to the issue was to do with onboard graphics too.

1

u/BumseBBine 1d ago

Check energy settings and disable everything you see.

If you use the "unattended" version of teamviewer there is a big possibility that you get logged out of windows if you disconnect teamviewer.

Use a second monitor to see what happens when you disconnect

I'd really recommend debian (or any other server distro) for stuff like this.

1

u/ChronoSpidey 1d ago

I could definitely see the getting logged out happening, I did try setting the "automatically lock" setting to "never" but it still gets closed on disconnect, just doesn't make me type in my password again. Whatever it is I know didn't always happen because I've had periods of no problems, I'll definitely look into debian though windows has been a huge pain.

1

u/Fuskeduske 1d ago

You gotta run it headless ( non display dependant )

1

u/ChronoSpidey 1d ago

I do plan on moving closer to that when I have the time/effort to put in but I think I'll always prefer to have a remote view, gui's are just easier for me to work with. Eventually I wanna get a web-accessible panel for some friends to be able to vpn or just connect to with a password though.

1

u/kefka_nl Server Owner 1d ago

No solution here, just throwing in my own problem for amusement.
I connect to a windows server through rdp.
Works fine except from one pc, if this specific pc goes into sleep mode, the server closes the worlds running. Solution? Just don’t let this rdp session active when connecting from this one specific pc.