mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Memory leak fix & added test.
This commit is contained in:
parent
60c5e97d54
commit
5544d36875
@ -110,7 +110,7 @@ buildscript {
|
||||
ext.jsr305_version = constants.getProperty("jsr305Version")
|
||||
ext.shiro_version = '1.10.0'
|
||||
ext.artifactory_plugin_version = constants.getProperty('artifactoryPluginVersion')
|
||||
ext.hikari_version = '3.3.1'
|
||||
ext.hikari_version = '4.0.3'
|
||||
ext.liquibase_version = '3.6.3'
|
||||
ext.artifactory_contextUrl = 'https://software.r3.com/artifactory'
|
||||
ext.publicArtifactURL = 'https://download.corda.net/maven'
|
||||
|
@ -0,0 +1,39 @@
|
||||
package net.corda.node.migration
|
||||
|
||||
import net.corda.testing.core.ALICE_NAME
|
||||
import net.corda.testing.node.MockNetwork
|
||||
import net.corda.testing.node.MockNetworkParameters
|
||||
import net.corda.testing.node.internal.cordappsForPackages
|
||||
import org.apache.commons.lang3.SystemUtils
|
||||
import org.hibernate.internal.SessionFactoryRegistry
|
||||
import org.junit.Assume
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
class MemoryLeakTest {
|
||||
@Test(timeout=300_000)
|
||||
fun `memory leak test`() {
|
||||
assertFalse(SessionFactoryRegistry.INSTANCE.hasRegistrations())
|
||||
repeat(1) {
|
||||
// Start mock network
|
||||
Assume.assumeTrue(!SystemUtils.IS_JAVA_11)
|
||||
val mockNetwork = MockNetwork(
|
||||
MockNetworkParameters(
|
||||
cordappsForAllNodes = cordappsForPackages(
|
||||
listOf(
|
||||
"net.corda.node.services.vault"
|
||||
)
|
||||
)
|
||||
)
|
||||
).also { mockNetwork ->
|
||||
mockNetwork.createPartyNode(ALICE_NAME)
|
||||
}
|
||||
|
||||
// Stop mock network
|
||||
mockNetwork?.stopNodes()
|
||||
// mockNetwork = null
|
||||
}
|
||||
assertFalse(SessionFactoryRegistry.INSTANCE.hasRegistrations())
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ import net.corda.testing.node.MockServices.Companion.makeTestDataSourcePropertie
|
||||
import net.corda.testing.node.TestClock
|
||||
import org.apache.activemq.artemis.utils.ReusableLatch
|
||||
import org.apache.sshd.common.util.security.SecurityUtils
|
||||
import org.hibernate.internal.SessionFactoryRegistry
|
||||
import rx.Observable
|
||||
import rx.Scheduler
|
||||
import rx.internal.schedulers.CachedThreadScheduler
|
||||
@ -621,6 +622,7 @@ open class InternalMockNetwork(cordappPackages: List<String> = emptyList(),
|
||||
}
|
||||
messagingNetwork.stop()
|
||||
}
|
||||
SessionFactoryRegistry.INSTANCE.clearRegistrations()
|
||||
}
|
||||
|
||||
/** Block until all scheduled activity, active flows and network activity has ceased. */
|
||||
|
Loading…
Reference in New Issue
Block a user