mumoshu/play2-memcached

Exception when using play-authenticate & memcached (play2.4)

tuanvm opened this issue · 2 comments

Hello,

I used memcached with play-authenticate instead of default Ehcache, and i've got an exception when trying to login with Twitter provider.
Here are the exception log:

2015-08-20T08:03:20.909420+00:00 app[web.2]: [error] m.plugin - An error has occured while getting the value from memcached. ct=Any
2015-08-20T08:03:20.909428+00:00 app[web.2]:    at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909426+00:00 app[web.2]: java.util.concurrent.ExecutionException: java.io.InvalidClassException: com.feth.play.module.pa.providers.oauth1.OAuth1AuthProvider$SerializableRequestToken; no valid constructor
2015-08-20T08:03:20.909429+00:00 app[web.2]:    at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909432+00:00 app[web.2]:    at net.spy.memcached.transcoders.TranscodeService$Task.get(TranscodeService.java:97) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909438+00:00 app[web.2]:    at play.cache.DefaultCacheApi.get(DefaultCacheApi.java:25) [com.typesafe.play.play-cache_2.11-2.4.0.jar:2.4.0]
2015-08-20T08:03:20.909434+00:00 app[web.2]:    at net.spy.memcached.internal.GetFuture.get(GetFuture.java:63) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909439+00:00 app[web.2]:    at play.cache.Cache.get(Cache.java:23) [com.typesafe.play.play-cache_2.11-2.4.0.jar:2.4.0]
2015-08-20T08:03:20.909445+00:00 app[web.2]:    at com.feth.play.module.pa.providers.oauth1.OAuth1AuthProvider.authenticate(OAuth1AuthProvider.java:119) [com.feth.play-authenticate_2.11-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
2015-08-20T08:03:20.909446+00:00 app[web.2]: Caused by: java.io.InvalidClassException: com.feth.play.module.pa.providers.oauth1.OAuth1AuthProvider$SerializableRequestToken; no valid constructor
2015-08-20T08:03:20.909448+00:00 app[web.2]:    at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:150) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909441+00:00 app[web.2]:    at com.feth.play.module.pa.PlayAuthenticate.getFromCache(PlayAuthenticate.java:294) [com.feth.play-authenticate_2.11-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
2015-08-20T08:03:20.909454+00:00 app[web.2]:    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909443+00:00 app[web.2]:    at com.feth.play.module.pa.PlayAuthenticate.removeFromCache(PlayAuthenticate.java:280) [com.feth.play-authenticate_2.11-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
2015-08-20T08:03:20.909436+00:00 app[web.2]:    at com.github.mumoshu.play2.memcached.MemcachedCacheApi.get(MemcachedCacheApi.scala:42) ~[com.github.mumoshu.play2-memcached-play24_2.11-0.7.0.jar:0.7.0]
2015-08-20T08:03:20.909451+00:00 app[web.2]:    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909455+00:00 app[web.2]:    at com.github.mumoshu.play2.memcached.CustomSerializing.deserialize(CustomSerializing.scala:16) ~[com.github.mumoshu.play2-memcached-play24_2.11-0.7.0.jar:0.7.0]
2015-08-20T08:03:20.909458+00:00 app[web.2]:    at net.spy.memcached.transcoders.SerializingTranscoder.decode(SerializingTranscoder.java:88) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909449+00:00 app[web.2]:    at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:768) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909452+00:00 app[web.2]:    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909461+00:00 app[web.2]:    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909462+00:00 app[web.2]:    at net.spy.memcached.transcoders.TranscodeService$Task.run(TranscodeService.java:110) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909459+00:00 app[web.2]:    at net.spy.memcached.transcoders.TranscodeService$1.call(TranscodeService.java:63) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]

Do you have any idea about this issue? Login with other providers are still working fine, just with twitter provider, i got this issue when getting value from Cache.

Thanks.

@tuanvm Hi, thanks for using play2-memcached :)

Unfortunately, I can't figure out what is happening from the log.
Could you mind providing me an example app to reproduce the issue?

@mumoshu Thank you so much,
I created a sample app there https://github.com/tuanvm/play-authenticate-memcached-exception
It's just an exist example in play-authenticate repos, just change default ehcache to memcached.
Other providers as facebook still working fine, just exception with twitter only.
Thanks.