From 209034724ff23af142be63999b7185a0fe81b8df Mon Sep 17 00:00:00 2001 From: Philipp Wagner Date: Sat, 15 Aug 2026 00:28:43 +0200 Subject: [PATCH] on4kst: add the jdk.net module to every packaging module list and stop connection setup from failing silently The ON4KST connection manager introduced in f8c04e7 uses jdk.net.ExtendedSocketOptions to configure kernel side TCP keepalives. The new dependency was added to module-info.java and to the jpackage Maven plugin, but the CI and AUR builds do not use that plugin: they call jpackage directly with a hardcoded --add-modules list that still lacked jdk.net. Because jdk.net is not pulled in transitively, every packaged runtime image shipped without the class while development runs against the full JDK and kept working. The resulting NoClassDefFoundError is an Error, so neither the catch in configureSocket nor the surrounding catch (Exception) in openConnection handled it. Running on a ScheduledExecutorService, the throwable was stored in the task future and never surfaced, leaving the state machine stuck in CONNECTING with no reconnect attempt and no user visible failure. Add jdk.net to all 16 module lists, covering nightly artifacts, tagged releases and both AUR PKGBUILDs, so releases are affected as well as nightlies. Additionally catch LinkageError in configureSocket so a runtime image without jdk.net degrades to application level heartbeats, and catch Throwable in openConnection so an Error can no longer be swallowed by the scheduler. Co-Authored-By: Claude Opus 5 --- .github/workflows/nightly-artifacts.yml | 14 +++++++------- .github/workflows/tagged-release.yml | 14 +++++++------- packaging/aur/kst4contest-git/PKGBUILD | 2 +- packaging/aur/kst4contest/PKGBUILD | 2 +- .../controller/On4KstConnectionManager.java | 9 +++++++-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/nightly-artifacts.yml b/.github/workflows/nightly-artifacts.yml index 2bc286e..4809147 100644 --- a/.github/workflows/nightly-artifacts.yml +++ b/.github/workflows/nightly-artifacts.yml @@ -71,7 +71,7 @@ jobs: --main-jar app.jar ` --main-class kst4contest.view.Kst4ContestApplication ` --module-path target/dist-libs ` - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec ` + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net ` --dest dist - name: Create Windows ZIP @@ -128,7 +128,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist - name: Create AppDir metadata @@ -214,7 +214,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --linux-package-deps "libgstreamer1.0-0,libgstreamer-plugins-base1.0-0,gstreamer1.0-plugins-good" \ --dest dist DEB="$(ls dist/*.deb | head -n 1)" @@ -274,7 +274,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --linux-package-deps "gstreamer1,gstreamer1-plugins-base,gstreamer1-plugins-good" \ --dest dist RPM="$(ls dist/*.rpm | head -n 1)" @@ -336,7 +336,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist - name: Build Arch Linux package artifact @@ -455,7 +455,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest target/flatpak-src - name: Create Flatpak manifest @@ -643,7 +643,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist env: diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index cba6638..5e0b82e 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -56,7 +56,7 @@ jobs: --main-jar app.jar ` --main-class kst4contest.view.Kst4ContestApplication ` --module-path target/dist-libs ` - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec ` + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net ` --dest dist - name: Create Windows ZIP @@ -106,7 +106,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist - name: Create AppDir metadata @@ -185,7 +185,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --linux-package-deps "libgstreamer1.0-0,libgstreamer-plugins-base1.0-0,gstreamer1.0-plugins-good" \ --dest dist DEB="$(ls dist/*.deb | head -n 1)" @@ -238,7 +238,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --linux-package-deps "gstreamer1,gstreamer1-plugins-base,gstreamer1-plugins-good" \ --dest dist RPM="$(ls dist/*.rpm | head -n 1)" @@ -291,7 +291,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist - name: Build Arch Linux package artifact @@ -401,7 +401,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest target/flatpak-src - name: Create Flatpak manifest @@ -531,7 +531,7 @@ jobs: --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist env: diff --git a/packaging/aur/kst4contest-git/PKGBUILD b/packaging/aur/kst4contest-git/PKGBUILD index 937106b..ca3fb74 100644 --- a/packaging/aur/kst4contest-git/PKGBUILD +++ b/packaging/aur/kst4contest-git/PKGBUILD @@ -40,7 +40,7 @@ build() { --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist } diff --git a/packaging/aur/kst4contest/PKGBUILD b/packaging/aur/kst4contest/PKGBUILD index 6c7b2b8..467b08b 100644 --- a/packaging/aur/kst4contest/PKGBUILD +++ b/packaging/aur/kst4contest/PKGBUILD @@ -33,7 +33,7 @@ build() { --main-jar app.jar \ --main-class kst4contest.view.Kst4ContestApplication \ --module-path target/dist-libs \ - --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec \ + --add-modules javafx.controls,javafx.graphics,javafx.fxml,javafx.web,javafx.media,java.sql,java.net.http,jdk.crypto.ec,jdk.net \ --dest dist } diff --git a/src/main/java/kst4contest/controller/On4KstConnectionManager.java b/src/main/java/kst4contest/controller/On4KstConnectionManager.java index ecbac75..ae74860 100644 --- a/src/main/java/kst4contest/controller/On4KstConnectionManager.java +++ b/src/main/java/kst4contest/controller/On4KstConnectionManager.java @@ -285,7 +285,10 @@ final class On4KstConnectionManager { scheduler.schedule( () -> sendLogin(token), LOGIN_FALLBACK_MILLIS, TimeUnit.MILLISECONDS); - } catch (Exception exception) { + } catch (Throwable exception) { + // Errors must be caught as well: an Error escaping here would be + // swallowed by the scheduler and leave the state machine stuck in + // CONNECTING without any reconnect attempt or user visible failure. try { socket.close(); } catch (IOException ignored) { @@ -699,7 +702,9 @@ final class On4KstConnectionManager { socket.setOption(ExtendedSocketOptions.TCP_KEEPIDLE, 45); socket.setOption(ExtendedSocketOptions.TCP_KEEPINTERVAL, 15); socket.setOption(ExtendedSocketOptions.TCP_KEEPCOUNT, 3); - } catch (UnsupportedOperationException | IOException exception) { + } catch (UnsupportedOperationException | IOException | LinkageError exception) { + // LinkageError covers runtime images built without the jdk.net module; + // the connection stays usable, only kernel side keepalive is missing. LOGGER.log(Level.INFO, "Platform does not support configurable TCP keepalive; " + "application heartbeat remains active", exception);