Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit f94d5ff

Browse files
committed
FAB-5846 Infinite wait on slow channel update
Change-Id: Id47b57f9283e97171ac10a8d134795b39a75623b Signed-off-by: rickr <cr22rc@gmail.com>
1 parent 629d9a9 commit f94d5ff

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/java/org/hyperledger/fabric/sdk/Channel.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelC
260260

261261
try {
262262
final long startLastConfigIndex = getLastConfigIndex(orderer);
263+
logger.trace(format("startLastConfigIndex: %d. Channel config wait time is: %d",
264+
startLastConfigIndex, CHANNEL_CONFIG_WAIT_TIME));
263265

264266
sendUpdateChannel(updateChannelConfiguration.getUpdateChannelConfigurationAsBytes(), signers, orderer);
265267

@@ -274,9 +276,10 @@ public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelC
274276
final long duration = TimeUnit.MILLISECONDS.convert(System.nanoTime() - nanoTimeStart, TimeUnit.NANOSECONDS);
275277

276278
if (duration > CHANNEL_CONFIG_WAIT_TIME) {
277-
logger.warn(format("Channel %s did not get updated last config after %d ms", name, duration));
279+
logger.warn(format("Channel %s did not get updated last config after %d ms, Config wait time: %d ms. startLastConfigIndex: %d, currentLastConfigIndex: %d ",
280+
name, duration, CHANNEL_CONFIG_WAIT_TIME, startLastConfigIndex, currentLastConfigIndex));
278281
//waited long enough ..
279-
currentLastConfigIndex = startLastConfigIndex; // just bail don't throw exception.
282+
currentLastConfigIndex = startLastConfigIndex - 1L; // just bail don't throw exception.
280283
} else {
281284

282285
try {
@@ -289,6 +292,8 @@ public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelC
289292

290293
}
291294

295+
logger.trace(format("currentLastConfigIndex: %d", currentLastConfigIndex));
296+
292297
} while (currentLastConfigIndex == startLastConfigIndex);
293298

294299
} catch (TransactionException e) {
@@ -386,7 +391,6 @@ private void sendUpdateChannel(byte[] configupdate, byte[][] signers, Orderer or
386391
String info = trxResult.getInfo();
387392
if (null == info) {
388393
info = "";
389-
390394
}
391395

392396
throw new TransactionException(format("New channel %s error. StatusValue %d. Status %s. %s", name,
@@ -1059,7 +1063,11 @@ private Block getConfigurationBlock() throws TransactionException {
10591063
channelHeader.getChannelId(), name));
10601064
}
10611065

1062-
logger.trace(format("Channel %s getConfigurationBlock returned %s", name, String.valueOf(configBlock)));
1066+
if (null != diagnosticFileDumper) {
1067+
logger.trace(format("Channel %s getConfigurationBlock returned %s", name,
1068+
diagnosticFileDumper.createDiagnosticFile(String.valueOf(configBlock).getBytes())));
1069+
}
1070+
10631071
if (!logger.isTraceEnabled()) {
10641072
logger.debug(format("Channel %s getConfigurationBlock returned", name));
10651073
}

src/main/java/org/hyperledger/fabric/sdk/helper/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private Config() {
100100
defaultProperty(EXTRALOGLEVEL, "0");
101101
defaultProperty(LOGGERLEVEL, null);
102102
defaultProperty(DIAGNOTISTIC_FILE_DIRECTORY, null);
103-
defaultProperty(CHANNEL_CONFIG_WAIT_TIME, "10000");
103+
defaultProperty(CHANNEL_CONFIG_WAIT_TIME, "15000");
104104
defaultProperty(ORDERER_RETRY_WAIT_TIME, "200");
105105
defaultProperty(EVENTHUB_CONNECTION_WAIT_TIME, "1000");
106106

0 commit comments

Comments
 (0)