Please open an issue and we'll investigate this. It's likely that service
ticket objects are missing the setting that would allow them overflow to
disk.



From: Jaroslav Kacer [mailto:[email protected]]
Sent: Thursday, October 16, 2014 5:43 AM
To: [email protected]
Subject: [cas-user] CAS 4 + EhCache-based ticket cache - Errors when
storing tickets to disk



Hello everyone!



I use CAS 4.0.0 in a cluster of 2 nodes. I configured the ticket registry
using EhCache, as described here:
http://jasig.github.io/cas/4.0.0/installation/Ehcache-Ticket-Registry.html

I have disk overflow set to true:

      <bean id="abstractTicketCache" abstract="true"

            class="org.springframework.cache.ehcache.EhCacheFactoryBean"

            p:cacheManager-ref="cacheManager"

            p:diskExpiryThreadIntervalSeconds="0"

            p:diskPersistent="false"

            p:eternal="false"

            p:maxElementsInMemory="10000"

            p:maxElementsOnDisk="20000"

            p:memoryStoreEvictionPolicy="LRU"

            p:overflowToDisk="true"

            p:bootstrapCacheLoader-ref="ticketCacheBootstrapCacheLoader"
/>

      <bean id="serviceTicketsCache"

            class="org.springframework.cache.ehcache.EhCacheFactoryBean"

            parent="abstractTicketCache"

            p:cacheName="cas_st"

            p:timeToIdle="0"

            p:timeToLive="300"


p:cacheEventListeners-ref="serviceTicketRMISynchronousCacheReplicator" />





My problem is that from time to time, I get an error when the ticket
registry decides to save tickets (STs or TGTs) to disk. An exception is
logged in the log, saying that net.sf.ehcache.Cache is not serializable
(which is true). Here is an example of the exception:



2014-10-09 10:18:59,266 ERROR
[net.sf.ehcache.store.disk.DiskStorageFactory] - <Disk Write of
ST-18-sE417I7BTdfhABdhRMNQ-idc-cas-4 failed: >

java.io.NotSerializableException: net.sf.ehcache.Cache

        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)

        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528
)

        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)

        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:141
6)

        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)

        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528
)

        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)

        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:141
6)

        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)

        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528
)

        at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:438)

        at net.sf.ehcache.Element.writeObject(Element.java:851)

        at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
pl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:601)

        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)

        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)

        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:141
6)

        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)

        at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)

        at
net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryE
fficientByteArrayOutputStream.java:97)

        at
net.sf.ehcache.store.disk.DiskStorageFactory.serializeElement(DiskStorageF
actory.java:399)

        at
net.sf.ehcache.store.disk.DiskStorageFactory.write(DiskStorageFactory.java
:381)

        at
net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call(DiskStorag
eFactory.java:473)

        at
net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(
DiskStorageFactory.java:1067)

        at
net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(
DiskStorageFactory.java:1051)

        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

        at java.util.concurrent.FutureTask.run(FutureTask.java:166)

        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.acces
s$201(ScheduledThreadPoolExecutor.java:178)

        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(S
cheduledThreadPoolExecutor.java:292)

        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1145)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java
:615)

        at java.lang.Thread.run(Thread.java:722)



Has anybody experienced a similar error? I searched on the Internet but
did not find any relevant report.



It seems that CAS tickets indirectly reference the cache which causes Java
runtime to try to serialize it too. Unfortunately I haven't found the path
from tickets to caches yet.



A quick workaround would be to set disk overflow to false, I believe, but
I'd like to keep it switched on to be able handle bigger loads.



Any help or hint would be much appreciated!



Best Regards,

  Jarda





--------------------------------------------------

Jaroslav Kačer

IDC | Application Developer

Phone: +420723914123

Mail: [email protected] <mailto:[email protected]>





Join IDC beginning October 29, 2014 through January 29, 2015 for:
IDC's 2015 Predictions and IDC FutureScapes Web Conference Series
Accelerating Innovation on the 3rd Platform
Register Now
<http://event.on24.com/r.htm?e=861361&s=1&k=223AFC21785863D975C9D80CEE2A97
C2>




--
You are currently subscribed to [email protected]
<mailto:[email protected]>  as: [email protected]
<mailto:[email protected]>
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to