Project

General

Profile

Actions

Defect #7857

closed

A NoMethodError occurred in account#login

Added by Dmitry Salashnik about 13 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Rails support
Target version:
-
Start date:
2011-03-14
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

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

Crash_mongrel_loggedin.png (157 KB) Crash_mongrel_loggedin.png Crash_mongrel_loggedin Anthony Meugui, 2011-04-23 23:23
rails_6440_patch.rb (313 Bytes) rails_6440_patch.rb Dmitry Salashnik, 2011-06-14 08:08

Related issues

Related to Redmine - Defect #8473: OpenID authentication fails on redmine 1.2.0Closed2011-05-31

Actions
Has duplicate Redmine - Defect #8190: login failed with blank pageClosed2011-04-19

Actions
Has duplicate Redmine - Defect #8475: Login to Redmine 1.2.0Closed2011-05-31

Actions
Has duplicate Redmine - Defect #9562: Cannot login to my Redmine installationClosed2011-11-13

Actions
Actions #1

Updated by Etienne Massip about 13 years ago

  • Category set to Rails support
  • Affected version (unused) set to devel
Actions #2

Updated by Jean-Philippe Lang about 13 years ago

Is there a way to reproduce this error?

Actions #3

Updated by Dmitry Salashnik about 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...

Actions #4

Updated by Etienne Massip about 13 years ago

Got this too, but didn't try to reproduce it :/

Actions #5

Updated by Anthony Meugui almost 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.

Actions #6

Updated by Etienne Massip almost 13 years ago

The redirect issue is a separate one, see #7688.

Actions #7

Updated by Anthony Meugui almost 13 years ago

Indeed, the fix "mongrel.rb" provided in #7688 solve my problem.

Actions #8

Updated by Paul Stevens almost 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).

Actions #9

Updated by Jean-Baptiste Barth almost 13 years ago

Paul: can you read SubmittingBugs and provide the requested informations ? Thanks

Actions #10

Updated by Etienne Massip almost 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.

Actions #11

Updated by Dmitry Salashnik almost 13 years ago

for solving my problem i put rails_6440_patch.rb to config\initializers folder and my problem is gone...

Actions #12

Updated by Chris Darts almost 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.

Actions #13

Updated by Alfredo Bonilla almost 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!!):

Thx in advance

Actions #14

Updated by Etienne Massip almost 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
Actions #15

Updated by Alfredo Bonilla almost 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. :)

Actions #16

Updated by Andrey Murashkin over 12 years ago

Got error about method `destroy' for {}:Hash
Cant start redmine with rails_6440_patch.rb
Re-install does not help.

Actions #17

Updated by Etienne Massip over 12 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.

Actions #18

Updated by Etienne Massip over 12 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.

Actions #19

Updated by Jonas Fietz over 12 years ago

Could you update the RedmineInstall page accordingly, please? I seem to be missing the required permissions.

Actions #20

Updated by Etienne Massip over 12 years ago

I did some time ago, check RedmineInstall.

Actions #21

Updated by Terence Mill over 12 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).

Actions #22

Updated by Terence Mill over 12 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).

Actions #23

Updated by Paul Stevens over 12 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?

Actions #24

Updated by Paul Stevens over 12 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
Also
  • "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.

Actions #25

Updated by Robert Hailey over 12 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.

Actions #26

Updated by Paul Stevens over 12 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.

Actions #27

Updated by Simen Endsjø over 12 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?

Actions #28

Updated by Simen Endsjø over 12 years ago

Oh, and script/server works..

Actions #29

Updated by Etienne Massip over 11 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

Closed as an old Mongrel issue.

Actions

Also available in: Atom PDF