我有部署在Heroku上的Play 2.2应用程序。当我只有1个测功机时它工作得很好。如果我添加至少一个动态码,则会出现非常烦人的问题:随机,不定时与Twitter或Facebook登录失败。Heroku上的SecureSocial登录问题使用#个dynos> 1
我检查了日志,它看起来像问题是双来自Twitter的请求。
2014-11-21T16:46:54.880238+00:00 heroku[router]: at=info method=GET path="/authenticate/twitter" host=teller.happymelly.com request_id=2c9e9ce7-8055-491d-841a-919a560461ef fwd="95.28.27.42" dyno=web.1 connect=1ms service=299ms status=303 bytes=398
2014-11-21T16:46:56.245743+00:00 heroku[router]: at=info method=GET path="/authenticate/twitter?oauth_token=XXXX&oauth_verifier=XXXX" host=teller.happymelly.com request_id=fc7966a3-082f-418b-a424-ff4868cbf175 fwd="95.28.27.42" dyno=web.1 connect=1ms service=20ms status=301 bytes=227
2014-11-21T16:46:56.404711+00:00 heroku[router]: at=info method=GET path="/authenticate/twitter?oauth_token=XXXX&oauth_verifier=XXXX" host=teller.happymelly.com request_id=50f15633-fd9d-431b-a132-403821767495 fwd="95.28.27.42" dyno=web.2 connect=1ms service=9ms status=303 bytes=190
2014-11-21T16:46:56.400002+00:00 app[web.2]: [error] application - Unable to log user in. An exception was thrown
2014-11-21T16:46:56.400007+00:00 app[web.2]: securesocial.core.AuthenticationException: null
2014-11-21T16:46:56.400010+00:00 app[web.2]: at securesocial.core.OAuth1Provider$$anonfun$doAuth$1$$anonfun$apply$8.apply(OAuth1Provider.scala:84) ~[ws.securesocial.securesocial_2.10-2.1.3.jar:2.1.3]
2014-11-21T16:46:56.400012+00:00 app[web.2]: at securesocial.core.OAuth1Provider$$anonfun$doAuth$1$$anonfun$apply$8.apply(OAuth1Provider.scala:84) ~[ws.securesocial.securesocial_2.10-2.1.3.jar:2.1.3]
2014-11-21T16:46:56.400014+00:00 app[web.2]: at scala.Option.getOrElse(Option.scala:120) [org.scala-lang.scala-library-2.10.3.jar:na]
2014-11-21T16:46:56.400016+00:00 app[web.2]: at securesocial.core.OAuth1Provider$$anonfun$doAuth$1.apply(OAuth1Provider.scala:84) ~[ws.securesocial.securesocial_2.10-2.1.3.jar:2.1.3]
2014-11-21T16:46:56.400018+00:00 app[web.2]: at securesocial.core.OAuth1Provider$$anonfun$doAuth$1.apply(OAuth1Provider.scala:62) ~[ws.securesocial.securesocial_2.10-2.1.3.jar:2.1.3]
2014-11-21T16:46:56.400020+00:00 app[web.2]: at scala.Option.map(Option.scala:145) [org.scala-lang.scala-library-2.10.3.jar:na]
该模式是稳定的。只要有来自Twitter的一个请求,一切正常。
2014-11-21T16:48:41.633181+00:00 heroku[router]: at=info method=GET path="/authenticate/twitter" host=teller.happymelly.com request_id=d3bdb519-8b4e-450e-a650-3ea5a840b90f fwd="95.28.27.42" dyno=web.2 connect=1ms service=679ms status=303 bytes=398
2014-11-21T16:48:42.629072+00:00 heroku[router]: at=info method=GET path="/authenticate/twitter?oauth_token=XXX&oauth_verifier=XXX" host=teller.happymelly.com request_id=740ac75a-1d37-4587-9628-50e703d7ad31 fwd="95.28.27.42" dyno=web.1 connect=1ms service=6ms status=301 bytes=227
2014-11-21T16:48:43.315185+00:00 app[web.2]: [debug] application - GET https://api.twitter.com/1.1/account/settings.json
2014-11-21T16:48:43.351654+00:00 app[web.2]: [debug] application - 200 OK
有没有人遇到过这样的问题?任何建议我应该挖掘什么方向?
这非常烦人,因为有时访客必须点击“登录”按钮3-4次。任何帮助非常感谢。
无码没有人能够帮助你。 – Ryan 2014-11-21 20:55:44
您是否为应用程序设置了分布式缓存实例?社交提供者缓存一些认证工件。所以你应该在集群环境中使用分布式缓存。 – akkie 2014-11-22 06:26:31
@akkie我建立了一个分布式缓存,但只适用于Secure Social(通过它的插件)。正如Julien在下面提到的,我可能需要为整个应用程序设置分布式缓存。 – sery0ga 2014-11-22 14:29:50