craftaro / ServerJars-Updater

35 stars 12 forks source link

DOUBLE RAM Consumption #23

Open TheCiROMG opened 2 years ago

TheCiROMG commented 2 years ago

Hello, I come to warn you that ServerJars, when assigning 8gbs, consumes 16gb

How does it happen?

Create your server in a normal and conventional way, using this java: https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot

Open it using server jars, and check task manager...

After a while, you will see that the consumption of your server is double, why? will you say

It happens that ServerJars continues to run in the background and consumes the 8gb next to the minecraft server (8gb each), something that did not happen before

I had to remove server jars so that the consumption goes down

I need you to review your code slowly and safely, since this is bad for users who host at home or on their conventional computer, and this error can even generate blue screens, just to warn them

SpraxDev commented 2 years ago

I can't believe that ServerJars is consuming the same amount of RAM as the Minecraft server it is running. Maybe it's just a misunderstanding on how RAM usage is calculated. As ServerJars is starting the Minecraft server in its own process that is still attached to it, the consumption of the Minecraft server might be summed up and added to ServerJars.

(+ Blue Screens are pretty unlikely on a somewhat modern system - Especially if high memory usage should be to blame)


Nonetheless I've prepared a dev build which works around this by making the JVM args configurable in the config instead of inheriting them from ServerJars. This allows ServerJars memory to be limited to 128M.

Could you please try the attached jar with something like java -Xmx=128M -jar ServerJars.jar? The config file should be updated automatically with the new option (or you delete the current config and let the guided setup help you).

ServerJars-4.0.0-DEV.zip

TheCiROMG commented 2 years ago

image

okay i love it

I don't know how they did it but if it works, before it consumed twice as much ram since the parameters were for the 2 jars, couldn't they make it close once serverJars does its job?

It's a question, right now it's perfect with java 17 the dev version that you gave me

128m for server jars and 4gb for minecraft server

SpraxDev commented 2 years ago

couldn't they make it close once serverJars does its job? I'd love to but that is not possible in plain Java. If ServerJars exists itself, the JVM will stop all the processes it started, which will stop the Minecraft server too sadly.

The ServerJars client would need to be written in another language instead for that which is not planned as far as I know.

Thanks for testing!

MWHunter commented 2 years ago

"fixed" for me by removing the -Xms flag from startup parameters