8GB内存VPS上Minecraft 1.19.4服务器每日崩溃排查求助(含资源分配及Watchdog错误日志)
8GB内存VPS上Minecraft 1.19.4服务器每日崩溃排查求助(含资源分配及Watchdog错误日志)
大家好,我租了一台8GB内存的VPS用来给朋友搭建Minecraft 1.19.4服务器,但服务器每天都会崩溃一次。搭建的时候我参考了Linux搭建MC服务器的教程,现在排查崩溃报告发现是资源分配出了问题,甚至连执行java -version都会弹出类似的错误,实在找不到解决办法,来求助大家!
Java版本查询报错信息
执行java -version时出现以下错误:
[0.002s][warning][os,thread] Failed to start thread "GC Thread#0" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 4k, detached. # # There is insufficient memory for the Java Runtime Environment to continue. # Cannot create worker GC thread. Out of system resources.
系统资源使用情况(top命令输出)
我查了剩余内存,看起来是足够的,以下是top命令的输出:
top - 16:57:33 up 21:02, 2 users, load average: 0,48, 0,29, 0,30 Tasks: 27 total, 1 running, 26 sleeping, 0 stopped, 0 zombie %Cpu(s): 5,3 us, 0,5 sy, 0,0 ni, 94,2 id, 0,0 wa, 0,0 hi, 0,0 si, 0,0 st MiB Mem : 8192,0 total, 4797,7 free, 3144,7 used, 249,6 buff/cache MiB Swap: 0,0 total, 0,0 free, 0,0 used. 5047,1 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 7875 root 20 0 6957728 3,0g 30496 S 21,3 37,9 18:44.59 java 1 root 20 0 165440 9440 6784 S 0,0 0,1 0:02.08 systemd 2 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kthreadd/300570 3 root 20 0 0 0 0 S 0,0 0,0 0:00.00 khelper 62 root 20 0 47660 17000 16000 S 0,0 0,2 0:07.26 systemd-journal 132 root 20 0 21416 4568 3608 S 0,0 0,1 0:00.11 systemd-udevd 175 root 20 0 6876 2636 2384 S 0,0 0,0 0:00.09 cron 176 message+ 20 0 8208 3412 2840 S 0,0 0,0 0:00.05 dbus-daemon 182 syslog 20 0 152404 3844 3360 S 0,0 0,0 0:01.15 rsyslogd 185 root 20 0 14888 4828 4016 S 0,0 0,1 0:00.14 systemd-logind 237 systemd+ 20 0 16104 4832 3944 S 0,0 0,1 0:00.73 systemd-network 302 root 20 0 15408 9340 7700 S 0,0 0,1 0:02.16 sshd 309 root 20 0 5780 716 624 S 0,0 0,0 0:00.00 agetty 310 root 20 0 2800 1056 968 S 0,0 0,0 0:00.00 agetty 353 root 20 0 20520 4308 1964 S 0,0 0,1 0:01.61 sendmail-mta 355 root 20 0 9668 2384 2048 S 0,0 0,0 0:00.00 xinetd 407 systemd+ 20 0 25252 11928 7888 S 0,0 0,1 0:00.44 systemd-resolve 522 root 20 0 7296 2656 1980 S 0,0 0,0 0:00.01 screen 523 root 20 0 7616 3860 3228 S 0,0 0,0 0:00.00 bash 7843 root 20 0 16156 10168 8104 S 0,0 0,1 0:00.18 sshd 7854 root 20 0 7720 4392 3748 S 0,0 0,1 0:00.02 bash 7873 root 20 0 10236 4892 4368 S 0,0 0,1 0:00.00 sudo 7874 root 20 0 10236 572 0 S 0,0 0,0 0:00.00 sudo 8480 root 20 0 15408 8700 7152 S 0,0 0,1 0:00.00 sshd 8483 root 20 0 15408 8948 7400 S 0,0 0,1 0:00.00 sshd 8484 root 20 0 10296 3780 3188 R 0,0 0,0 0:00.02 top 8485 root 20 0 15408 8920 7368 S 0,0 0,1 0:00.00 sshd
Minecraft服务器崩溃日志
LOG 1(2023-03-24)
这次崩溃提示无法创建本地线程,错误信息如下:
---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 2023-03-24 01:43:45 Description: Exception in server tick loop java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached at java.base/java.lang.Thread.start0(Native Method) at java.base/java.lang.Thread.start(Thread.java:802) at java.base/java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:945) at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1364) at bcr.i(SourceFile:131) at bcr.a(SourceFile:124) at bcq.c(SourceFile:31) at deq.a(SourceFile:234) at deq.a(SourceFile:172) at dep.a(SourceFile:116) at dfs.a(SourceFile:300) at dfs.f(SourceFile:381) at it.unimi.dsi.fastutil.longs.LongOpenHashSet.forEach(LongOpenHashSet.java:756) at dfs.b(SourceFile:375) at aip.a(SourceFile:777) at net.minecraft.server.MinecraftServer.a(SourceFile:540) at net.minecraft.server.MinecraftServer.b(SourceFile:564) at net.minecraft.server.MinecraftServer.a(SourceFile:838) at net.minecraft.server.MinecraftServer.w(SourceFile:675) at net.minecraft.server.MinecraftServer.a(SourceFile:266) at java.base/java.lang.Thread.run(Thread.java:833) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.19.4 Minecraft Version ID: 1.19.4 Operating System: Linux (amd64) version 5.2.0 Java Version: 17.0.6, Private Build Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Private Build Memory: 1995933808 bytes (1903 MiB) / 2524971008 bytes (2408 MiB) up to 6442450944 bytes (6144 MiB) CPUs: 4 Processor Vendor: AuthenticAMD Processor Name: AMD EPYC 7452 32-Core Processor Identifier: AuthenticAMD Family 23 Model 49 Stepping 0 Microarchitecture: Zen 2 Frequency (GHz): -0.00 Number of physical packages: 1 Number of physical CPUs: 1 Number of logical CPUs: 1 Graphics card #0 name: unknown Graphics card #0 vendor: unknown Graphics card #0 VRAM (MB): 0.00 Graphics card #0 deviceId: unknown Graphics card #0 versionInfo: unknown Virtual memory max (MB): 0.00 Virtual memory used (MB): 2966.25 Swap memory total (MB): 0.00 Swap memory used (MB): 0.00 JVM Flags: 2 total; -Xms2G -Xmx6G Server Running: true Player Count: 0 / 20; [] Data Packs: vanilla Enabled Feature Flags: minecraft:vanilla World Generation: Stable Is Modded: Probably not. Server jar signature and brand is untouched Type: Dedicated Server (map_server.txt)
LOG 2(2023-03-25)
这次崩溃是Watchdog错误,服务器线程出现阻塞,完整日志如下:
---- Minecraft Crash Report ---- // Sorry :( Time: 2023-03-25 17:38:57 Description: Watching Server java.lang.Error: Watchdog at java.base@17.0.6/jdk.internal.misc.Unsafe.park(Native Method) at java.base@17.0.6/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) at bco.bs(SourceFile:151) at bco.c(SourceFile:141) at ain.a(SourceFile:140) at cmi.a(SourceFile:206) at cml.a(SourceFile:161) at cmi.d(SourceFile:200) at cmi.l(SourceFile:195) at cmi.b_(SourceFile:387) at bfh.o(SourceFile:1287) at bfh.ao(SourceFile:499) at bfx.ao(SourceFile:348) at bfh.l(SourceFile:469) at bfx.l(SourceFile:2361) at bym.l(SourceFile:282) at aiq.m(SourceFile:509) at aji.c(SourceFile:268) at sq.a(SourceFile:254) at ajh.c(SourceFile:172) at net.minecraft.server.MinecraftServer.b(SourceFile:912) at ahq.b(SourceFile:283) at net.minecraft.server.MinecraftServer.a(SourceFile:828) at net.minecraft.server.MinecraftServer.w(SourceFile:675) at net.minecraft.server.MinecraftServer.a(SourceFile:266) at net.minecraft.server.MinecraftServer$$Lambda$4485/0x00000008014a9d58.run(Unknown Source) at java.base@17.0.6/java.lang.Thread.run(Thread.java:833) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server Watchdog Stacktrace: at java.base@17.0.6/jdk.internal.misc.Unsafe.park(Native Method) at java.base@17.0.6/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) at bco.bs(SourceFile:151) at bco.c(SourceFile:141) at ain.a(SourceFile:140) at cmi.a(SourceFile:206) at cml.a(SourceFile:161) at cmi.d(SourceFile:200) at cmi.l(SourceFile:195) at cmi.b_(SourceFile:387) at bfh.o(SourceFile:1287) at bfh.ao(SourceFile:499) at bfx.ao(SourceFile:348) at bfh.l(SourceFile:469) at bfx.l(SourceFile:2361) at bym.l(SourceFile:282) at aiq.m(SourceFile:509) at aji.c(SourceFile:268) at sq.a(SourceFile:254) at ajh.c(SourceFile:172) at net.minecraft.server.MinecraftServer.b(SourceFile:912) at ahq.b(SourceFile:283) at net.minecraft.server.MinecraftServer.a(SourceFile:828) at net.minecraft.server.MinecraftServer.w(SourceFile:675) at net.minecraft.server.MinecraftServer.a(SourceFile:266) -- Thread Dump -- Details: Threads: "Reference Handler" daemon prio=10 Id=2 RUNNABLE at java.base@17.0.6/java.lang.ref.Reference.waitForReferencePendingList(Native Method) at java.base@17.0.6/java.lang.ref.Reference.processPendingReferences(Reference.java:253) at java.base@17.0.6/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:215) "Finalizer" daemon prio=8 Id=3 WAITING on java.lang.ref.ReferenceQueue$Lock@28c78967 at java.base@17.0.6/java.lang.Object.wait(Native Method) - waiting on java.lang.ref.ReferenceQueue$Lock@28c78967 at java.base@17.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155) at java.base@17.0.6/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176) at java.base@17.0.6/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:172) "Signal Dispatcher" daemon prio=9 Id=4 RUNNABLE "Notification Thread" daemon prio=9 Id=11 RUNNABLE "Common-Cleaner" daemon prio=8 Id=12 TIMED_WAITING on java.lang.ref.ReferenceQueue$Lock@5ea69bed at




