From ec83735ea372be81dbaf1eed567432ce77bdf508 Mon Sep 17 00:00:00 2001 From: mkit Date: Fri, 18 Aug 2017 10:16:16 +0100 Subject: [PATCH] Adding hint on how to fix the 'not instrumented' error message (#1274) * Adding hint on how to fix the 'not instrumented' error message * Addressing review comments --- .../node/services/statemachine/StateMachineManager.kt | 9 +++++++++ .../src/main/kotlin/net/corda/testing/driver/Driver.kt | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManager.kt b/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManager.kt index fbbbbaf4fd..4c2e3b0368 100644 --- a/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManager.kt +++ b/node/src/main/kotlin/net/corda/node/services/statemachine/StateMachineManager.kt @@ -2,6 +2,7 @@ package net.corda.node.services.statemachine import co.paralleluniverse.fibers.Fiber import co.paralleluniverse.fibers.FiberExecutorScheduler +import co.paralleluniverse.fibers.instrument.SuspendableHelper import co.paralleluniverse.strands.Strand import com.codahale.metrics.Gauge import com.esotericsoftware.kryo.KryoException @@ -166,11 +167,19 @@ class StateMachineManager(val serviceHub: ServiceHubInternal, val changes: Observable = mutex.content.changesPublisher.wrapWithDatabaseTransaction() fun start() { + checkQuasarJavaAgentPresence() restoreFibersFromCheckpoints() listenToLedgerTransactions() serviceHub.networkMapCache.mapServiceRegistered.then { executor.execute(this::resumeRestoredFibers) } } + private fun checkQuasarJavaAgentPresence() { + check(SuspendableHelper.isJavaAgentActive(), { + """Missing the '-javaagent' JVM argument. Make sure you run the tests with the Quasar java agent attached to your JVM. + #See https://docs.corda.net/troubleshooting.html - 'Fiber classes not instrumented' for more details.""".trimMargin("#") + }) + } + private fun listenToLedgerTransactions() { // Observe the stream of committed, validated transactions and resume fibers that are waiting for them. serviceHub.validatedTransactions.updates.subscribe { stx -> diff --git a/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt b/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt index 44f3ad88e3..fb99b80c6c 100644 --- a/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt +++ b/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt @@ -26,12 +26,10 @@ import net.corda.core.node.services.ServiceType import net.corda.core.utilities.* import net.corda.node.internal.Node import net.corda.node.internal.NodeStartup -import net.corda.node.serialization.NodeClock import net.corda.node.services.config.* import net.corda.node.services.network.NetworkMapService import net.corda.node.services.transactions.RaftValidatingNotaryService import net.corda.node.utilities.ServiceIdentityGenerator -import net.corda.node.utilities.TestClock import net.corda.nodeapi.ArtemisMessagingComponent import net.corda.nodeapi.User import net.corda.nodeapi.config.SSLConfiguration @@ -47,7 +45,6 @@ import java.io.File import java.net.* import java.nio.file.Path import java.nio.file.Paths -import java.time.Clock import java.time.Duration import java.time.Instant import java.time.ZoneOffset.UTC