Skip to content

Upgrade to ehCache 2.10.9.2 - #8051

Merged
labkey-tchad merged 4 commits into
developfrom
fb_ehCacheUpgrade
Sep 17, 2026
Merged

labkey-tchad merged 4 commits into
developfrom
fb_ehCacheUpgrade

Conversation

@labkey-tchad

@labkey-tchad labkey-tchad commented Sep 15, 2026

Copy link
Copy Markdown
Member

Rationale

After upgrading ehCache, TargetedMSSkydTextIdTest started encountering errors in PrecursorChromatogramChartAction. ehCache version 2.6.11 seems to be more strict about having serializable cache keys. Making LibrarySpectrumMatchGetter.PrecursorKey explicitly serializable fixes the error but there's a good chance we have other unserializable cache keys (e.g. org.labkey.api.data.SqlExecutingSelector.LargeResultWarning).
The latest version of ehCache's 2.x line looks to have fixed MemoryStore.evict to not impose this serializability restriction on cache keys.

Stacktrace

net.sf.ehcache.CacheException: The key org.labkey.targetedms.view.spectrum.LibrarySpectrumMatchGetter$PrecursorKey@dad1e39e is not Serializable. Consider using Element.getObjectKey()
	at net.sf.ehcache.Element.getKey(Element.java:256)
	at net.sf.ehcache.store.MemoryStore.evict(MemoryStore.java:853)
	at net.sf.ehcache.store.NotifyingMemoryStore.evict(NotifyingMemoryStore.java:60)
	at net.sf.ehcache.store.MemoryStore.removeElementChosenByEvictionPolicy(MemoryStore.java:596)
	at net.sf.ehcache.store.MemoryStore.checkCapacity(MemoryStore.java:562)
	at net.sf.ehcache.store.MemoryStore.put(MemoryStore.java:262)
	at net.sf.ehcache.store.FrontEndCacheTier.put(FrontEndCacheTier.java:267)
	at net.sf.ehcache.Cache.putInternal(Cache.java:1455)
	at net.sf.ehcache.Cache.put(Cache.java:1383)
	at net.sf.ehcache.Cache.put(Cache.java:1348)
	at org.labkey.api.cache.ehcache.EhSimpleCache.put(EhSimpleCache.java:48)
	at org.labkey.api.cache.CacheWrapper.put(CacheWrapper.java:65)
	at org.labkey.api.cache.BlockingCache.get(BlockingCache.java:114)
	at org.labkey.api.cache.BlockingCache.get(BlockingCache.java:90)
	at org.labkey.targetedms.view.spectrum.LibrarySpectrumMatchGetter.getPeptideIdRts(LibrarySpectrumMatchGetter.java:302)
	at org.labkey.targetedms.chart.ChromatogramDataset$PrecursorDataset.getPeptideIdRetentionTimes(ChromatogramDataset.java:917)
	at org.labkey.targetedms.chart.ChromatogramDataset$PrecursorDataset.build(ChromatogramDataset.java:892)
	at org.labkey.targetedms.chart.ChromatogramChartMaker.make(ChromatogramChartMaker.java:91)
	at org.labkey.targetedms.chart.ChromatogramChartMaker.make(ChromatogramChartMaker.java:86)
	at org.labkey.targetedms.chart.ChromatogramChartMakerFactory.createPrecursorChromChart(ChromatogramChartMakerFactory.java:91)
	at org.labkey.targetedms.TargetedMSController$PrecursorChromatogramChartAction.export(TargetedMSController.java:2131)
	at org.labkey.targetedms.TargetedMSController$PrecursorChromatogramChartAction.export(TargetedMSController.java:2106)

The newer version of ehCache seems to have made their CacheManager threadsafe, making our SafeCacheManager unnecessary.
The cache leak detection in our EhCacheProvider leverages classes and fields that no longer exist. Probably safe to remove the reflection-base monitoring.

Related Pull Requests

Changes

  • Upgrade to ehCache 2.10.9.2
  • Update EhSimpleCache to work with ehCache API changes
  • Remove ehCache synchronization workaround: SafeCacheManager
  • Remove reflection-base cache leak detection (CacheRejoinAction no longer exists)

Tasks

  • Claude Code Review
  • Manual Testing
  • Test Automation
  • Verify Fix

@labkey-adam

Copy link
Copy Markdown
Contributor

Note: There is a newer, 3.x version that continues to be maintained, see:

I'm fine taking this intermediate step (upgrading to the latest 2.x version). We should run many test suites on the change. Previous upgrades have caused problems, which is why we've stuck with an old version.

@labkey-tchad
labkey-tchad merged commit 41e6412 into develop Sep 17, 2026
17 of 19 checks passed
@labkey-tchad
labkey-tchad deleted the fb_ehCacheUpgrade branch September 17, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants