Skip to content

SimpleRPC prevents JVM shutdown — non-daemon scheduled executor and RPC I/O thread left running after game close #20

Description

@johalun

Environment
SimpleRPC: 4.1.3
CraterLib: 3.1.2
Minecraft: 26.2 (NeoForge)
Java: OpenJDK 25.0.1+8-LTS
OS: macOS 26.5 (Apple Silicon / ARM64)
Launcher: Prism Launcher

Summary
After quitting to desktop, the game window closes and Minecraft's main thread returns, but the java process hangs indefinitely instead of exiting. It has to be force-killed.

Diagnosis
A thread dump taken during the hang shows DestroyJavaVM is RUNNABLE (the JVM is trying to exit) but is blocked by threads that never terminated. The relevant SimpleRPC threads:

Thread-17 — parked in com.hypherionmc.simplerpc.rpcsdk.DiscordRpc.discordRpcIo(DiscordRpc.java:377), spawned from DiscordRpc.lambda$init$2(DiscordRpc.java:195)
A 16-thread ScheduledThreadPoolExecutor (pool-22-thread-1 … pool-22-thread-16) that is not marked daemon, all parked in DelayedWorkQueue.take()

Because the pool threads are non-daemon, they keep the JVM alive after the game logic finishes. The mod does not appear to shut these executors down (or set them daemon) on client stop.

Confirmation
Disabling SimpleRPC resolves the hang completely — the game exits cleanly. Re-enabling reproduces it.

Steps to reproduce
Launch with SimpleRPC 4.1.3 (+ CraterLib 3.1.2) on the environment above
Load a world, then quit to desktop
Observe the java process remains alive and must be force-killed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions