question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.nio.channels.ClosedChannelException

See original GitHub issue

EhCache 3.8.1

Multi-thread environment.

Stacktrace:

java.lang.RuntimeException:  java.nio.channels.ClosedChannelException
	at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine$FileChunk$1.setLong(FileBackedStorageEngine.java:675) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.offheap.LazyOffHeapValueHolder.writeBack(LazyOffHeapValueHolder.java:82) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.offheap.AbstractOffHeapStore.lambda$flush$16(AbstractOffHeapStore.java:869) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.disk.EhcachePersistentConcurrentOffHeapClockCache.lambda$computeIfPinned$3(EhcachePersistentConcurrentOffHeapClockCache.java:213) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.shadow.org.terracotta.offheapstore.OffHeapHashMap.computeIfPresentWithMetadata(OffHeapHashMap.java:2108) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.shadow.org.terracotta.offheapstore.AbstractLockedOffHeapHashMap.computeIfPresentWithMetadata(AbstractLockedOffHeapHashMap.java:542) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.shadow.org.terracotta.offheapstore.concurrent.AbstractConcurrentOffHeapMap.computeIfPresentWithMetadata(AbstractConcurrentOffHeapMap.java:781) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.disk.EhcachePersistentConcurrentOffHeapClockCache.computeIfPinned(EhcachePersistentConcurrentOffHeapClockCache.java:210) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.offheap.AbstractOffHeapStore.flush(AbstractOffHeapStore.java:862) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.OnHeapStore.lambda$setInvalidationListener$19(OnHeapStore.java:956) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.OnHeapStore.lambda$evict$28(OnHeapStore.java:1594) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.concurrent.ConcurrentHashMap.computeIfPresent(ConcurrentHashMap.java:1848) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.SimpleBackend.computeIfPresent(SimpleBackend.java:130) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.OnHeapStore.evict(OnHeapStore.java:1589) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.OnHeapStore.enforceCapacity(OnHeapStore.java:1556) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.OnHeapStore.resolveFault(OnHeapStore.java:787) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.heap.OnHeapStore.getOrComputeIfAbsent(OnHeapStore.java:707) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.impl.internal.store.tiering.TieredStore.get(TieredStore.java:87) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.core.Ehcache.doGet(Ehcache.java:90) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.core.EhcacheBase.get(EhcacheBase.java:127) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.jsr107.Eh107Cache.get_aroundBody0(Eh107Cache.java:90) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.jsr107.Eh107Cache$AjcClosure1.run(Eh107Cache.java:1) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
...
Caused by: java.nio.channels.ClosedChannelException: null
	at java.base/sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:150) ~[na:na]
	at java.base/sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:830) ~[na:na]
	at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine.writeBufferToChannel(FileBackedStorageEngine.java:393) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine.writeLongToChannel(FileBackedStorageEngine.java:388) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine.access$700(FileBackedStorageEngine.java:60) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine$FileChunk$1.setLong(FileBackedStorageEngine.java:673) ~[ehcache-3.8.1.jar:3.8.1 a19322e8d4b3f7157e878112c2afc0b6e3090fdd]
	... 169 common frames omitted

Related stackoverflow: https://stackoverflow.com/questions/56373698/closedchannelexception-exception-when-using-ehcache

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisdenniscommented, Aug 2, 2021

If you want to get faster access you can just pull the source and build it yourself. There is no need to wait for a central build/release to get access to bug fixes for an open source project. That said there is an Ehcache release in process at the moment on the 3.9.x line which should include this fix. I will endeavor to get the housekeeping back up to date on Github and the ehcache.org website, limited time and multiple responsibilities sometimes mean that things like that often get skipped over.

Chris

From: cdalexndr @.> Date: Wednesday, July 21, 2021 at 8:57 AM To: ehcache/ehcache3 @.> Cc: Chris Dennis @.>, Comment @.> Subject: Re: [ehcache/ehcache3] java.nio.channels.ClosedChannelException (#2908)

Fast fix, slow release… getting java.nio.channels.ClosedChannelException in production is not fun. Shouldn’t you release a hot patch for this?

Also note that github’s latest release tag is on an old 3.8.1 version (24 sep 2019).

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ehcache/ehcache3/issues/2908#issuecomment-884168229, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAHI7W4MIYOVWNMTCPM6VS3TY273FANCNFSM45UFYVUA.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.nio.channels.ClosedChannelException - Stack Overflow
You have closed the channel and are still trying to use it. There are several issues with your code. First, your test for...
Read more >
ClosedChannelException (Java Platform SE 7 )
Checked exception thrown when an attempt is made to invoke or complete an I/O operation upon channel that is closed, or at least...
Read more >
ClosedChannelException in Java with Examples
The class ClosedChannelException is invoked when an I/O operation is attempted on a closed channel or a channel that is closed to the ......
Read more >
java.nio.channels.ClosedChannelException : r/RLCraft - Reddit
java.nio.channels.ClosedChannelException. I am so sick of seeing this error. It pops up EVRRY single time I'm trying to create a new world.
Read more >
ClosedChannelException Class (Java.Nio.Channels)
Checked exception thrown when an attempt is made to invoke or complete an I/O operation upon channel that is closed, or at least ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found