Skip to content

JVM crashes when using channel.checkLinkStatus(association) #376

@ThwyIgo

Description

@ThwyIgo

Hey, I might have found a bug, but it could also just be that I'm doing something wrong, can you please help me?
I'm using the Java bindings of the library (1.6.0) and I have a MasterChannel 'channel'.

I try to run the following function:

public boolean isConnected() {
    try {
        channel.checkLinkStatus(association).toCompletableFuture().get();
        return true;
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        return false;
    } catch (ExecutionException e) {
        return false;
    }
}

The entire JVM crashed with this error message:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fe8f181d139, pid=7, tid=128
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.13+11 (17.0.13+11) (build 17.0.13+11)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (17.0.13+11, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libdnp3_ffi_java13554912791278311494.so+0x21d139]  dnp3_ffi::master::functions::master_channel_check_link_status::h2be7f0e91b3060c5+0x39
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t %P %I %h %e" (or dumping to /app/core.7)
#
# An error report file with more information is saved as:
# /app/hs_err_pid7.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)

You can see hs_err_pid7.log here

My implementation of AssociationInformation::taskFail logged this message before the error happened:

Task failed. Type: DISABLE_UNSOLICITED; Error: NO_CONNECTION

My AssociationConfig is pretty standard:

final AssociationConfig config = new AssociationConfig(
        EventClasses.all(),
        EventClasses.all(),
        Classes.all(),
        EventClasses.none())
        .withAutoTimeSync(AutoTimeSync.LAN)
        .withKeepAliveTimeout(Duration.ofSeconds(60));

final AssociationId association =
        channel.addAssociation(
                ushort(21),
                config,
                new _ReadHandler(),
                () -> UtcTimestamp.valid(ulong(System.currentTimeMillis())),
                new _AssociationInformation());

My source code is kinda big, but I can try to make a minimal reproducible example if you think it would help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions