Project

General

Profile

RedmineCacheCredsMax doesn't work with apache2-worker

Added by Linghua Tseng about 15 years ago

I setup my repositories access control according to this page:
http://www.redmine.org/wiki/redmine/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl
Versions of installed packages are:

  redmine-0.8.5
  perl-threaded-5.10.1
  sqlite3-3.6.14.2
  mod_perl2-2.0.4_2,3
  apache-worker-2.2.13
  ruby+oniguruma-1.8.7
  ruby18-gems-1.3.5
  rubygem-passenger-2.2.5
  rubygem-rack-1.0.0
  rubygem-rails-2.3.4
  rubygem-sqlite3-1.2.4
OS is FreeBSD 7.2-STABLE.

Everything works fine before I added this line to my virtual host settings:

  RedmineCacheCredsMax 50

Once I added this line, my httpd will be always crashed when it's starting.

I've turned on the debbuing flags and recompiled everything.
Unfortunately, the crash point cannot provide me enough information:

#0  0x08007061 in ?? ()
#1  0x33f1a56d in find_entry from /usr/local/lib/libapr-1.so.3 (apr_hash.c:265)
#2  0x33f1a9e8 in apr_hash_set from /usr/local/lib/libapr-1.so.3 (apr_hash.c:343)
#3  0x3443c4ad in mime_post_config from /usr/local/libexec/apache22/mod_mime.so (mod_mime.c:454)
#4  0x08076600 in ap_run_post_config () (config.c:91)
#5  0x0806410b in main () (main.c:729)

It can only tell me that some data structures were corrupted before initializing mod_mime.

I guess that this subroutine in redmine/extra/svn/Redmine.pm is the problem:

sub RedmineCacheCredsMax {   
  my ($self, $parms, $arg) = @_;
  if ($arg) {
    $self->{RedmineCachePool} = APR::Pool->new;
    $self->{RedmineCacheCreds} = APR::Table::make($self->{RedmineCachePool}, $arg);
    $self->{RedmineCacheCredsCount} = 0;
    $self->{RedmineCacheCredsMax} = $arg;
  }
}

I've also confirmed that something will be corrupted after the line was interpreted:

  $self->{RedmineCachePool} = APR::Pool->new;

Since I'm not familiar with Perl, I cannot confirm whether it's thread-safe.
However, some old web pages told me that APR::Pool is always not thread-safe.
Therefore, I recompiled my apache with MPM=prefork flag instead of MPM=worker and it worked perfectly.
Nevertheless, MPM=prefork is really slow because I have a lot of web pages/programs other than redmine.

Would anyone like to help me solve this problem so that I can set RedmineCacheCredsMax in apache-worker?


Replies (4)

RE: RedmineCacheCredsMax doesn't work with apache2-worker - Added by Linghua Tseng about 15 years ago

This patch works for me, but I don't know the reason.
I just delay the pool allocation later.

*** Redmine.pm.orig     Sat Nov 21 03:56:48 2009
--- Redmine.pm  Sat Nov 21 03:58:39 2009
*************** sub RedmineDbWhereClause { 
*** 169,176 ****
  sub RedmineCacheCredsMax { 
    my ($self, $parms, $arg) = @_;
    if ($arg) {
!     $self->{RedmineCachePool} = APR::Pool->new;
!     $self->{RedmineCacheCreds} = APR::Table::make($self->{RedmineCachePool}, $arg);
      $self->{RedmineCacheCredsCount} = 0;
      $self->{RedmineCacheCredsMax} = $arg;
    }
--- 169,176 ----
  sub RedmineCacheCredsMax { 
    my ($self, $parms, $arg) = @_;
    if ($arg) {
! #   $self->{RedmineCachePool} = APR::Pool->new;
! #   $self->{RedmineCacheCreds} = APR::Table::make($self->{RedmineCachePool}, $arg);
      $self->{RedmineCacheCredsCount} = 0;
      $self->{RedmineCacheCredsMax} = $arg;
    }
*************** sub is_member {
*** 270,275 ****
--- 270,279 ----
    my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
    my $usrprojpass;
    if ($cfg->{RedmineCacheCredsMax}) {
+     if(!defined($cfg->{RedmineCacheCreds})) {
+       $cfg->{RedmineCachePool} = APR::Pool->new;
+       $cfg->{RedmineCacheCreds} = APR::Table::make($cfg->{RedmineCachePool}, $cfg->{RedmineCacheCredsMax});
+     }
      $usrprojpass = $cfg->{RedmineCacheCreds}->get($redmine_user.":".$project_id);
      return 1 if (defined $usrprojpass and ($usrprojpass eq $pass_digest));
    }

RE: RedmineCacheCredsMax doesn't work with apache2-worker - Added by Terence Mill almost 14 years ago

Is this patch tested and wil it be committed to redmine.pm?
Or do i have to install apache2-mpm-prefork, what is advisable for production enviornments, is it?

RE: RedmineCacheCredsMax doesn't work with apache2-worker - Added by Linghua Tseng almost 14 years ago

It's not a well-tested patch, but it's always applied to my working environment.

Obviously, it's not enough for apache2-mpm-worker.
You can checkout/commit your source code normally, but 'svn copy' doesn't work.
Now I still use a dedicated server to run apache-mpm-prefork due to this problem.

RE: RedmineCacheCredsMax doesn't work with apache2-worker - Added by Vladimir Skubriev almost 11 years ago

refer to [[http://www.redmine.org/boards/2/topics/20183?r=41109#message-41109]]

I am solved this problem with apache2-mpm-prefork instead of apache2-mpm-worker (installed by default in ubuntu)

    (1-4/4)