diff --git a/LavalinkServer/build.gradle.kts b/LavalinkServer/build.gradle.kts index 0ed127527..c1f131a7b 100644 --- a/LavalinkServer/build.gradle.kts +++ b/LavalinkServer/build.gradle.kts @@ -64,7 +64,10 @@ dependencies { implementation(libs.kotlin.reflect) implementation(libs.logback) implementation(libs.sentry.logback) - implementation(libs.oshi) + implementation(libs.oshi) { + // This version of SLF4J does not recognise Logback 1.2.3 + exclude(group = "org.slf4j", module = "slf4j-api") + } implementation(libs.json) compileOnly(libs.spotbugs) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/StatsCollector.kt b/LavalinkServer/src/main/java/lavalink/server/io/StatsCollector.kt index d70f1fc56..0c951cd65 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/StatsCollector.kt +++ b/LavalinkServer/src/main/java/lavalink/server/io/StatsCollector.kt @@ -50,6 +50,11 @@ class StatsCollector(val socketServer: SocketServer) { get() { val p = os.getProcess(os.processId) + if (p == null) { + log.warn("Could not get process stats, process null") + return 0.0 + } + val output: Double = if (cpuTime != 0.0) { val uptimeDiff = p.upTime - uptime val cpuDiff = p.kernelTime + p.userTime - cpuTime diff --git a/settings.gradle.kts b/settings.gradle.kts index 97c3e6628..696651de8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -75,7 +75,7 @@ fun VersionCatalogBuilder.common() { library("logback", "ch.qos.logback", "logback-classic").version("1.2.3") library("sentry-logback", "io.sentry", "sentry-logback").version("1.7.2") - library("oshi", "com.github.oshi", "oshi-core").version("5.7.4") + library("oshi", "com.github.oshi", "oshi-core").version("6.4.8") library("json", "org.json", "json").version("20180813") library("spotbugs", "com.github.spotbugs", "spotbugs-annotations").version("3.1.6")