You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When deploying multiple contracts on multiple nodes, there are multiple
SSH connections being established.
When this all happens on the same host (because you are running the
all-in-one image for example) then the closing and opening of the same
SSH port is not instant between disconnect and connect operations of the
SSH client and connectivity problems come up.
Due to lack of time I quickly fixed this by adding a 5 second wait
between the disconnect and connect operations. Retries would be a much
better solution long term especially since race conditions can never
truly be fixed with hardcoded wait times that will sooner or later become
too short or too long depending on the exact nature of the problem.
[skip ci]
Signed-off-by: Peter Somogyvari <[email protected]>
Copy file name to clipboardExpand all lines: packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/ApiPluginLedgerConnectorCordaServiceImpl.kt
+5
Original file line number
Diff line number
Diff line change
@@ -292,6 +292,11 @@ class ApiPluginLedgerConnectorCordaServiceImpl(
292
292
try {
293
293
ssh.disconnect()
294
294
logger.debug("Disconnected OK from SSH host ${cred.hostname}:${cred.port}")
295
+
// This is a hack to force the code to wait for the OS to close down the port. Without it, deployments
296
+
// can fail intermittently because it'll try to reconnect too fast. The right way to fix it is
297
+
// to make it probe the port openness and have retries with exponential backoff.
298
+
// TODO: Implement the proper fix as described above.
299
+
Thread.sleep(5000)
295
300
} catch (ex:Exception) {
296
301
logger.warn("Disconnect failed from SSH host ${cred.hostname}:${cred.port}. Ignoring since we are done anyway...")
0 commit comments