8000 JVM crash when closing MediaDriver after failed close of Aeron client. · Issue #607 · aeron-io/aeron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
JVM crash when closing MediaDriver after failed close of Aeron client. #607
Closed
@aptdevel

Description

@aptdevel

Hello,

I am experiencing a JVM crash when closing the MediaDriver, which appears to be related to a previous attempt to close the Aeron client that failed due to thread interruption.

I am using Aeron 1.13.0 with Oracle JDK 1.8.0_191 on Linux.

Here is a short example that crashes:

import io.aeron.Aeron;
import io.aeron.Publication;
import io.aeron.driver.MediaDriver;

public class AeronCrashOnDriverCloseAfterInterruptBeforePublisherClose {
    public static void main(String[] args) {
        final MediaDriver.Context driverCtx = new MediaDriver.Context();
        // For cleanliness; not relevant.
        driverCtx.warnIfDirectoryExists(false).dirDeleteOnStart(true);
        
        final Aeron.Context clientCtx = new Aeron.Context();
        
        try (MediaDriver driver = MediaDriver.launch(driverCtx);
            Aeron client = Aeron.connect(clientCtx);
            Publication pub = client.addPublication("aeron:ipc", 42))
        {
            // Comment this out and program exits normally.
            Thread.currentThread().interrupt();
        }
    }
}

The Publication#close() doesn't need to fail for the crash to happen. The determining factor seems to be whether the Aeron#close() was interrupted. Here is a slightly more verbose example with a successful Publication close:

import io.aeron.Aeron;
import io.aeron.Publication;
import io.aeron.driver.MediaDriver;

public class AeronCrashOnDriverCloseAfterInterruptBeforeClientClose {
    public static void main(String[] args) {
        final MediaDriver.Context driverCtx = new MediaDriver.Context();
        // For cleanliness; not relevant.
        driverCtx.warnIfDirectoryExists(false).dirDeleteOnStart(true);
        
        final Aeron.Context clientCtx = new Aeron.Context();
        
        final MediaDriver driver = MediaDriver.launch(driverCtx);
        try {
            final Aeron client = Aeron.connect(clientCtx);
            try {
                // Need to add a Publication, or the crash will not happen.
                final Publication pub = client.addPublication("aeron:ipc", 42);
                pub.close();
                
                // Comment this out and program exits normally.
                Thread.currentThread().interrupt();
            } finally {
                // This will throw AeronException because of interrupt flag.
                // (Publication would sneaky-throw InterruptedException.)
                client.close();
            }
        } finally {
            // This will cause JVM to crash if the Aeron#close() failed.
            driver.close();
        }
    }
}

I can provide an hs_err log if that helps.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0