Skip to content

Commit d13ffc8

Browse files
committed
Bug 36409014 - Build: Intermittent failure in queues.GrpcClientDequeTests.shouldGetNewInstanceOfDestroyedQueue
(auto-submit 108107 after successfully running remote remote.full) Job ID: job.9.20240403092259.17510 [git-p4: depot-paths = "//dev/coherence-ce/main/": change = 108190]
1 parent 9487c62 commit d13ffc8

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

prj/coherence-grpc-proxy-common/src/main/java/com/oracle/coherence/grpc/proxy/common/BaseNamedCacheServiceImpl.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.google.protobuf.Empty;
1414
import com.oracle.coherence.common.base.Classes;
1515
import com.oracle.coherence.common.base.Exceptions;
16+
import com.oracle.coherence.common.base.Logger;
1617
import com.oracle.coherence.grpc.AddIndexRequest;
1718
import com.oracle.coherence.grpc.AggregateRequest;
1819
import com.oracle.coherence.grpc.BinaryHelper;
@@ -232,24 +233,14 @@ public void destroy(DestroyRequest request, StreamObserver<Empty> observer)
232233
.asRuntimeException();
233234
}
234235

235-
ConfigurableCacheFactory ccf = getCCF(request.getScope());
236-
NamedCache<Binary, Binary> cachePassThru = ccf.ensureCache(sCacheName, NullImplementation.getClassLoader());
237-
NamedCache<Binary, Binary> cache = ccf.ensureCache(sCacheName, Classes.getContextClassLoader());
238-
// we get caches via the CCF, so we must destroy them that way too
239-
ccf.destroyCache(cachePassThru);
240-
try
241-
{
242-
ccf.destroyCache(cache);
243-
}
244-
catch (Exception ignored)
245-
{
246-
// We may get an exception if destroying the first pass-thru cache also destroys the plain cache.
247-
// We can just ignore it.
248-
}
236+
ConfigurableCacheFactory ccf = getCCF(request.getScope());
237+
NamedCache<Binary, Binary> cache = ccf.ensureCache(sCacheName, null);
238+
cache.destroy();
249239
handleUnary(Empty.getDefaultInstance(), null, safeObserver);
250240
}
251241
catch (Throwable t)
252242
{
243+
Logger.err(t);
253244
handleUnary(Empty.getDefaultInstance(), t, safeObserver);
254245
}
255246
}

prj/coherence-grpc-proxy-common/src/main/java/com/oracle/coherence/grpc/proxy/common/MapListenerProxy.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,21 @@ public MapListenerProxy(NamedCacheService service, StreamObserver<MapListenerRes
9393
@Override
9494
public void onNext(MapListenerRequest request)
9595
{
96+
if (m_fCompleted)
97+
{
98+
throw Status.FAILED_PRECONDITION
99+
.withDescription("Received message after completion")
100+
.asRuntimeException();
101+
}
96102
f_lock.lock();
97103
try
98104
{
105+
if (m_fCompleted)
106+
{
107+
throw Status.FAILED_PRECONDITION
108+
.withDescription("Received message after completion")
109+
.asRuntimeException();
110+
}
99111
if (m_holder == null)
100112
{
101113
m_holder = f_service.createRequestHolder(request,
@@ -189,6 +201,8 @@ public void onError(Throwable throwable)
189201
{
190202
// ignored - we already have errors.
191203
}
204+
m_fCompleted = true;
205+
m_holder = null;
192206
}
193207
finally
194208
{

prj/test/functional/grpc-proxy-netty/src/main/java/netty/grpc/proxy/NamedCacheServiceImplTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ void setupEach()
170170
m_testAsyncCache = testCache.async();
171171

172172
m_testCCF = mock(ConfigurableCacheFactory.class);
173+
when(m_testCCF.ensureCache(eq(TEST_CACHE_NAME), any())).thenReturn(testCache);
173174
when(m_testCCF.ensureCache(eq(TEST_CACHE_NAME), any(ClassLoader.class))).thenReturn(testCache);
174175
when(m_testCCF.getScopeName()).thenReturn(GrpcDependencies.DEFAULT_SCOPE);
175176

@@ -758,7 +759,10 @@ public void shouldNotExecuteDestroyWithoutCacheName() throws Exception
758759
@Test
759760
public void shouldHandleDestroyError() throws Exception
760761
{
762+
NamedCache cache = mock(NamedCache.class);
763+
when(m_testAsyncCache.getNamedCache()).thenReturn(cache);
761764
doThrow(ERROR).when(m_testCCF).destroyCache(any(NamedCache.class));
765+
doThrow(ERROR).when(cache).destroy();
762766

763767
TestStreamObserver<Empty> observer = new TestStreamObserver<>();
764768
NamedCacheService service = s_serviceProvider.getService(m_dependencies);

prj/test/functional/queues/src/main/java/queues/AbstractCollectionTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package queues;
99

10+
import com.oracle.bedrock.testsupport.deferred.Eventually;
1011
import com.tangosol.io.DefaultSerializer;
1112
import com.tangosol.io.Serializer;
1213
import com.tangosol.io.pof.ConfigurablePofContext;
@@ -147,7 +148,9 @@ public void shouldGetNewInstanceOfDestroyedQueue()
147148
{
148149
String sName = getNewName();
149150
NC col1 = getNamedCollection(sName);
150-
col1.destroy();
151+
assertThat(col1.isActive(), is(true));
152+
getSession().destroy(col1);
153+
assertThat(col1.isDestroyed(), is(true));
151154
NC col2 = getNamedCollection(sName);
152155
assertThat(col2, is(not(sameInstance(col1))));
153156
}

0 commit comments

Comments
 (0)