Skip to content

Commit a1c1535

Browse files
committed
Bug 36478628 - [33699233->24.09] An unnecessary stack trace is logged whenever a member leaves the cluster
COH-24703 An unnecessary stack trace is logged whenever a member leaves the cluster (auto-submit 108087 after successfully running remote remote.full) Job ID: job.9.20240403151143.8722 (auto-submit integ 108221 main -> coherence-ce/main after successfully running remote remote.full) Job ID: job.9.20240403200940.31485 [git-p4: depot-paths = "//dev/coherence-ce/main/": change = 108257]
1 parent 2daf0ba commit a1c1535

File tree

1 file changed

+62
-61
lines changed

1 file changed

+62
-61
lines changed

prj/coherence-core/src/main/java/com/oracle/coherence/common/internal/net/socketbus/AbstractSocketBus.java

Lines changed: 62 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ public void proceed(Void v)
215215
}
216216
});
217217
}
218+
}
218219
}
219-
}
220220
catch (IOException e)
221221
{
222222
throw new IllegalStateException(e);
@@ -1816,24 +1816,24 @@ public int getProtocolVersion()
18161816
* @param runnable the runnable to invoke
18171817
*/
18181818
protected synchronized void invoke(Runnable runnable)
1819-
{
1820-
Queue<Runnable> queueDeferred = m_queueDeferred;
1821-
if (queueDeferred == null)
18221819
{
1823-
try
1820+
Queue<Runnable> queueDeferred = m_queueDeferred;
1821+
if (queueDeferred == null)
18241822
{
1825-
getSelectionService().invoke(m_channel, runnable, /*cMillisDelay*/ 0);
1823+
try
1824+
{
1825+
getSelectionService().invoke(m_channel, runnable, /*cMillisDelay*/ 0);
1826+
}
1827+
catch (IOException e)
1828+
{
1829+
throw new RuntimeException(e);
1830+
}
18261831
}
1827-
catch (IOException e)
1832+
else
18281833
{
1829-
throw new RuntimeException(e);
1834+
queueDeferred.add(runnable);
18301835
}
18311836
}
1832-
else
1833-
{
1834-
queueDeferred.add(runnable);
1835-
}
1836-
}
18371837

18381838
// ----- Channel interface ------------------------------------------
18391839

@@ -2090,69 +2090,70 @@ public int read(ByteBuffer dst) throws IOException
20902090
*/
20912091
public synchronized void migrate(Throwable eReason)
20922092
{
2093-
SocketBusDriver.Dependencies depsDriver = f_driver.getDependencies();
2094-
int cSocketReconnectLimit = depsDriver.getSocketReconnectLimit();
2093+
SocketBusDriver.Dependencies depsDriver = f_driver.getDependencies();
2094+
int cSocketReconnectLimit = depsDriver.getSocketReconnectLimit();
20952095

2096-
// COH-24389 - a reconnect limit of < 0 indicates that migrations are disabled
2097-
if (getProtocolVersion() == 0 || cSocketReconnectLimit < 0)
2098-
{
2099-
scheduleDisconnect(eReason);
2100-
}
2101-
else // protocol not yet negotiated or >= 1, in either case we can attempt a migration
2102-
{
2103-
if (eReason instanceof ConnectException && ++m_cReconnectAttempts > cSocketReconnectLimit)
2096+
// COH-24389 - a reconnect limit of < 0 indicates that migrations are disabled
2097+
if (getProtocolVersion() == 0 || cSocketReconnectLimit < 0)
21042098
{
2105-
// we've exhausted our reconnect attempts, disconnect
21062099
scheduleDisconnect(eReason);
2107-
return;
21082100
}
2101+
else // protocol not yet negotiated or >= 1, in either case we can attempt a migration
2102+
{
2103+
if (eReason instanceof ConnectException && ++m_cReconnectAttempts > cSocketReconnectLimit)
2104+
{
2105+
// we've exhausted our reconnect attempts, disconnect
2106+
scheduleDisconnect(eReason);
2107+
return;
2108+
}
21092109

2110-
// delay reconnect on initial connect and to also help avoid an endless conflict
2111-
// if both sides were to keep trying to simultaneously reconnect and in doing so invalidate the other
2112-
// side's reconnect attempt.
2113-
long cMillisDelay = eReason instanceof ConnectException ||
2114-
getLocalEndPoint().getCanonicalName().compareTo(getPeer().getCanonicalName()) > 0
2115-
? depsDriver.getSocketReconnectDelayMillis()
2116-
: 0;
2110+
// delay reconnect on initial connect and to also help avoid an endless conflict
2111+
// if both sides were to keep trying to simultaneously reconnect and in doing so invalidate the other
2112+
// side's reconnect attempt.
2113+
long cMillisDelay = eReason instanceof ConnectException ||
2114+
getLocalEndPoint().getCanonicalName().compareTo(getPeer().getCanonicalName()) > 0
2115+
? depsDriver.getSocketReconnectDelayMillis()
2116+
: 0;
21172117

2118-
SocketChannel chan = m_channel;
2119-
String sChan = chan.toString(); // to preserve port info for subsequent logging
2118+
SocketChannel chan = m_channel;
2119+
String sChan = chan.toString(); // to preserve port info for subsequent logging
21202120

2121-
closeChannel(chan);
2121+
closeChannel(chan);
21222122

2123-
scheduleUnsafeTask(chan, new Runnable()
2124-
{
2125-
@Override
2126-
public void run()
2123+
scheduleUnsafeTask(chan, new Runnable()
21272124
{
2128-
synchronized (Connection.this)
2125+
@Override
2126+
public void run()
21292127
{
2130-
if (m_state.ordinal() < ConnectionState.DEFUNCT.ordinal() && chan == m_channel)
2128+
synchronized (Connection.this)
21312129
{
2132-
getLogger().log(makeExceptionRecord(Level.FINER, eReason,
2133-
"{0} migrating connection with {1} off of {2} on {3}",
2134-
getLocalEndPoint(), getPeer(), sChan, Connection.this));
2130+
if (m_state.ordinal() < ConnectionState.DEFUNCT.ordinal() && chan == m_channel)
2131+
{
2132+
// COH-24703 - not adding the exception to the LogRecord because logging the stack trace is not useful in this case
2133+
getLogger().log(makeRecord(Level.FINER,
2134+
"{0} migrating connection with {1} off of {2} on {3}: {4}",
2135+
getLocalEndPoint(), getPeer(), sChan, Connection.this, eReason));
21352136

2136-
m_eMigrationCause = eReason;
2137-
onMigration();
2137+
m_eMigrationCause = eReason;
2138+
onMigration();
21382139

2139-
// we're sync'd on the connection so nothing new can be scheduled
2140-
try
2141-
{
2142-
getSelectionService().register(chan, null);
2143-
m_handler = null;
2144-
}
2140+
// we're sync'd on the connection so nothing new can be scheduled
2141+
try
2142+
{
2143+
getSelectionService().register(chan, null);
2144+
m_handler = null;
2145+
}
21452146
catch (IOException e) {}
21462147

2147-
// replaces m_channel, so any subsequent exceptions on the old channel won't make it into this if block
2148-
// schedule task to ensure register and connect are processed sequentially
2149-
scheduleUnsafeTask(chan, ()-> connect(), cMillisDelay);
2148+
// replaces m_channel, so any subsequent exceptions on the old channel won't make it into this if block
2149+
// schedule task to ensure register and connect are processed sequentially
2150+
scheduleUnsafeTask(chan, () -> connect(), cMillisDelay);
2151+
}
21502152
}
21512153
}
2152-
}
2153-
}, cMillisDelay);
2154+
}, cMillisDelay);
2155+
}
21542156
}
2155-
}
21562157

21572158
/**
21582159
* Called when the channel has been selected.
@@ -3114,11 +3115,11 @@ public void run()
31143115
throw new IllegalStateException("state = " + connOld.m_state);
31153116
}
31163117
}
3118+
}
31173119
}
31183120
}
3119-
}
3120-
finally
3121-
{
3121+
finally
3122+
{
31223123
if (m_connection != connNew)
31233124
{
31243125
connNew.dispose();

0 commit comments

Comments
 (0)