By thomp22
Hi,
I’m using a server to facilitate online multiplayer in my PC game. The server is a small application written in Java. The problem is that the server keeps going down occasionally and restarts itself automatically after about 15 minutes. I have upgraded the server a couple of times but it didn’t seem to make any difference, first I used an 1 GB 1 vCPU 20 GB standard droplet, after that an 8 GB 4 vCPUs 160 GB standard droplet and finally I tried a CPU Optimized Droplet with 4 GB 2 vCPUs 20 GB. I’m not completely sure but it seemed that the server went down when there were about 15 people online, but at times there are the same amount of people online (or more) and no crash occurs. It crashes about 1-2 times a day when most people are online (but I’m not 100% sure).
Graphs: -1 minute after server crashed (7:29 pm) : https://imgur.com/a/Asit3O6 -Server down for 12 minutes (7:41 pm): https://imgur.com/a/ulIgTau -Server back online (7:50 pm): https://imgur.com/a/gMOn4Jf -Server back online for 28 minutes (8:18 pm): https://imgur.com/a/lA8dufN
Console: -After server crashed (7:39 Pm): https://imgur.com/a/h7r701H it shows: java.net.SocketException: Connection reset
-After the server is back online (7:50 pm): https://imgur.com/a/l85FYFw
The only thing I recognize is the ClientThread.java file which is one of the 3 java files that comprises the server. I must also say that my experience with Java is very basic and that someone else made the java server files (who is not available), but I understand most part of it and made some small adjustments myself.
Any reason why this server keeps crashing occasionally?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
It sounds like that the server might be running out of memory.
What I could suggest in such cases is to open a second terminal and run htop or top and keep an eye on the server resources utilization.
That way you will be able to tell what might be happening.
You can also check your system logs at /var/log and see if there are any out-of-memory errors in there.
If this is the case, what you could do is add some extra RAM to the server or add a swap file so that you could have some extra buffer:
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.