mojira.dev

Gregor Kuhlmann

Assigned

No issues.

Reported

MC-43395 MP: Severe lag and memory leak when a lot of new chunks are generated Invalid

Comments

After we finally found what we were looking for (a Mesa biome) and stopped exploring 1000s of blocks away from our spawn point, the issue does no longer appear. CPU usage when noone is logged in is around 1-2%, though memory usage is still quite high (1.3 GB) which I still believe indicates some kind of memory leak, since it is from a server with no addons or mods and no sophisticated redstone circuitry.

Here are the last few lines from JVM garbage collector log (with -Xincgc setting)

235692,578: [GC 1200181K->1184208K(1331864K), 0,0325270 secs]
235736,077: [GC 1201040K->1185217K(1331864K), 0,0351430 secs]
235740,629: [GC 1202049K->1185927K(1331864K), 0,0242170 secs]
235783,021: [GC 1202759K->1186477K(1331864K), 0,0561370 secs]
235826,078: [GC 1203309K->1188448K(1331864K), 0,0427910 secs]
235831,481: [GC 1205280K->1188646K(1331864K), 0,0157140 secs]
235873,467: [GC 1205478K->1188905K(1331864K), 0,0364540 secs]
235916,152: [GC 1205737K->1191903K(1331864K), 0,0547870 secs]
235922,108: [GC 1208735K->1192606K(1331864K), 0,0254940 secs]
235963,927: [GC 1209438K->1192779K(1331864K), 0,0243430 secs]
236006,566: [GC 1209611K->1195392K(1331864K), 0,0517560 secs]

I never experienced the effect described in MC-42088 much even during periods of extreme lag though.

FYI the E5200 is running at 2.5 GHz not 1.6GHz.

Unless my understanding of the way Minecraft works is fundamentally wrong, only the chunks in the global spawn area and the chunks around the view-distance of the logged in player(s) should be kept in memory, so if the number of players is constant memory usage should remain more or less constant while playing.

What I am experiencing however is that JVM memory usage rises monotonously while moving through unexplored areas, and remains high even after the last player has logged out. My expectation was that memory usage should drop as unneeded chunks are unloaded from memory, but this does not seem to happen.

As I said in my original post, the same hardware can easily handle another server instance with up to 5 players online simultaneously without any noticeable lag or excessive CPU load and memory load, so I believe we can safely reject the idea that this is merely related to lack of processor power.

The server is running on a E5200 Pentium Dual-Core w/ 4GB RAM. Not exactly high-end by today's standards, but it should well be able to handle a single vanilla server instance with at most 2 players online simultaneously.
I assigned 2 GB of JVM heap space to this instance after encountering frequent OutOfMemory exceptions. The command line I use is

java -server -Xmx2G -Xincgc -jar minecraft_server.jar nogui

server.properties

generator-settings=
op-permission-level=4
allow-nether=true
level-name=world
enable-query=false
allow-flight=false
announce-player-achievements=true
server-port=25577
level-type=DEFAULT
enable-rcon=false
force-gamemode=false
level-seed=
server-ip=192.168.1.43
spawn-mobs=true
max-build-height=256
spawn-npcs=true
white-list=false
spawn-animals=true
texture-pack=
snooper-enabled=false
hardcore=false
online-mode=true
resource-pack=
pvp=false
difficulty=2
enable-command-block=false
gamemode=0
player-idle-timeout=0
max-players=8
spawn-monsters=true
generate-structures=true
view-distance=9
spawn-protection=16
motd=Vanilla Server