dazraf
dazraf

Reputation: 362

Node Driver hangs and times out

I have a never before seen problem with NodeDriver, when running a simple node driver program:

fun main(args: Array<String>) {
    val rpcUsers = listOf(User("user1", "test", permissions = setOf("ALL")))

    driver(DriverParameters(startNodesInProcess = true, waitForAllNodesToFinish = true)) {
        startNode(providedName = CordaX500Name("PartyA", "London", "GB"), rpcUsers = rpcUsers).getOrThrow()
        startNode(providedName = CordaX500Name("PartyB", "New York", "US"), rpcUsers = rpcUsers).getOrThrow()
    }
}

When I run this in a new Kotlin template cordapp project, using Corda OS 4.1, it works fine. However, when its run in our existing cordapp, it fails eventually with:

java.lang.IllegalStateException: Unable to start notaries. A required port might be bound already.
    at net.corda.testing.node.internal.DriverDSLImpl.start(DriverDSLImpl.kt:373) ~[corda-node-driver-4.1.jar:?]
    at net.corda.testing.node.internal.DriverDSLImplKt.genericDriver(DriverDSLImpl.kt:966) ~[corda-node-driver-4.1.jar:?]
    at net.corda.testing.driver.Driver.driver(Driver.kt:190) ~[corda-node-driver-4.1.jar:?]
    at io.bluebank.braid.server.CordaAndBraidStandaloneKt.main(CordaAndBraidStandalone.kt:48) ~[test-classes/:?]
Caused by: java.util.concurrent.TimeoutException
    at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771) ~[?:1.8.0_212]
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[?:1.8.0_212]
    at net.corda.core.internal.concurrent.CordaFutureImpl.get(CordaFutureImpl.kt) ~[corda-core-4.1.jar:?]
    at net.corda.core.internal.concurrent.CordaFutureImplKt.get(CordaFutureImpl.kt:172) ~[corda-core-4.1.jar:?]
    at net.corda.core.utilities.KotlinUtilsKt.getOrThrow(KotlinUtils.kt:134) ~[corda-core-4.1.jar:?]
    at net.corda.testing.node.internal.DriverDSLImpl.start(DriverDSLImpl.kt:369) ~[corda-node-driver-4.1.jar:?]

Debugging this, when I break point during whatever is blocking it, all threads are in a WAIT state, apart from one called SignalDispatcher which is RUNNING. None of the stacks are within Corda. However, some are in blocked within the Quasar stack.

Debugging further, I've found the line where the blocking behaviour happens: net.corda.node.services.rpc.ArtemisRpcBroker.kt:74

val serverConfiguration = RpcBrokerConfiguration(baseDirectory, maxMessageSize, jmxEnabled, addresses.primary, adminAddressOptional, sslOptions, useSsl, nodeConfiguration, shouldStartLocalShell)

Stepping into that constructor, Quasar takes over and appears to call ClassLoader.checkPackageAccess repeatedly. Allowing the call to continue, it never enters RpcBrokerConfiguration#init.

Has anyone else seen this before and are there any recommendations to fixing the issue or clues as to how we can debug it further? Thanks.

PS - this references Corda errorCode 1crywct.

Upvotes: 3

Views: 174

Answers (2)

dazraf
dazraf

Reputation: 362

I figured it out. My project is a CordaRPC client. It had a version of a third party lib that was conflicting with the version number that's used in Corda. This seems to make quasar go into a long loop attempting to resolve types! Fixing the conflict, fixed the issue. Perhaps there's something that Corda can do to give more clues when this happens.

Upvotes: 1

Manos Batsis
Manos Batsis

Reputation: 92

FWIW, I would check for other processes using the same ports or just change the port via the node driver. For example the YourKit shipped with Intellij runs by default on port 10001 i.e. on the default node driver notary port - well, assuming i remember correctly.

Upvotes: 1

Related Questions