From 832696c08b9e9599487d212d6831b57c7ad66d9b Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Sat, 31 Oct 2026 10:42:55 -0700 Subject: [PATCH 1/2] Fix intermittent failure in ContainerManager testMissesNotCachedInTransaction Background search work queued when the test container is created can look up its EntityId after the delete and legitimately cache the miss, so the test now looks up an unused GUID. --- api/src/org/labkey/api/data/ContainerManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/org/labkey/api/data/ContainerManager.java b/api/src/org/labkey/api/data/ContainerManager.java index 66c2049c264..a2effc9bb59 100644 --- a/api/src/org/labkey/api/data/ContainerManager.java +++ b/api/src/org/labkey/api/data/ContainerManager.java @@ -3000,8 +3000,10 @@ public void testMissesNotCachedInTransaction() User user = TestContext.get().getUser(); Container c = createContainer(_testRoot, "missesInTx", user); int rowId = c.getRowId(); - GUID entityId = c.getEntityId(); assertTrue(delete(c, user)); + // Cache a miss using a GUID no one else knows about, not c.getEntityId(). Background search work queued at + // create (e.g., indexer) can look up the deleted container's EntityId and legitimately cache the miss. + GUID entityId = new GUID(); try (DbScope.Transaction tx = CORE.getSchema().getScope().ensureTransaction()) { From 97537b8ddd1268098d39b4fe9983f5ca69336327 Mon Sep 17 00:00:00 2001 From: Adam Rauch Date: Tue, 3 Nov 2026 07:59:25 -0800 Subject: [PATCH 2/2] Use fake RowId as well --- api/src/org/labkey/api/data/ContainerManager.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/api/src/org/labkey/api/data/ContainerManager.java b/api/src/org/labkey/api/data/ContainerManager.java index a2effc9bb59..9e30faa52fc 100644 --- a/api/src/org/labkey/api/data/ContainerManager.java +++ b/api/src/org/labkey/api/data/ContainerManager.java @@ -2997,12 +2997,8 @@ public void testMissesCached() @Test public void testMissesNotCachedInTransaction() { - User user = TestContext.get().getUser(); - Container c = createContainer(_testRoot, "missesInTx", user); - int rowId = c.getRowId(); - assertTrue(delete(c, user)); - // Cache a miss using a GUID no one else knows about, not c.getEntityId(). Background search work queued at - // create (e.g., indexer) can look up the deleted container's EntityId and legitimately cache the miss. + // Made-up ids, since background work (e.g., indexer) can legitimately cache misses for a real deleted container + int rowId = Integer.MIN_VALUE; GUID entityId = new GUID(); try (DbScope.Transaction tx = CORE.getSchema().getScope().ensureTransaction())