Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mod_perl2 configuration and usage issues
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Tue Jul 11, 2006 2:53 pm    Post subject: mod_perl2 configuration and usage issues Reply with quote

i'm running Apache 2.0.55-r1 with Perl 5.8.8, and recently installed mod_perl 2.0.1-r2, and am having some issues with mod_perl.

i've enabled mod_perl in /etc/conf.d/apache2:
Code:
APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D PERL"


When Apache starts on system bootup, its fine, and when I restart Apache by sending it a SIGUSR1, it restarts without a problem, but when I try to restart it using the init.d script, it hangs indefinately and I have to ctrl+c it:

Code:
# /etc/init.d/apache2 restart
 * Caching service dependencies ... [ ok ]
 * Stopping apache2 ...
apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ ok ]
^C
# /etc/init.d/apache2 stop
^C
# /etc/init.d/apache2 start
 * Starting apache2 ...
^C


if I disable mod_perl (in /etc/conf.d/apache2), the init.d script works fine, with no hang at all.

my mod_perl config file is as follows:

Code:
<IfDefine PERL>
  <IfModule !mod_perl.c>
    LoadModule perl_module    modules/mod_perl.so
  </IfModule>
</IfDefine>

<IfModule mod_perl.c>
        PerlRequire "/etc/apache2/modules.d/apache2-mod_perl-startup.pl"

        #Provide two aliases to the same cgi-bin directory,
        #to see the effects of the 2 different mod_perl modes
        #for Apache2::Registry Mode
        Alias /perl/ /home/evan/perl/
        #for Apache2::Perlrun Mode
        Alias /cgi-perl/ /home/evan/perl/

        <IfModule mod_access.c>
        <Location /perl-status>
                SetHandler perl-script
                PerlResponseHandler Apache2::Status
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
        </Location>
        </IfModule>

    PerlModule ModPerl::Registry
    #set Apache::Registry Mode for /perl Alias
    # To set subdirectories to use perl set the following
    # and comment the orignial:
    # <Location ~ "^/perl/.*\.pl$">
    <Location  "/perl/*.pl>
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>

    #set Apache::PerlRun Mode for /cgi-perl Alias
    <Location /cgi-perl/*.pl>
        SetHandler perl-script
        PerlResponseHandler ModPerl::PerlRun
        Options -Indexes ExecCGI
        PerlSendHeader On
    </Location>

</IfModule>
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Wed Jul 12, 2006 5:58 am    Post subject: Reply with quote

I have the same problem and am completely at loss...

BTW - You don't have to break (ctrl-c) it... if you wait long enough it'll complete... but it takes about 5 minutes.

I'll keep you posted if I find something...

EDIT: Another thread seems to be working on this issue: https://forums.gentoo.org/viewtopic-t-354789l.html

Seems like apache2-mod_perl-startup.pl is messing up. There seems to be some solutions in the thread. Will have to experiment with them.
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Wed Jul 12, 2006 12:14 pm    Post subject: Reply with quote

I thought I had some results...

I can mostly confirm the bug is within apache2-mod_perl-startup.pl - I've commented out the require command from 75_perl_mod and no more hanging.


In the process of trying to indentify what's causing the hang within the perl script, I've tried commenting everything out of apache2-mod_perl-startup.pl (except the trailing 1, of course).

When I do this, I still get a hang.

Amusingly, I get the hang just testing out the config (apache2 -t -D PERL)

If I wait long enough, it goes through, but still not satisfying.

Nothing in the error log or script log. I've turned on "PerlTrace all" in the hope of getting more info, but to no avail.

Hmm.. interrestingly, the first time I run the config test, there's no delay.

The second time it hangs.

Turns out there's an apache2 process that doesn't end when testing the config using -D PERL
If I kill the apache2 process and rerun the test, it runs fine.

It seems that there's something in the PERL config that just doesn't end as I'd expect. It can be from my lack of understanding of all this. I'm still somewhat of a neophite at this, but it feels like I've got a good clue here.

Anyone?
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Wed Jul 12, 2006 7:05 pm    Post subject: Reply with quote

hmm, even if I disable the PerlRequire script for mod_perl, apache still hangs when I use /etc/init.d/apache2. the only thing that prevents the hang for me is to disable mod_perl altogether.

And one time when I tried to restart apache with the init.d script, the entire server rebooted 8O Of course, that could have been from however many times i'd restarted apache, something just mucked up in memory.

EDIT: this specific problem was caused by a PerlHandler looking for modules that the startup script shouldve loaded, which caused problems because i'd disabled the startup script. fixed that by loading all the needed ModPerl:: and Apache:: modules within the handler. it hangs now, however, when the handler module in question loads at startup. so the source of it i would assume to be one or more of the following modules:
Code:
use ModPerl::Util ();

use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();

use Apache2::ServerRec ();
use Apache2::ServerUtil ();
use Apache2::Connection ();
use Apache2::Log ();

use APR::Table ();

use ModPerl::Registry ();

use Apache2::Const qw( :common );
use APR::Const qw( ':common );


to restate the problem (admittedly more clearly), when trying to start or restart apache from the init.d script, apache itself starts without delay, but the init script hangs for at least 5 minutes afterward, and it seems to be hanging on one or more of the above listed mod_perl modules.
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Thu Jul 13, 2006 2:21 am    Post subject: Reply with quote

Mine's a clean perl install.

I've emerge otrs which caused mod_perl to be installed.

I can run otrs with mod perl disabled (using cgi, if I understand correcty).

I get the exact same symptoms as you (apache hanging on start) when I add -D PERL to apache2.

I just noticed I don't have the latest apache compiled.

I currently have:

net-www/apache-2.0.55-r1
www-apache/mod_perl-2.0.1-r2
dev-lang/perl-5.8.8-r2

I'll try updating apache, see if that fixes anything...
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Thu Jul 13, 2006 3:14 am    Post subject: Reply with quote

I upgraded apache2 to net-www/apache-2.0.58

The problem remained.

I stopped apache2
I killed all apache2 tasks (some stuff was still running in there and I wanted to restart it clean)

I unmerged mod_perl and re-emerged it.

Started apache (-D PERL set) and it starts fine - no delay
Stops fine too
Restarts fine

My perl script is currently not running - I get 'internal server error' - which is a whole lot better than the hang I used to get before.

I do have some stuff in my error logs now and it looks like some configuration error in for the application I'm trying to run

Code:
Can't locate Kernel/System/Web/InterfaceAgent.pm in @INC (@INC contains: //../../Kernel/cpan-lib //../.. /home/httpd/perl /etc/perl /usr/lib/perl5/vendor_perl/5.8.8/i686-linux /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.8.8/i686-linux /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/5.8.8/i686-linux /usr/lib/perl5/5.8.8 /usr/local/lib/site_perl . /usr/lib/apache2) at /var/www/localhost/otrs/bin/cgi-bin/index.pl line 41.\nBEGIN failed--compilation aborted at /var/www/localhost/otrs/bin/cgi-bin/index.pl line 41.\n

_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Thu Jul 13, 2006 1:23 pm    Post subject: Reply with quote

Well, seems like its not stopping properly... I still get the ~5 minute hang.

After I stop apache, there's some apache processes stil running. And that's when starting takes time.

For testing purpuses, I kill the processes and then apache will start with no delay - not that I'd advise this as procedure, but there it is.

I don't know exactly how the mod_perl module works, but it seems to not be stopping when we're asking it to.

And when the delays happen, there's no working perl either - calls to perl-enabled folders just freeze.
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Thu Jul 13, 2006 9:02 pm    Post subject: Reply with quote

odd thing is, restarting apache with kill -USR1 `cat /var/run/apache2.pid` works seemingly without any delay. but im wondering if restartign it that way is even loading the conf.d file (and thus the -D PERL).

i'll test that theory as soon as my apache finishes recompiling (upgrading to 2.0.58). i wonder if the init.d script that gentoo uses is a derivative of the apachectl script apache comes bundled with? if not, perhaps using apachectl would help somehow?
Back to top
View user's profile Send private message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Fri Jul 14, 2006 12:43 am    Post subject: Reply with quote

i think i found the problem: bug 88512 notes that apache2 and mod_perl2 have bouts of incompatability because the apache builds are built without LFS (large file support), while the mod_perl2 builds are. this seems kind of ass-backwards to me, since what other use does mod_perl have, but im sure theres a reason the gentoo developers are doing that...

apache 2.2 is supposed to have LFS enabled, so we could unmask it and see what happens. or we could build apache 2.0 from source with LFS enabled (or build mod_perl2 from source with LFS disabled). not sure what the dangers of these solutions are, though....

i think i'm just gonna unmask 2.2, wish me luck :(
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Fri Jul 14, 2006 3:31 am    Post subject: Reply with quote

I didn't notice any metion to segmentation fault on my end, but its definately worth a shot...

Hmmm... the thread for the bug you specified seemed to have the thing fixed by re-emerging mod_perl-2.0.1-r2 ... which is exactly what I use.

I have a hard time understanding why we're getting this issue... I figure we're not the only ones using perl and apache on gentoo, yet I didn't find much in the way of similar cases.

Do you run anything else with your apache?

Only thing that seems worth noting is php5.
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Fri Jul 14, 2006 1:58 pm    Post subject: Reply with quote

well, the bug doesnt seem to have ever been truly fixed; rather they closed it when enought people couldnt reproduce it. and that says to me that we [the people having this problem] have something specific installed or configured that noone else does.

right now, in addition to apache, i have php 5.1.4, mysql 5.0.22, and openssl 0.9.7i, along with a whole mess of other packages that might or might not be related. its worth mentioning that im not using ssl on apache (just on mysql).

and after emerging the hard-masked apache 2.2, it couldnt load mod_perl. when i un-emerged and re-emerged mod_perl, it now segfaults on startup....i'm going back to the latest stable of apache and mod_perl, and i'll just have to get used to the initial hang until the gentoo developers do something, or use a different server with a different distro.
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Fri Jul 14, 2006 2:27 pm    Post subject: Reply with quote

I only have internal applications running on perl, so I don't mind running perl as CGI instead of using mod_perl until I figure this thing out.

I've also heard mention of "fastcgi", which should be faster than plain old CGI.

So it seems like there are alternatives to mod_perl.

I don't feel safe running mod_perl as it is on production servers just yet...
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Sat Jul 15, 2006 8:18 pm    Post subject: Reply with quote

well, i'm going to use debian on my prduction machines for now, until gentoo works out this LFS issue.
Back to top
View user's profile Send private message
Thavian
n00b
n00b


Joined: 20 Jul 2006
Posts: 13

PostPosted: Thu Jul 20, 2006 1:59 am    Post subject: Reply with quote

evank wrote:
well, i'm going to use debian on my prduction machines for now, until gentoo works out this LFS issue.


Do we know this is the LFS issue? I just decided to start leaning perl myself and since I have a strong web dev background C CGI and PHP stuff. I figured mod_perl would be a good place to start learning. Now I come to find out I can't get mod_perl working with apache2. I noticed the comment on the gentoo-wiki about LFS... until LFS support is added into apache are we screwed?!
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Thu Jul 20, 2006 3:43 am    Post subject: Reply with quote

In my case, its not the LFS problem. I don't know what it is.

Still, you can get perl working as CGI easily without using mod_perl. It should be sufficient for development and learning purposes. Just not likely for production setups.
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
evank
n00b
n00b


Joined: 01 Jul 2005
Posts: 26

PostPosted: Thu Jul 20, 2006 10:23 pm    Post subject: Reply with quote

Thavian wrote:
Do we know this is the LFS issue? I just decided to start leaning perl myself and since I have a strong web dev background C CGI and PHP stuff. I figured mod_perl would be a good place to start learning. Now I come to find out I can't get mod_perl working with apache2. I noticed the comment on the gentoo-wiki about LFS... until LFS support is added into apache are we screwed?!


strictly speaking, no. apache2 with mod_perl2 will run just fine on gentoo, but restarting apache causes a problem. it will restart, it just takes about 5 minutes to do so.

as for whether LFS is the issue, i'm about 99% sure it is (in my case anyway), but im far from an expert, so that 1% could well turn around and bite me in the ass. at any rate, this problem doesnt exist on my other (debian) server, which is why I said i'm going to use that for production.
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Wed Jul 26, 2006 2:28 am    Post subject: Reply with quote

In a desperate attempt to get this working to my liking, I've updated and recompiled... well... basically everything... Resynched portaged, updated the world. Went into a boatload of troubles (old packages blocking new packages, unmerging, remerging, blah blah blah)

I'm not sure exactly why or how or even if the recompile at really anything to do with anything but...

It now seems to be working fine. Its a tad slower to stop and start with -D PERL than without, but if feels acceptable for now on my test box.

Most issues I had with actually rinning software was due to configuration issues (I used to run perl as CGI - without mod_perl2).

As I expected, the speed difference is enormous!!
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Wed Jul 26, 2006 4:34 pm    Post subject: Reply with quote

Well, it might be working, but the delay problem is still there.
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
MRB
n00b
n00b


Joined: 21 Oct 2003
Posts: 16
Location: Vienna, Austria

PostPosted: Thu Sep 14, 2006 1:47 am    Post subject: Reply with quote

Sorry to bring this thread to life again after about 2 months but I just installed otrs together with mod_perl and had the exact same issue as described above. I can not exactly pinpoint what caused it to work again, but in my case I already had perl installed ( not sure about libperl ) and lazily used ~x86 for otrs since it is masked. After looking through the forum for a solution I re-emerged libperl without ACCEPT_KEYWORDS and now it works fine, no more hangs.

Would be interesting if somebody could confirm this :) Anyway, hope that helps.
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Fri Sep 15, 2006 3:29 am    Post subject: Reply with quote

I still have the issue and still have not gone into production because of it.

I'll try re-emerging libperl to see where it takes me.

You'll have to excuse my newbism, but what does "emerge without ACCEPT_KEYWORDS" mean?

I'll let you know if the re-emerge changes something for me...


Update
Nope. It still hangs. What versions of mod_perl, apache, libperl and whatnot are you using? I haven't updated anything on my test system in the last two months...
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
justdrew
n00b
n00b


Joined: 22 Sep 2006
Posts: 3
Location: Portland, OR

PostPosted: Fri Sep 22, 2006 7:49 pm    Post subject: apache2 and mod_perl, just ran into this problem myself Reply with quote

could I go to /usr/portage/dev-lang/perl and edit the .ebuild file for my perl and re-emerge it after having removed the -Dlargefiles switch?
to test if this fixes the issue? <on edit: the delay issue for me at least doesn't seem to have anything to do with largefile support>

when a long delay happenes when starting apache2, I see this in a ps -Af list:
root 4539 4242 0 12:52 pts/0 00:00:00 /bin/bash /sbin/runscript.sh ./apache2 start
root 4586 4539 0 12:52 pts/0 00:00:00 /bin/bash /sbin/runscript.sh ./apache2 start

Why would there be two instances running of this from one invokation of /etc/init.d/apache2 start ?

if I start it manually from the command line like this:
apache2 -D PHP5 -D DEFAULT_VHOST -D PERL -D INFO (the location of httpd.conf is compliled in so that's all that's needed)

it starts fine, if I then kill it with "apache2 -k stop" and start it again, again it starts up fast, I can never get a delay this way. The delay only comes up when using the rc init script "/etc/init.d/apache2 start"

Whatever is causing the delay is in the RC scripts. Perhaps it has something to do with the checkconfig they do before stoping and starting?
or Could there be an issue here with having the script named the exact same thing as the executable?

Well... I just did, in /etc/init.d a "cp apache2 apachectl" and tried using the exact same init script, just renamed apachectl and I can't get the delay to happen anymore. Now going back and trying a few start stops with the apache2 init script, and wammo, it starts fine, then when I try to stop it, again a massive delay. (this time oddly on the stop not a start), and yet again in Ps -Af I see two instances of the script trying to run:
root 5905 4595 0 15:23 pts/1 00:00:00 /bin/bash /sbin/runscript.sh ./apache2 stop
root 5936 5905 0 15:23 pts/1 00:00:00 /bin/bash /sbin/runscript.sh ./apache2 stop

perhaps I should make a bug report? I'm sucha noob tho I've never done that, will look into it.
Back to top
View user's profile Send private message
justdrew
n00b
n00b


Joined: 22 Sep 2006
Posts: 3
Location: Portland, OR

PostPosted: Fri Sep 22, 2006 11:05 pm    Post subject: Reply with quote

well, I've made a bug report on this:
https://bugs.gentoo.org/show_bug.cgi?id=148713
Back to top
View user's profile Send private message
themaze75
n00b
n00b


Joined: 14 Mar 2006
Posts: 22

PostPosted: Sat Sep 23, 2006 4:44 am    Post subject: Reply with quote

justdrew wrote:
well, I've made a bug report on this:
https://bugs.gentoo.org/show_bug.cgi?id=148713


Well, there's the greated tangible progress I've seen so far :)

Looks like someone replied to your bug report already.

He asked to try and remove the mod_auth_digest from your httpd.conf file.

I tried their suggestion, but doesn't change anything.
_________________
Eric Maziade
In the Maze
Back to top
View user's profile Send private message
justdrew
n00b
n00b


Joined: 22 Sep 2006
Posts: 3
Location: Portland, OR

PostPosted: Mon Sep 25, 2006 4:41 pm    Post subject: progress Reply with quote

I had actually already had it commented out.

Did you try renaming of the init.d script?
Back to top
View user's profile Send private message
gunar.d
n00b
n00b


Joined: 08 Nov 2006
Posts: 1
Location: Klagenfurt

PostPosted: Wed Nov 08, 2006 12:35 pm    Post subject: Reply with quote

I have the same problem (still), I tried everything what listed in this thread without success. Restart of apache takes 2-5 mins. I also tried to rename the rc-script... this results in other problems: apache starts then without OPTS like "-D PERL -D SSL -D PHP5 -D SSL_DEFAULT_VHOST", so I cant work with that.

When I start without rc-script like this:
/usr/sbin/apache2 -D PERL -D SSL -D PHP5 -D SSL_DEFAULT_VHOST -k start
and stop with:
/usr/sbin/apache2 -k stop
it works for a few times and then hang again, sometimes there is a warning "NameVirtualHost *:80 has no VirtualHosts", sometimes not.

It feels like a caching problem, but I'm not a expert.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum