{"action":"created","issue":{"url":"https://api.github.com/repos/tdiary/tdiary-core/issues/470","labels_url":"https://api.github.com/repos/tdiary/tdiary-core/issues/470/labels{/name}","comments_url":"https://api.github.com/repos/tdiary/tdiary-core/issues/470/comments","events_url":"https://api.github.com/repos/tdiary/tdiary-core/issues/470/events","html_url":"https://github.com/tdiary/tdiary-core/issues/470","id":53365701,"number":470,"title":"unicornでworker_processesが2以上だとomniauthに失敗する","user":{"login":"Nyoho","id":118150,"avatar_url":"https://avatars.githubusercontent.com/u/118150?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyoho","html_url":"https://github.com/Nyoho","followers_url":"https://api.github.com/users/Nyoho/followers","following_url":"https://api.github.com/users/Nyoho/following{/other_user}","gists_url":"https://api.github.com/users/Nyoho/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyoho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyoho/subscriptions","organizations_url":"https://api.github.com/users/Nyoho/orgs","repos_url":"https://api.github.com/users/Nyoho/repos","events_url":"https://api.github.com/users/Nyoho/events{/privacy}","received_events_url":"https://api.github.com/users/Nyoho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-05T05:33:42Z","updated_at":"2015-01-06T03:17:42Z","closed_at":null,"body":"unicorn で rack アプリとして tDiary を動かし、認証に omniauth を使うようにしようとすると\r\nworker_processes が2以上のときに `OmniAuth::NoSessionError at /auth/twitter/callback` (Session Expired) で認証が失敗します。\r\n\r\n> /Users/nyoho/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/omniauth-oauth-1.0.1/lib/omniauth/strategies/oauth.rb: in callback_phase\r\n>         raise OmniAuth::NoSessionError.new(\"Session Expired\") if session['oauth'].nil?...\r\n\r\nworker_processes が 1 ですと正常に認証に成功します。また、bundle exec tdiary server や bundle exec rackup したときは同じ config.ru で問題なく認証されます。\r\n\r\n上記の失敗する unicorn + worker processes >= 2 場合は、手元でテストプロジェクトを作って実験すると\r\nTDiary::Rack::Auth::OmniAuth::CallbackHandler の call\r\nhttps://github.com/tdiary/tdiary-core/blob/master/lib%2Ftdiary%2Frack%2Fauth%2Fomniauth.rb#L37\r\nを通っていないようでした。\r\nなぜなのかについてはまだよくわかりません。"},"comment":{"url":"https://api.github.com/repos/tdiary/tdiary-core/issues/comments/68820756","html_url":"https://github.com/tdiary/tdiary-core/issues/470#issuecomment-68820756","issue_url":"https://api.github.com/repos/tdiary/tdiary-core/issues/470","id":68820756,"user":{"login":"Nyoho","id":118150,"avatar_url":"https://avatars.githubusercontent.com/u/118150?v=3","gravatar_id":"","url":"https://api.github.com/users/Nyoho","html_url":"https://github.com/Nyoho","followers_url":"https://api.github.com/users/Nyoho/followers","following_url":"https://api.github.com/users/Nyoho/following{/other_user}","gists_url":"https://api.github.com/users/Nyoho/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyoho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyoho/subscriptions","organizations_url":"https://api.github.com/users/Nyoho/orgs","repos_url":"https://api.github.com/users/Nyoho/repos","events_url":"https://api.github.com/users/Nyoho/events{/privacy}","received_events_url":"https://api.github.com/users/Nyoho/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T03:17:42Z","updated_at":"2015-01-06T03:17:42Z","body":"なるほど、原因についてもよくわかりました。解説いただきありがとうございました!\r\nMemcacheを使う方法などを検討してみます。"}}