mirror of
https://github.com/corda/corda.git
synced 2024-12-24 23:26:48 +00:00
NOTICK Close node handles to reduce memory usage (#6557)
Note in theory this shouldn't make a difference, however given the pass rate of this PR I figure it's worth trying.
This commit is contained in:
parent
de5568854c
commit
ff5bdcb559
@ -157,8 +157,9 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
epoch = 3,
|
epoch = 3,
|
||||||
modifiedTime = Instant.ofEpochMilli(random63BitValue())).addNotary(notary)
|
modifiedTime = Instant.ofEpochMilli(random63BitValue())).addNotary(notary)
|
||||||
|
|
||||||
val alice = startNodeAndRunFlagDay(paramsWithNewNotary)
|
startNodeAndRunFlagDay(paramsWithNewNotary).use { alice ->
|
||||||
eventually { assertEquals(paramsWithNewNotary, alice.rpc.networkParameters) }
|
eventually { assertEquals(paramsWithNewNotary, alice.rpc.networkParameters) }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,10 +201,11 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
epoch = 3,
|
epoch = 3,
|
||||||
modifiedTime = Instant.ofEpochMilli(random63BitValue()),
|
modifiedTime = Instant.ofEpochMilli(random63BitValue()),
|
||||||
maxMessageSize = oldParams.maxMessageSize + 1)
|
maxMessageSize = oldParams.maxMessageSize + 1)
|
||||||
val alice = startNodeAndRunFlagDay(paramsWithUpdatedMaxMessageSize)
|
startNodeAndRunFlagDay(paramsWithUpdatedMaxMessageSize).use { alice ->
|
||||||
eventually { assertThatThrownBy { alice.rpc.networkParameters }.hasMessageContaining("Connection failure detected") }
|
eventually { assertThatThrownBy { alice.rpc.networkParameters }.hasMessageContaining("Connection failure detected") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test(timeout = 300_000)
|
@Test(timeout = 300_000)
|
||||||
fun `Can not hotload parameters if notary and a non-hotloadable parameter changes and the node will shut down`() {
|
fun `Can not hotload parameters if notary and a non-hotloadable parameter changes and the node will shut down`() {
|
||||||
@ -219,10 +221,11 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
epoch = 3,
|
epoch = 3,
|
||||||
modifiedTime = Instant.ofEpochMilli(random63BitValue()),
|
modifiedTime = Instant.ofEpochMilli(random63BitValue()),
|
||||||
maxMessageSize = oldParams.maxMessageSize + 1).addNotary(notary)
|
maxMessageSize = oldParams.maxMessageSize + 1).addNotary(notary)
|
||||||
val alice = startNodeAndRunFlagDay(paramsWithUpdatedMaxMessageSizeAndNotary)
|
startNodeAndRunFlagDay(paramsWithUpdatedMaxMessageSizeAndNotary).use { alice ->
|
||||||
eventually { assertThatThrownBy { alice.rpc.networkParameters }.hasMessageContaining("Connection failure detected") }
|
eventually { assertThatThrownBy { alice.rpc.networkParameters }.hasMessageContaining("Connection failure detected") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun DriverDSLImpl.startNodeAndRunFlagDay(newParams: NetworkParameters): NodeHandleInternal {
|
private fun DriverDSLImpl.startNodeAndRunFlagDay(newParams: NetworkParameters): NodeHandleInternal {
|
||||||
|
|
||||||
@ -246,15 +249,14 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
compatibilityZone = compatibilityZone,
|
compatibilityZone = compatibilityZone,
|
||||||
notarySpecs = emptyList()
|
notarySpecs = emptyList()
|
||||||
) {
|
) {
|
||||||
val aliceNode = startNode(providedName = ALICE_NAME, devMode = false).getOrThrow()
|
startNode(providedName = ALICE_NAME, devMode = false).getOrThrow().use { aliceNode ->
|
||||||
assertDownloadedNetworkParameters(aliceNode)
|
assertDownloadedNetworkParameters(aliceNode)
|
||||||
aliceNode.onlySees(aliceNode.nodeInfo)
|
aliceNode.onlySees(aliceNode.nodeInfo)
|
||||||
|
|
||||||
val bobNode = startNode(providedName = BOB_NAME, devMode = false).getOrThrow()
|
|
||||||
|
|
||||||
// Wait for network map client to poll for the next update.
|
// Wait for network map client to poll for the next update.
|
||||||
Thread.sleep(cacheTimeout.toMillis() * 2)
|
Thread.sleep(cacheTimeout.toMillis() * 2)
|
||||||
|
|
||||||
|
startNode(providedName = BOB_NAME, devMode = false).getOrThrow().use { bobNode ->
|
||||||
bobNode.onlySees(aliceNode.nodeInfo, bobNode.nodeInfo)
|
bobNode.onlySees(aliceNode.nodeInfo, bobNode.nodeInfo)
|
||||||
aliceNode.onlySees(aliceNode.nodeInfo, bobNode.nodeInfo)
|
aliceNode.onlySees(aliceNode.nodeInfo, bobNode.nodeInfo)
|
||||||
|
|
||||||
@ -266,6 +268,8 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
bobNode.onlySees(bobNode.nodeInfo)
|
bobNode.onlySees(bobNode.nodeInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test(timeout=300_000)
|
@Test(timeout=300_000)
|
||||||
fun `test node heartbeat`() {
|
fun `test node heartbeat`() {
|
||||||
@ -275,7 +279,7 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
notarySpecs = emptyList(),
|
notarySpecs = emptyList(),
|
||||||
systemProperties = mapOf("net.corda.node.internal.nodeinfo.publish.interval" to 1.seconds.toString())
|
systemProperties = mapOf("net.corda.node.internal.nodeinfo.publish.interval" to 1.seconds.toString())
|
||||||
) {
|
) {
|
||||||
val aliceNode = startNode(providedName = ALICE_NAME, devMode = false).getOrThrow()
|
startNode(providedName = ALICE_NAME, devMode = false).getOrThrow().use { aliceNode ->
|
||||||
val aliceNodeInfo = aliceNode.nodeInfo.serialize().hash
|
val aliceNodeInfo = aliceNode.nodeInfo.serialize().hash
|
||||||
assertThat(networkMapServer.networkMapHashes()).contains(aliceNodeInfo)
|
assertThat(networkMapServer.networkMapHashes()).contains(aliceNodeInfo)
|
||||||
networkMapServer.removeNodeInfo(aliceNode.nodeInfo)
|
networkMapServer.removeNodeInfo(aliceNode.nodeInfo)
|
||||||
@ -295,6 +299,7 @@ class NetworkMapTest(var initFunc: (URL, NetworkMapServer) -> CompatibilityZoneP
|
|||||||
assertThat(networkMapServer.networkMapHashes()).contains(aliceNodeInfo)
|
assertThat(networkMapServer.networkMapHashes()).contains(aliceNodeInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun assertDownloadedNetworkParameters(node: NodeHandle) {
|
private fun assertDownloadedNetworkParameters(node: NodeHandle) {
|
||||||
val networkParameters = (node.baseDirectory / NETWORK_PARAMS_FILE_NAME)
|
val networkParameters = (node.baseDirectory / NETWORK_PARAMS_FILE_NAME)
|
||||||
|
Loading…
Reference in New Issue
Block a user