Defect #7857
closedA NoMethodError occurred in account#login
0%
Description
sometimes in logs appears:
A NoMethodError occurred in account#login: undefined method `destroy' for {}:Hash /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/request.rb:449:in `reset_session'
may be it something linked to:
https://gist.github.com/robdimarco/rails/commit/8ca8ac379d8a2d10f39fdef67db545732fe95309
Files
Related issues
Updated by Etienne Massip over 13 years ago
- Category set to Rails support
- Affected version (unused) set to devel
Yes, it is.
Original link to the Rails 2.3.11 issue : https://rails.lighthouseapp.com/projects/8994/tickets/6440-session-reset-undefined-method-destroy-for-hash
Updated by Jean-Philippe Lang over 13 years ago
Is there a way to reproduce this error?
Updated by Dmitry Salashnik over 13 years ago
Jean-Philippe Lang wrote:
Is there a way to reproduce this error?
Really i don't know how reporoduce, but i use Exception Handler Plugin and my e-mail have lot messages with this error
And some users reports me about this.
I think this error appears when user login after his session expired...
Updated by Etienne Massip over 13 years ago
Got this too, but didn't try to reproduce it :/
Updated by Anthony Meugui over 13 years ago
I've got the same issue when I try to use Mongrel (1.1.5) with WebRick no problem. (I use trunk version R5543 with a completly clean installation (no plugins))
For test I've launched Webrick and I logged in with Google Chrome. I stopped WebRick then I launched Mongrel, with google chrome (because I've keep my browser session logged in so NO needed to logged in again) no problem I can view all redmine pages (issue, activity, settings) but if I try to logged OUT then I've got a basic page with only "You are being redirected." if i go back to Redmine again I'm NOT logged out...
With IE browser, of course, I have to logged in, when I dit it, Redmine crash.
Crash Logs : See my attached screenshot
I tried to clear browser cache, rake tmp:sessions:clear, rake tmp:cache:clear, rake generate_session_store but it's changed nothing.
My configuration :
OS : Windows 7
Ruby : 1.8.7
MySQL : 5.5
gem list --local
actionmailer (2.3.11, 2.3.8, 2.3.5)
actionpack (2.3.11, 2.3.8, 2.3.5)
activerecord (2.3.11, 2.3.8, 2.3.5)
activeresource (2.3.11, 2.3.8, 2.3.5)
activesupport (2.3.11, 2.3.8, 2.3.5)
cgi_multipart_eof_fix (2.5.0)
gem_plugin (0.2.3)
i18n (0.4.2)
mongrel (1.1.5 x86-mingw32)
mongrel_cluster (1.0.5)
mysql (2.8.1 x86-mingw32)
rack (1.1.0, 1.0.1)
rails (2.3.11, 2.3.8, 2.3.5)
rake (0.8.7)
ruby-ole (1.2.10.1)
spreadsheet (0.6.5.2, 0.6.4.1)
I'm a newbie, perhaps I've not correctly set up Mongrel... Tell me if you need more info.
Updated by Etienne Massip over 13 years ago
The redirect issue is a separate one, see #7688.
Updated by Anthony Meugui over 13 years ago
Indeed, the fix "mongrel.rb" provided in #7688 solve my problem.
Updated by Paul Stevens over 13 years ago
Just tried to upgrade from 1.1.2 to 1.2.0 and had the same error message as some of the duplicates:
NoMethodError (undefined method `destroy' for {}:Hash): app/controllers/application_controller.rb:89:in `logged_user=' app/controllers/account_controller.rb:203:in `successful_authentication' app/controllers/account_controller.rb:155:in `password_authentication' app/controllers/account_controller.rb:142:in `authenticate_user' app/controllers/account_controller.rb:30:in `login' passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' ..
I am not using Mongrel nor Webrick but rather Phusion Passenger (mod_rails).
Updated by Jean-Baptiste Barth over 13 years ago
Paul: can you read SubmittingBugs and provide the requested informations ? Thanks
Updated by Etienne Massip over 13 years ago
This issue goes away with time so should be related to session TTL, try to run rake tmp:sessions:clear
although I know it didn't work last time it was tempted.
Updated by Dmitry Salashnik over 13 years ago
- File rails_6440_patch.rb rails_6440_patch.rb added
for solving my problem i put rails_6440_patch.rb to config\initializers
folder and my problem is gone...
Updated by Chris Darts over 13 years ago
Dmitry Salashnik wrote:
for solving my problem i put rails_6440_patch.rb to
config\initializers
folder and my problem is gone...
I just did the same and it fixed my problem. Thanks Dmitry.
Updated by Alfredo Bonilla over 13 years ago
Hi everybody, we are trying to upgrade to 1.2 and we are having both problems here described... the problem is that after applying what here is detailed... there is no way... problems still remain.
Please, let me know if I'm missing something or doing something wrong!!):
- Copy mongrel.rb (https://gist.github.com/826692), patch_for_mongrel.rb (http://www.redmine.org/attachments/4699/patch_for_mongrel.rb) and rails_6440_patch.rb (http://www.redmine.org/attachments/6146/rails_6440_patch.rb) files in /<my-redmine-path>/config/initializers
Thx in advance
Updated by Etienne Massip over 13 years ago
- mongrel.rb is mandatory to get mongrel 1.1.5 work with RoR 2.3.11. It's the only patch I'm actually running with.
- patch_for_mongrel.rb might be useful for a sub-URL Redmine setup ?
- rails_6440_patch.rb might be useful at start to prevent the hereby discussed issue (maybe only in case of a Redmine upgrade) but can be remove after some time
Updated by Alfredo Bonilla over 13 years ago
Thanks for clarifications. As I commented in http://www.redmine.org/issues/7688, our problem was not having installed the mongrel gems. Once installed, just with mongrel.rb in /config/initializers, everything is working. :)
Updated by Andrey Murashkin about 13 years ago
Got error about method `destroy' for {}:Hash
Cant start redmine with rails_6440_patch.rb
Re-install does not help.
Updated by Etienne Massip about 13 years ago
This issue has been fixed in Rails with 2.3.12 (see https://github.com/rails/rails/commit/8ca8ac379d8a2d10f39fdef67db545732fe95309).
I'll run test suite against Rails 2.3.14 and update the RedmineInstall page accordingly if everything go fine.
Updated by Etienne Massip about 13 years ago
Etienne Massip wrote:
I'll run test suite against Rails 2.3.14 and update the RedmineInstall page accordingly if everything go fine.
Ran smoothly.
Updated by Jonas Fietz about 13 years ago
Could you update the RedmineInstall page accordingly, please? I seem to be missing the required permissions.
Updated by Etienne Massip about 13 years ago
I did some time ago, check RedmineInstall.
Updated by Terence Mill about 13 years ago
Exactly same Here! ::Sessions terminates immidiately with HTML 500
Paul Stevens wrote:
Just tried to upgrade from 1.1.2 to 1.2.0 and had the same error message as some of the duplicates:
NoMethodError (undefined method `destroy' for {}:Hash):
app/controllers/application_controller.rb:89:in `logged_user='
app/controllers/account_controller.rb:203:in `successful_authentication'
app/controllers/account_controller.rb:155:in `password_authentication'
app/controllers/account_controller.rb:142:in `authenticate_user'
app/controllers/account_controller.rb:30:in `login'
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
I am not using Mongrel nor Webrick but rather Phusion Passenger (mod_rails).
Updated by Terence Mill about 13 years ago
Using redmine 1.2.1 with proposed stack from RedmineInstall (Rails 2.3.11, Rack 1.1.1, Ruby 1.8.7) on Apache 2.2.10 and Passenger 3.0.2 on SLES11
Relogin works only if using a new browser window, so big is maybe dependent on browser cookie.
Terence Mill wrote:
Exactly same Here! ::Sessions terminates immidiately with HTML 500
Paul Stevens wrote:
Just tried to upgrade from 1.1.2 to 1.2.0 and had the same error message as some of the duplicates:
NoMethodError (undefined method `destroy' for {}:Hash):
app/controllers/application_controller.rb:89:in `logged_user='
app/controllers/account_controller.rb:203:in `successful_authentication'
app/controllers/account_controller.rb:155:in `password_authentication'
app/controllers/account_controller.rb:142:in `authenticate_user'
app/controllers/account_controller.rb:30:in `login'
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
I am not using Mongrel nor Webrick but rather Phusion Passenger (mod_rails).
Updated by Paul Stevens about 13 years ago
I continously get this error, so do some of my users. This does not happen regularly but usually involves browser restarts or using two computers. Usually it's fixed by going to the top-level of the installation (e.g. www.example.com/redmine instead of www.example.com/redmine/some/wiki/or/issue/page) when it miracously works again. Still, this is extremely annoying and hampers acceptance of Redmine in my organisation (currently ~160 users). I tried the various patches posted here and in the other tickets, e.g. rails_644 patch, updated install page, etc, but nothing helps.
I hope for 1.2.2 to finally fix this ... is there anybody of the core developer team actively working on this?
Updated by Paul Stevens about 13 years ago
Okay, after I just had to convince a customer that we are not total morons for having a software that gives him 500 errors upon clicking on links, let me re-iterate this situation again.
- we are running Redmine version 1.2.1
- mysql 5.1.41
- Apache 2.2.14 on Ubuntu 10.04
- Phusion Passenger / mod_rails 3.0.9
- ruby 1.8.7
- gem list ... local gems:
- actionmailer (2.3.14, 2.3.5)
- actionpack (2.3.14, 2.3.5)
- activemodel (3.1.0)
- activerecord (3.1.0, 2.3.14, 2.3.5)
- activeresource (2.3.14, 2.3.5)
- activesupport (3.1.0, 2.3.14, 2.3.5)
- arel (2.2.1)
- bcrypt-ruby (3.0.1)
- block_helpers (0.3.3)
- builder (3.0.0)
- diff-lcs (1.1.3)
- grit (2.4.1)
- i18n (0.6.0, 0.4.2)
- inifile (0.4.1)
- lockfile (1.4.3)
- mime-types (1.16)
- mini_magick (3.3)
- multi_json (1.0.3)
- mysql (2.8.1)
- net-ssh (2.2.1)
- rack (1.1.1, 1.1.0, 1.0.1)
- rails (2.3.5)
- rake (0.8.7)
- RedCloth (4.2.8)
- rubyzip (0.9.4)
- sqlite-ruby (2.2.3)
- sqlite3 (1.3.3)
- sqlite3-ruby (1.3.3)
- subexec (0.1.0)
- tzinfo (0.3.29)
- RAILS_ENV=production ruby script/about
About your application's environment Ruby version 1.8.7 (x86_64-linux) RubyGems version 1.3.7 Rack version 1.1.1 Rails version 2.3.11 Active Record version 2.3.11 Active Resource version 2.3.11 Action Mailer version 2.3.11 Active Support version 2.3.11 Edge Rails revision unknown Application root /www/redmine-1.2.1 Environment production Database adapter mysql Database schema version 20110511000000
but I had the same issue with the stock Rails install - all users on all operating systems and with all browsers occasionally get the error
Processing AccountController#login (for IP at 2011-11-04 09:02:31) [POST] Parameters: {"back_url"=>"https%3A%2F%2F%2Fredmine%2Fprojects%2importantproject%2Fwiki%2FImportantCustomerInformation", "action"=>"login", "authenticity_token"=>"TGUchphzT5QDK80HxhHGR6VPm1Jf58IseiH7DTzwGho=", "username"=>"customer", "controller"=>"account", "password"=>"[FILTERED]", "login"=>"Login \302\273"} NoMethodError (undefined method `destroy' for {}:Hash): app/controllers/application_controller.rb:92:in `logged_user=' app/controllers/account_controller.rb:203:in `successful_authentication' app/controllers/account_controller.rb:155:in `password_authentication' app/controllers/account_controller.rb:142:in `authenticate_user' app/controllers/account_controller.rb:30:in `login' /usr/lib/ruby/1.8/rack/head.rb:9:in `call'
upon login - this seems to usually happen when the user's session has expired(?) and he e.g. re-opens his browser with the last state or clicks on a link ... i.e. if he is not logged in anymore and goes to a link with a backup_url, e.g. "https://www.example.com/redmine/login?back_url=https%3A%2F%2F%2Fredmine%2Fprojects%2importantproject%2Fwiki%2FImportantCustomerInformation
- logging in on these pages will give error 500 persistently
- problem can be solved by the user going directly to the top-level e.g. https://www.example.com/redmine/
- unfortunately this is not reproducable by opening two tabs with Redmine pages, logging out in one page and hitting Reload in the other
- "rake tmp:sessions:clear" does not solve this problem
- rails_6440_patch.rb does not fix the problem
I am now trying a newer RAILS (2.3.14) version, will let you know how this works out.
Updated by Robert Hailey about 13 years ago
I got this error from my mobile device when a distance from my wifi, so I wonder if it has something to do with changing IP addresses (switching from cellular to wifi). Maybe it tries to reuse the session but a hash includes the ip address... just a guess.
Updated by Paul Stevens about 13 years ago
After updating to Rails 2.3.14 I did not see this problem in the logs anymore. It also seems to not have had any other side-effects.
Updated by Simen Endsjø almost 13 years ago
I'm having the same issue. Followed the install guide (using redmine 1.2.2), and it worked for about a day before this problem.
I've tried rails_6440_patch.rb
, mongrel.rb
and patch_for_mongrel.rb
in all combinations.
Upgrading to rails 2.3.14 didn't help either.
I've spent several hours already trying to get this fixed. Any ideas?
Updated by Etienne Massip about 12 years ago
- Status changed from New to Closed
- Resolution set to Invalid
Closed as an old Mongrel issue.