[cas-user] CAS 4 + EhCache-based ticket cache - Errors when storing tickets to disk

58 views
Skip to first unread message

Jaroslav Kacer

unread,
Oct 16, 2014, 8:43:13 AM10/16/14
to cas-...@lists.jasig.org

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:1416)

        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:1416)

        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(DelegatingMethodAccessorImpl.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:1416)

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

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

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

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

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

        at net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call(DiskStorageFactory.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.access$201(ScheduledThreadPoolExecutor.java:178)

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.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: jka...@idc.com

 



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


-- 
You are currently subscribed to cas-...@lists.jasig.org as: jasig-cas-user...@googlegroups.com
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user

Misagh Moayyed

unread,
Oct 16, 2014, 4:14:30 PM10/16/14
to cas-...@lists.jasig.org

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.

You are currently subscribed to cas-...@lists.jasig.org as: mmoa...@unicon.net
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user

Jaroslav Kacer

unread,
Oct 17, 2014, 4:27:14 AM10/17/14
to cas-...@lists.jasig.org

Thank you for your answer, Misagh.

Here is the issue: https://issues.jasig.org/browse/CAS-1486

 

Best Regards,

   Jarda

You are currently subscribed to cas-...@lists.jasig.org as: jka...@idc.com
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user

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


-- 
You are currently subscribed to cas-...@lists.jasig.org as: jasig-cas-user...@googlegroups.com

Misagh Moayyed

unread,
Oct 17, 2014, 4:37:18 AM10/17/14
to cas-...@lists.jasig.org

I hate to ask you this, but would you be kind enough to submit the issue on github instead? JIRA is no longer relevant for the CAS server project.

Jaroslav Kacer

unread,
Oct 17, 2014, 4:45:07 AM10/17/14
to cas-...@lists.jasig.org

Sure, here it is:
https://github.com/Jasig/cas/issues/724

 

I wondered why there were only 4 open tickets in Jira J

 

Thank you very much,

Reply all
Reply to author
Forward
0 new messages