Project

General

Profile

Actions

Bug #1444

closed

Compatability problem in Redmine 4.2.9 with redmine_message_customize plugin

Added by liaham over 2 years ago. Updated almost 2 years ago.

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

80%

Estimated time:
Compatible Redmine Version:
Requires Documentation?:

Description

🐛 Thanks for taking the time to fill out this bug report! 😊

What did you expect?

Navigating to Administration » Configuration should render the respective page.

What has happened instead?

The browser stopped with a message about an infinitive loop.

What could be a possible solution?

The solution is not quite clear. But I investigated the problem so far that I can say it occurs only if

  • Redmine 4.2.9 is installed
  • redmine_message_customized v0.1.6 is installed
  • and some of our plugins is installed

Within the callback :requires_admin it occurs that the RequestStore.store is empty although the session[:user_id] exists. This leads to an assignment of the Anonymous User to RequestStore.store what again represents the current user.

If the current user is anonymous in a :requires_admin callback the user will be redirected to the back_url. This causes the infinite loop from which the browser stops after some time.

How can we reproduce the problem?

Install the following:

  • Redmine 4.2.9
  • redmine_message_customize v0.1.6
  • redmine_email_customizer 0.1.2 (or any other of ours)

Navigate as admin to Administration » Settings or Administration » Plugins » (any plugin settings page). Then your browser should stop the request due to the infinite loop.

In what environment are you running the plugin?

Please copy and paste your environment information as displayed in Administration » Information or run bin/about in the root dir of your Redmine instance.

Environment:
  Redmine version                4.2.9.stable
  Ruby version                   2.7.7
  Rails version                  5.2.8
  Environment                    development
  Database adapter               PostgreSQL
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.14.2
  Mercurial                      6.3.1
  Git                            2.38.2
  Filesystem                     
Redmine plugins:
  advanced_plugin_helper         0.3.1
  redmine_base_deface            1.8.1-xmr-1
  redmine_email_customizer       0.1.2
  redmine_message_customize      0.1.6

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari

Relevant log output

# Copy your log output (log/production.log) here
``` ruby

Started GET "/settings" for 192.168.2.117 at 2023-01-17 13:46:37 +0100
Processing by SettingsController#index as HTML
  [1m[36mAnonymousUser Load (0.5ms)[0m  [1m[34mSELECT  "users".* FROM "users" WHERE "users"."type" IN ('AnonymousUser') AND "users"."lastname" = $1 LIMIT $2[0m  [["lastname", "Anonymous"], ["LIMIT", 1]]
Redirected to http://devmac:3000/login?back_url=http%3A%2F%2Fdevmac%3A3000%2Fsettings
Filter chain halted as :require_admin rendered or redirected
Completed 302 Found in 3ms (ActiveRecord: 0.5ms)


Started GET "/login?back_url=http%3A%2F%2Fdevmac%3A3000%2Fsettings" for 192.168.2.117 at 2023-01-17 13:46:37 +0100
Processing by AccountController#login as HTML
  Parameters: {"back_url"=>"http://devmac:3000/settings"}
  [1m[36mToken Update All (1.2ms)[0m  [1m[33mUPDATE "tokens" SET "updated_on" = '2023-01-17 13:46:37.035662' WHERE "tokens"."user_id" = $1 AND "tokens"."value" = $2 AND "tokens"."action" = $3[0m  [["user_id", 1], ["value", "e6295246f75e000883dbbfaeef9eca8258f6119d"], ["action", "session"]]
  [1m[35m (0.3ms)[0m  [1m[34mSELECT MAX("settings"."updated_on") FROM "settings"[0m
  [1m[36mUser Load (0.4ms)[0m  [1m[34mSELECT  "users".* FROM "users" WHERE "users"."type" IN ('User', 'AnonymousUser') AND "users"."status" = $1 AND "users"."id" = $2 LIMIT $3[0m  [["status", 1], ["id", 1], ["LIMIT", 1]]
  Current user: admin (id=1)
Redirected to http://devmac:3000/settings
Completed 302 Found in 6ms (ActiveRecord: 1.9ms)


Started GET "/settings" for 192.168.2.117 at 2023-01-17 13:46:37 +0100
Processing by SettingsController#index as HTML
  [1m[36mAnonymousUser Load (0.6ms)[0m  [1m[34mSELECT  "users".* FROM "users" WHERE "users"."type" IN ('AnonymousUser') AND "users"."lastname" = $1 LIMIT $2[0m  [["lastname", "Anonymous"], ["LIMIT", 1]]
Redirected to http://devmac:3000/login?back_url=http%3A%2F%2Fdevmac%3A3000%2Fsettings
Filter chain halted as :require_admin rendered or redirected
Completed 302 Found in 3ms (ActiveRecord: 0.6ms)
Actions #1

Updated by liaham over 2 years ago

  • Subject changed from Infinite loop in :requires_admin callback to Compatability problem in Redmine 4.2.9 with redmine_message_customize plugin
Actions #2

Updated by liaham over 2 years ago

Since redmine_message_customize runs with redmine_dmsf and redmine_drawio when navigating to each plugin settings it seems to be something with the load mechanism of our Redmine plugins.

Actions #3

Updated by liaham over 2 years ago

  • Description updated (diff)
  • Assignee set to liaham
Actions #4

Updated by liaham over 2 years ago

When commenting AdvancedPluginHelper::Patch.register in plugin setup method, then the error does not occur!

Actions #5

Updated by liaham over 2 years ago

The problem does not occur when running version 0.1.5 instead of v0.1.6.

Actions #6

Updated by liaham over 2 years ago

The problem lies in redmine_message_customize/lib/message_customize/application_controller_patch.rb:

# frozen_string_literal: true

require 'application_controller' # <-- !Problem is here!

module MessageCustomize
  module ApplicationControllerPatch
   ...
  end
end

I couldn't figure out why exactly this requirement leads to the problems described above. But the code runs without this line.

Therefore, it could be deleted, what will fix the problem!

Actions #7

Updated by liaham over 2 years ago

  • Status changed from New to Confirmed
Actions #8

Updated by liaham over 2 years ago

  • % Done changed from 0 to 80
Actions #10

Updated by liaham over 2 years ago

  • Status changed from Confirmed to Feedback
Actions #11

Updated by liaham about 2 years ago

  • Status changed from Feedback to Closed

Is merged

Actions #12

Updated by liaham almost 2 years ago

  • Project changed from Redmine Email Customizer to Redmine Message Customize
  • Target version changed from unplanned to unreleased
Actions #13

Updated by liaham almost 2 years ago

  • Target version deleted (unreleased)
Actions

Also available in: Atom PDF