Project

General

Profile

Actions

Defect #12161

open

Cyclic recursion redirects

Added by Aleksei Motsik about 12 years ago. Updated about 11 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Cant reproduce
Affected version:

Description

Hello

After migrating from 1.3.2 to 2.1.2 I see that problem:
Can't load a page of redmine, because of "Сyclic recursion redirects".

Here is a LOG of attempt right after server start^

Started GET "/projects/igp" for 192.168.5.2 at Thu Oct 18 17:19:07 +0300 2012
Processing by ProjectsController#show as HTML
  Parameters: {"id"=>"igp"}
  Current user: anonymous
Redirected to http://192.168.5.12:3000/login?back_url=http%3A%2F%2F192.168.5.12%3A3000%2Fprojects%2Figp
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 212ms (ActiveRecord: 12.8ms)

Started GET "/login?back_url=http%3A%2F%2F192.168.5.12%3A3000%2Fprojects%2Figp" for 192.168.5.2 at Thu Oct 18 17:19:08 +0300 2012
Processing by AccountController#login as HTML
  Parameters: {"back_url"=>"http://192.168.5.12:3000/projects/igp"}
  Current user: anonymous
Redirected to http://192.168.5.12:3000/login?back_url=http%3A%2F%2F192.168.5.12%3A3000%2Flogin%3Fback_url%3Dhttp%253A%252F%252F192.168.5.12%253A3000%252Fprojects%252Figp
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 6ms (ActiveRecord: 1.0ms)

Started GET "/login?back_url=http%3A%2F%2F192.168.5.12%3A3000%2Flogin%3Fback_url%3Dhttp%253A%252F%252F192.168.5.12%253A3000%252Fprojects%252Figp" for 192.168.5.2 at Thu Oct 18 17:19:08 +0300 2012
Processing by AccountController#login as HTML
  Parameters: {"back_url"=>"http://192.168.5.12:3000/login?back_url=http%3A%2F%2F192.168.5.12%3A3000%2Fprojects%2Figp"}
  Current user: anonymous
Redirected to http://192.168.5.12:3000/login?back_url=http%3A%2F%2F192.168.5.12%3A3000%2Flogin%3Fback_url%3Dhttp%253A%252F%252F192.168.5.12%253A3000%252Flogin%253Fback_url%253Dhttp%25253A%25252F%25252F192.168.5.12%25253A3000%25252Fprojects%25252Figp
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 5ms (ActiveRecord: 0.9ms)

Please help!

Actions #1

Updated by Jean-Philippe Lang about 12 years ago

  • Resolution set to Cant reproduce

Any local changes or plugins ?

Actions #2

Updated by Etienne Massip about 12 years ago

FTR I've seen a similar stack trace in another recent issue but I can't find it back.

Actions #3

Updated by Jean-Philippe Lang about 12 years ago

This stack trace shows that AccountController#login goes through :check_if_login_required filter.
That should not happen because of skip_before_filter :check_if_login_required.

Actions #4

Updated by André Jonsson over 11 years ago

I have the same problem after a fresh install of Redmine 2.3 (i.e. no plugin baggage).
The database was, however, migrated from an 1.3 install.

Here's a debug log:

Started GET "" for 192.168.6.152 at 2013-04-17 14:37:36 +0200
Processing by WelcomeController#index as HTML
   (1.5ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  Setting Load (0.1ms)  SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'autologin' LIMIT 1
  Token Load (0.1ms)  SELECT `tokens`.* FROM `tokens` WHERE `tokens`.`action` = 'autologin' AND `tokens`.`value` = '74367b4f50b34b503852b6d0ef63788e86b0c995' LIMIT 1
  User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 3 LIMIT 1
  Setting Load (0.1ms)  SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'rest_api_enabled' LIMIT 1
  AnonymousUser Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('AnonymousUser') LIMIT 1
  Current user: anonymous
  Setting Load (0.1ms)  SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'login_required' LIMIT 1
Redirected to http://scm.XX.se/login?back_url=http%3A%2F%2Fscm.XX.se%2F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 199ms (ActiveRecord: 5.2ms)
Started GET "?back_url=http%3A%2F%2Fscm.XX.se%2F" for 192.168.6.152 at 2013-04-17 14:37:36 +0200
Processing by WelcomeController#index as HTML
  Parameters: {"back_url"=>"http://scm.XX.se/"}
   (0.1ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  Token Load (0.1ms)  SELECT `tokens`.* FROM `tokens` WHERE `tokens`.`action` = 'autologin' AND `tokens`.`value` = '74367b4f50b34b503852b6d0ef63788e86b0c995' LIMIT 1
  User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 3 LIMIT 1
  AnonymousUser Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('AnonymousUser') LIMIT 1
  Current user: anonymous
Redirected to http://scm.XX.se/login?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 5ms (ActiveRecord: 0.4ms)
Started GET "?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F" for 192.168.6.152 at 2013-04-17 14:37:36 +0200
Processing by WelcomeController#index as HTML
  Parameters: {"back_url"=>"http://scm.XX.se/?back_url=http%3A%2F%2Fscm.XX.se%2F"}
   (0.1ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  Token Load (0.1ms)  SELECT `tokens`.* FROM `tokens` WHERE `tokens`.`action` = 'autologin' AND `tokens`.`value` = '74367b4f50b34b503852b6d0ef63788e86b0c995' LIMIT 1
  User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 3 LIMIT 1
  AnonymousUser Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('AnonymousUser') LIMIT 1
  Current user: anonymous
Redirected to http://scm.XX.se/login?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F%253Fback_url%253Dhttp%25253A%25252F%25252Fscm.XX.se%25252F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 4ms (ActiveRecord: 0.4ms)
Started GET "?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F%253Fback_url%253Dhttp%25253A%25252F%25252Fscm.XX.se%25252F" for 192.168.6.152 at 2013-04-17 14:37:36 +0200
Processing by WelcomeController#index as HTML
  Parameters: {"back_url"=>"http://scm.XX.se/?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F"}
   (0.1ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  Token Load (0.1ms)  SELECT `tokens`.* FROM `tokens` WHERE `tokens`.`action` = 'autologin' AND `tokens`.`value` = '74367b4f50b34b503852b6d0ef63788e86b0c995' LIMIT 1
  User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 3 LIMIT 1
  AnonymousUser Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('AnonymousUser') LIMIT 1
  Current user: anonymous
Redirected to http://scm.XX.se/login?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F%253Fback_url%253Dhttp%25253A%25252F%25252Fscm.XX.se%25252F%25253Fback_url%25253Dhttp%2525253A%2525252F%2525252Fscm.XX.se%2525252F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 4ms (ActiveRecord: 0.4ms)
Started GET "?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F%253Fback_url%253Dhttp%25253A%25252F%25252Fscm.XX.se%25252F%25253Fback_url%25253Dhttp%2525253A%2525252F%2525252Fscm.XX.se%2525252F" for 192.168.6.152 at 2013-04-17 14:37:36 +0200
Processing by WelcomeController#index as HTML
  Parameters: {"back_url"=>"http://scm.XX.se/?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F%253Fback_url%253Dhttp%25253A%25252F%25252Fscm.XX.se%25252F"}
   (0.1ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  Token Load (0.1ms)  SELECT `tokens`.* FROM `tokens` WHERE `tokens`.`action` = 'autologin' AND `tokens`.`value` = '74367b4f50b34b503852b6d0ef63788e86b0c995' LIMIT 1
  User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 3 LIMIT 1
  AnonymousUser Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('AnonymousUser') LIMIT 1
  Current user: anonymous
Redirected to http://scm.XX.se/login?back_url=http%3A%2F%2Fscm.XX.se%2F%3Fback_url%3Dhttp%253A%252F%252Fscm.XX.se%252F%253Fback_url%253Dhttp%25253A%25252F%25252Fscm.XX.se%25252F%25253Fback_url%25253Dhttp%2525253A%2525252F%2525252Fscm.XX.se%2525252F%2525253Fback_url%2525253Dhttp%252525253A%252525252F%252525252Fscm.XX.se%252525252F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 4ms (ActiveRecord: 0.4ms)

I tried removing all "autologin" tokens in the database, but no change.

As it says "Filter chain halted as :check_if_login_required rendered or redirected" it seems to stop, as you say. But then the browser issues another GET (as a reaction to the 302 it gets), and it loops...

Actions #5

Updated by André Jonsson over 11 years ago

Tried with a completely clean database, and it works!

So... there's something in the database that causes this, the question is what. Will try to copy table by table from the old database to see when it breaks.

Actions #6

Updated by André Jonsson over 11 years ago

I had a tiny breakthrough; setting "settings.login_required" to 0 in the database will fix the problem.
But of course, this is useless as users are disabled. :-/

UPDATE: scratch the "fix the problem part"; the redirection loop doesn't occurr anymore, but now all links will show the "Home" page.

Actions #7

Updated by André Jonsson over 11 years ago

I guess I'm the only one reading these comments, this issue might serve as reference for someone else.

Another detail I discovered: if I start a webrick server using the same database everything works (except ldap auth which was configured in apache).
So there's definitely something amiss with the passenger/apache config that causes this.

Actions #8

Updated by André Jonsson over 11 years ago

Back to apache+passenger with login_required = 1, all links now show the "Home" page (I still have a session cookie from the webrick session).

I can see in the log that whatever sub-URL I go to in the browser the log says I'm requesting "". This must be the actual culprit. But why?

Here, I typed just gibberish into the path: http://scm.XX.se/iouashdfiouashdf, and got this in the log:

Started GET "" for 192.168.6.152 at 2013-04-18 11:53:35 +0200
Processing by WelcomeController#index as HTML
  Current user: andjonss (id=3)
  Rendered news/_news.html.erb (2.1ms)
  Rendered welcome/index.html.erb within layouts/base (14.6ms)
Completed 200 OK in 38ms (Views: 31.7ms | ActiveRecord: 0.6ms)

My /etc/apache2/mods-enabled/passenger.conf looks like this:

<IfModule mod_passenger.c>
  PassengerSpawnMethod smart
  RailsAppSpawnerIdleTime 86400
  PassengerPoolIdleTime 86400

  PassengerRoot /usr/lib/phusion-passenger
  PassengerRuby /usr/bin/ruby1.9.3
</IfModule>

As for the PassengerRoot value, I saw in the passenger guide that it suggests the gem path of passenger instead, which in my case is "/var/lib/gems/1.9.1/gems/passenger-3.0.19/".
But if I use that it complains that "agents/PassengerWatchdog" can't be started. This binary is in "/usr/lib/phusion-passenger/agents" on my system (provided by the ruby-passenger package), but not much else.

Actions #9

Updated by André Jonsson over 11 years ago

Finally gave up and went back to using fcgi instead.

Actions #10

Updated by Jean-Philippe Lang about 11 years ago

  • Subject changed from Сyclic recursion redirects to Cyclic recursion redirects
Actions #11

Updated by Brad Street about 11 years ago

Don't know if it will help you, but I found a fix! I just experienced the redirect loop problem when attempting to access Redmine. On the settings page, I had set to require a login to view pages. After the session expired, this issue presented itself. To correct it:
  • Logged into phpmyadmin and changed the value of login_required in the settings table from 1 to 0.
  • Restarted Thin_redmine and Apache servers (it seems that the page is cached so it doesn't register if you don't restart both servers).
  • After this, I was able to log in

Not a total solution perhaps, but at least might help get someone back to a working state.

Actions

Also available in: Atom PDF