Porting Apache::File to modperl2

2003-12-05 Thread Markus Reinhardt
Hi there,

I try to change the following line to modperl2:

my $fh = Apache::File->new($r->filename) || return DECLINED;

The documentation tells me that Apache::File has been removed
for modperl2. Implementing Apache::Porting module says to
replace Apache::File:
mod_perl 2.0 API doesn't include package 'Apache::File'. The package 
'Apache::File' has moved to 'Apache::Response' 'Apache::RequestRec'

But unfortunately I don't know in what manner I have to change
the above line for Apache::File with the new modules.
Could someone give me a hint?

Regards
Markus
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Porting Apache::File to modperl2

2003-12-05 Thread Geoffrey Young


Markus Reinhardt wrote:
> 
> Hi there,
> 
> I try to change the following line to modperl2:
> 
> my $fh = Apache::File->new($r->filename) || return DECLINED;

> But unfortunately I don't know in what manner I have to change
> the above line for Apache::File with the new modules.
> 
> Could someone give me a hint?

my $fh = IO::File->new($r->filename);

HTH

--Geoff


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



mod_perl + perl/tk

2003-12-05 Thread Levon Barker
Hello,

Can anyone point me to a reference on delivering a GUI to the browser with a
mod_perl server.

Perhaps with perl/tk.

Can this be done?
Has anyone done it?
How would it work with mod_perl?

Cheers,
Levon Barker


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Phil Rhoades
Hi people,

For reasons unrelated to modperl I decided to remove the perl rpms and  
build perl from src . . so now I want to build modperl from src but in  
the INSTALL doc it says:

"Simple install:

% perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs"

but apxs does not exist - does that mean I have to remove the apache  
rpm and build apache from src as well?

Thanks,

Phil.
--
Philip Rhoades
Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW  2001
Australia
Mobile:  +61:0411-185-652
Fax:  +61:2:8923-5363
E-mail:  [EMAIL PROTECTED]
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Ged Haywood
Hi there,

On Sat, 6 Dec 2003, Phil Rhoades wrote:

> % perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs"
> 
> but apxs does not exist - does that mean I have to remove the apache  
> rpm and build apache from src as well?

Yes.  If for no other reason than that you should ensure that Apache
and mod_perl are compiled with the same compiler.

At least I think that's the case with mod_perl version 2 - am I right?

73,
Ged.



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: mod_perl + perl/tk

2003-12-05 Thread Ged Haywood
Hi there,

On Fri, 5 Dec 2003, Levon Barker wrote:

> Can anyone point me to a reference on delivering a GUI to the browser with a
> mod_perl server.

I don't understand your question at all.  Most browsers thesedays present
a graphical user interface.  Would you please explain in more detail?

73,
Ged.


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



RE: mod_perl + perl/tk

2003-12-05 Thread Levon Barker
> Hi there,

Hey.

> On Fri, 5 Dec 2003, Levon Barker wrote:
>
> > Can anyone point me to a reference on delivering a GUI to the
> browser with a
> > mod_perl server.
>
> I don't understand your question at all.  Most browsers thesedays present
> a graphical user interface.  Would you please explain in more detail?

Sorry, if I wasn't clear. Thinking more of an applet type application within
the browser window.

Just thinking it would be nice to be able to deliver an applet of some type,
instead of HTML, which then talks back to my mod_perl server. Maybe Java is
the best solution, but I don't know.

Perhaps this is not the most appropriate list, but I am looking for the
easiest integration with my mod_perl application servers.


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: mod_perl + perl/tk

2003-12-05 Thread Chris Winters
Levon Barker wrote:
Sorry, if I wasn't clear. Thinking more of an applet type application within
the browser window.
Just thinking it would be nice to be able to deliver an applet of some type,
instead of HTML, which then talks back to my mod_perl server. Maybe Java is
the best solution, but I don't know.
Perhaps this is not the most appropriate list, but I am looking for the
easiest integration with my mod_perl application servers.
You can pass data over HTTP to from your Tk app to mod_perl using 
SOAP or some other object serialization protocol.

Chris

--
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: help, $apr->param hangs

2003-12-05 Thread Aleksandr Guidrevitch
Stas Bekman wrote:

As I've already said - if the server times out (in the example above) 
at least once -
it still continue serving requests. But when I press ctrl-c to stop 
the server - it stops
with segmentation fault, that means segmentation fault occurs only 
when the server
get a ctrl-c (sigint). I also tested kill -1  (with 
sighup) - httpd exit with segfault too.
Yep, I tried to eval $apr->request, as well as eval the whole block 
including the code which sets and restores the timeout

Stopping server with Ctrl-C is probably not the best idea ;)
killing with sighup causes the segmentation fault too :)

that perl garbage collector is not executed after the timeout), since 
there is no way to correctly
handle this situation ?
I just wonder how that will influence of the overall stability and 
memory usage (since it seems

I need to see that backtrace in hope to get an idea of what's going on.
How to do that ?
I started httpd within gdb, then send it a sigint:
(gdb) run -X -f /home/ag/development/tauction/conf/httpd.conf
Starting program: /usr/local/apache-perl/bin/httpd -X -f 
/home/ag/development/test/conf/httpd.conf
(no debugging symbols found)...(no debugging symbols found)...[New 
Thread 1024 (LWP 18788)]

Program received signal SIGINT, Interrupt.
[Switching to Thread 1024 (LWP 18788)]
0x402749a4 in read () from /lib/libc.so.6
(gdb) where
#0  0x402749a4 in read () from /lib/libc.so.6
#1  0x401b6ac0 in __JCR_LIST__ () from /lib/libpthread.so.0
#2  0x080a73a0 in ap_bhalfduplex ()
#3  0x080a7519 in ap_bread ()
#4  0x080b5f4b in ap_get_client_block ()
...
If i kill it with `kill -HUP ` :

Program received signal SIGTERM, Terminated.
[Switching to Thread 1024 (LWP 18928)]
0x402749a4 in read () from /lib/libc.so.6
(gdb) where
#0  0x402749a4 in read () from /lib/libc.so.6
#1  0x401b6ac0 in __JCR_LIST__ () from /lib/libpthread.so.0
#2  0x080a73a0 in ap_bhalfduplex ()
#3  0x080a7519 in ap_bread ()
#4  0x080b5f4b in ap_get_client_block ()
...
How else can I debug/backtrace it to catch this segmentation fault ?

Also I came to the following solution:
sub handler {
   ...
   open(F, ">/tmp/test-$$") && close(F);
   $apr->param;
   unlink "/tmp/test-$$";
   ...
}
then another server scans each second /tmp dir for the /^test-(\d+)$/ 
files modified
more than 2 second ago, kill the appropriate process $1 and removes the 
appropriate file in /tmp.
It is ugly, I know... But at the moment I don't see any better solution

Alex



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Jumping out of Apache/mod_perl..

2003-12-05 Thread Jim Morrison [Mailing-Lists]
Hello,

Not sure if this isn't slightly OT, but wonder if someone can help..

I have a piece of one of my mod_perl apps that potentially takes quite a
while to complete.  What I would like to do is to get Apache/mod_perl to
start a second process which would do the work, return a page to the
user, and get on with the next thing.. 

( The page would have a meta-refresh and could be updated by the
separate process so the user would know how things are progressing... )

I've been trying to read up on fork, etc. but it appears that even if I
fork, I have to wait about to clear up after my kids have passed on -
which still leaves me with an Apache/mod_perl process hanging around...

Is there a simple solution? Am I missing something?

Any help or pointing in the right direction would be much appreciated!

Thanks,
Jim


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: help, problems on migrating to mod_perl

2003-12-05 Thread petersm
Sounds like some of those problems are related to your config file. Please
post the relavant sections of your http.conf file.

Michael
Venzia


-- Original Message ---
From: "SRef" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Fri, 5 Dec 2003 11:48:24 -0800
Subject: help, problems on migrating to mod_perl

> Env: Perl5.8 Apache2.0 mod_perl2.0(1.99xx?)
> PS: I did try to find the solution through mod_perl and apache 
> documents, but in vain. Please help me, thanks.
> 
> For example, I have a script file named "index.cgi" for my website 
> entrance, and there are some template files in the same directory 
> with it. index.cgi used to run correctly under "use warnings(FATAL 
> => 'all'); use strict."
> 
> when I try using mod_perl, problems occur:
> 1. when access my site http://localhost, it shows error"cann't open
> http://localhost";; I can only use http://localhost/index.cgi, how to 
> sovle this?
> 
> 2. it shows many error"sub1 redefined.sub2 redefined"when 
> the second time or more to access the index.cgi.
> 
> 3. I use relative path in index.cgi, but it seems all goes mad when
> mod_perl::register reports" can't find file1.tmpl...cann't find file2.tmpl"
> I think when mod_perl::register works the current working 
> directory is somewhere else than where index.cgi is.then i use 
> chdir to change the working directory to where index.cgi is, I just 
> want to know is there any better way to achieve this since we nearly 
> always want the current path to be where your script is, rather than 
> mod_perl::register . I also wonder if chdir will cause any problem with
> mod_perl::register .
> 
> 4. Another error, mod_perl::register:  Unrecognized character \x11 at
> mark.gif. Anything wrong with the gif?
> 
> 5. all globle var in index.cgi used to be "my", but it says requires
> explicity package name? I change it to "local", same proble occurs. 
> When it be"our", no such error any more? I know difference among 
> them in Perl. But can anyone explain them to me for mod_perl? Also,
>  why mod_perl2.0 documents has no info about this? At least, I 
> didn't find.
> 
> 6. use lib './' doesn't work when second(maybe third?) time invoke
> index.cgi.
> I don't want to put the lib file in perl/lib, nor put the line" 
> use lib './' " in "start_up.pl". So is there any way to solve this?
> 
> Thanks very much.
> 
> -- 
> Reporting bugs: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
--- End of Original Message ---


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Ken Corey
> On Fri, 2003-12-05 at 15:09, Jim Morrison [Mailing-Lists] wrote: 
> > I have a piece of one of my mod_perl apps that potentially takes quite a
> > while to complete.  What I would like to do is to get Apache/mod_perl to
> > start a second process which would do the work, return a page to the
> > user, and get on with the next thing.. 

When I run into something like this, I usually end up using a database
as a buffer.  You know, the initializing perl CGI creates a row in the
database iwth enough information to start the operation, and then
returns a 'success' message.

It seems a bit heavyweight at first, but it gives you lots of reporting
flexibility.

There was a daemon that would wake up every so often and ping the
database to see if there were any new rows to process.  As it would
process them it would update the database.

To check on the status, I had another CGI that could query the database
to see progress and return it in a web page.

-Ken


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Phil Rhoades
Ged,


On Sat, 6 Dec 2003, Phil Rhoades wrote:

> % perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs"
>
> but apxs does not exist - does that mean I have to remove the
> apache rpm and build apache from src as well?

Yes.  If for no other reason than that you should ensure that Apache
and mod_perl are compiled with the same compiler.

At least I think that's the case with mod_perl version 2 - am I  
right?


OK - I uninstalled the httpd rpm and installed httpd-2.0.48 .

I get:

[EMAIL PROTECTED] mod_perl-1.99_11]# perl Makefile.PL MP_APXS=/usr/local/ 
apache2/bin/apxs
Reading Makefile.PL args from @ARGV
  MP_APXS = /usr/local/apache2/bin/apxs
Configuring Apache/2.0.48 mod_perl/1.99_11 Perl/v5.9.0
*** configuration file /usr/local/apache2/modules/mod_perl.so does not  
exist
Checking if your kit is complete...

but I am trying to build mod_perl.so so why should it already exist?   
The rest of the configure looks OK.

Then the make fails:

-c modperl_perl.c && mv modperl_perl.o modperl_perl.lo
modperl_perl.c: In function `modperl_hash_seed_set':
modperl_perl.c:226: `PL_rehash_seed' undeclared (first use in this  
function)
modperl_perl.c:226: (Each undeclared identifier is reported only once
modperl_perl.c:226: for each function it appears in.)
modperl_perl.c:227: `PL_rehash_seed_set' undeclared (first use in this  
function)
make[1]: *** [modperl_perl.lo] Error 1
make[1]: Leaving directory `/home/phil/attach/mod_perl-1.99_11/src/ 
modules/perl'
make: *** [modperl_lib] Error 2

Any suggestions?

Thanks,

Phil.
--
Philip Rhoades
Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW  2001
Australia
Mobile:  +61:0411-185-652
Fax:  +61:2:8923-5363
E-mail:  [EMAIL PROTECTED]
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Out of memory, please help,

2003-12-05 Thread Marwan Sultan
Hello there!

Im on FreeBSD 4.8-R
mod_perl-1.27_1 and apache_fp-1.3.27
Openwebmail is my webmail system:
Suddenly the openwebmail site stopped!!
and says "cannot display"
When i chkd the log file for webmail
I found the following errors!
suidperl in free(): warning: recursive call
suidperl in free(): warning: recursive call
suidperl in free(): warning: recursive call
suidperl in free(): warning: recursive call
suidperl in free(): warning: recursive call
suidperl in malloc(): warning: recursive call
Out of memory!
What is this? how i can solve it..Advise please.
and how i can avoide this in future.
Please CC me the answer.

Marwan

_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Ged Haywood
Hello again Phil,

On Sat, 6 Dec 2003, Phil Rhoades wrote:

> modperl_perl.c:226: `PL_rehash_seed' undeclared (first use in this function)

I think this is probably because you're using Perl 5.9.0 - if you look
at the bottom of src/modules/perl/modperl_perl.c you'll see a conditional
which talks about Perl 5.8.1 (sort of:).  Looks to me like it isn't terribly
carfully coded, so it will break with 5.9.x.  If you fiddle about with that
so it does the same for 5.9.0 as for 5.8.1 you might get past it.

OTOH I don't really know what I'm talking about so you might be better
waiting for a reply from someone who does... :)

73,
Ged.


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Rafael Garcia-Suarez
Ged Haywood wrote:
>
> Hello again Phil,
> 
> On Sat, 6 Dec 2003, Phil Rhoades wrote:
> 
> > modperl_perl.c:226: `PL_rehash_seed' undeclared (first use in this function)
> 
> I think this is probably because you're using Perl 5.9.0 - if you look
> at the bottom of src/modules/perl/modperl_perl.c you'll see a conditional
> which talks about Perl 5.8.1 (sort of:).  Looks to me like it isn't terribly
> carfully coded, so it will break with 5.9.x.  If you fiddle about with that
> so it does the same for 5.9.0 as for 5.8.1 you might get past it.
> 
> OTOH I don't really know what I'm talking about so you might be better
> waiting for a reply from someone who does... :)

Here it is :

5.9.0 is broken. mod_perl won't support it. Please don't use it. Wait
for 5.9.1, or use a fresh bleadperl, if you want the shiny new features.

HTH.

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Christian Wetzig
Jim Morrison [Mailing-Lists] wrote:
I have a piece of one of my mod_perl apps that potentially takes quite a
while to complete.  What I would like to do is to get Apache/mod_perl to
start a second process which would do the work, return a page to the
user, and get on with the next thing.. 
I just did the following yesterday (for generating some PDFs and email 
them to the user after finishing). So far it seems to work for me 
(Slackware 9, Apache 2.0.48, mod_perl 1.99.11, Perl 5.8.0). It's adopted 
from:

http://perl.apache.org/docs/1.0/guide/performance.html#Forking_and_Executing_Subprocesses_from_mod_perl

regards,
Christian
--
#!/usr/bin/perl -w
use strict;
use POSIX 'setsid';
# parent code goes here

$SIG{CHLD} = 'IGNORE';
defined (my $kid = fork) or die "Cannot fork: $!\n";
if ($kid) {
  print "Parent $$ has finished, kid's PID: $kid\n";
}
else {
  chdir '/' or die "Can't chdir to /: $!";
  open STDIN, '/dev/null'   or die "Can't read /dev/null: $!";
  open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
  # comment this out, if you want to keep apache error log, works for me
  open STDERR, '>/tmp/log' or die "Can't write to /tmp/log: $!";
  setsid or die "Can't start a new session: $!";
  my $oldfh = select STDERR;
  local $| = 1;
  select $oldfh;
  warn "started background task foo from $0\n";
  # do something time-consuming
  sleep 1, warn "$_\n" for 1..20;
  warn "finished background task foo from $0\n";
  CORE::exit(0); # terminate the process
}
# other parent code



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Out of memory, please help,

2003-12-05 Thread Ken Y. Clark
On Fri, Dec 05, 2003 at 04:33:07PM +, Marwan Sultan wrote:
> 
> Hello there!
> 
> Im on FreeBSD 4.8-R
> mod_perl-1.27_1 and apache_fp-1.3.27
> Openwebmail is my webmail system:
> 
> Suddenly the openwebmail site stopped!!
> and says "cannot display"
> When i chkd the log file for webmail
> I found the following errors!
> 
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in malloc(): warning: recursive call
> Out of memory!
> 
> 
> What is this? how i can solve it..Advise please.
> and how i can avoide this in future.
> 
> Please CC me the answer.
> 
> Marwan

Marwan,

This doesn't sound like a mod_perl problem but a bug in
the "Openwebmail" application (the "recursive call"
stuff).  Probably you'll have to debug the code yourself
or submit a bug report to the original developers.

ky


pgp0.pgp
Description: PGP signature


Re: Out of memory, please help,

2003-12-05 Thread Ged Haywood
Hello,

On Fri, 5 Dec 2003, Marwan Sultan wrote:

> Im on FreeBSD 4.8-R mod_perl-1.27_1 and apache_fp-1.3.27
> [snip]
> Suddenly the openwebmail site stopped!!
> [snip]
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in free(): warning: recursive call
> suidperl in malloc(): warning: recursive call
> Out of memory!

Looks nasty.  Recursive means that something that calls itself.  If
nothing stops that process, it will eventually fall over, often by
consuming all available memory as apparently in this case.  I have
very little idea why it might happen. It could be a fault in your
openwebmail package, your configuration of that package or perhaps one
of your scripts.  Have you tried asking on the Openwebmail list?

> and how i can avoide this in future.

How much memory do you have in the system and what else is it running?
Have you seen the mod_perl Guide sections on memory usage?  Will you
send us your httpd.conf file?

Buying more memory will probably only delay the symptom by a few
milliseconds next time it happens.  You need to fix the problems in
the code/scripts/config, or use a different package?

If this message were sent to you by the mod_perl List server, there
would be links to useful information at the bottom.  That's as good a
reason to subscribe as any. :)

73,
Ged.



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Larry Leszczynski
On Fri, 5 Dec 2003, Jim Morrison [Mailing-Lists] wrote:

> I have a piece of one of my mod_perl apps that potentially takes quite a
> while to complete.  What I would like to do is to get Apache/mod_perl to
> start a second process which would do the work, return a page to the
> user, and get on with the next thing.. 
> 
> ( The page would have a meta-refresh and could be updated by the
> separate process so the user would know how things are progressing... )

Not specific to mod_perl, but I like Randal's scheme for doing this kind
of thing (the example in the article is a CGI script but could just as
easily be a mod_perl handler):

   http://marc.theaimsgroup.com/?l=apache-modperl&m=104538145031668&w=2


Larry Leszczynski
[EMAIL PROTECTED]



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Help! PerlPreConnectionHandler not called

2003-12-05 Thread Weixian Shen
I wrote a simple handler that for preconnection phase. But it wasn't
called. I used PerlPreConnectionHandler directive in perl.conf which is
included by httpd.conf. I made intentional syntax error in the module,
restart apache, but no error log, everything works as before. If I were to
add the same module to PerlProcessConnectionHandler then I do see the
error message. What's wrong?

Environment: Redhat 9, Perl 5.8.0, Apache 2.0.40, mod_perl 1.99_07.5
everything is standard RPM from redhat up2date, latested.

I would appreciate any help or pointer you can give. I am totally clueless
here.


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Cees Hek
Jim Morrison [Mailing-Lists] wrote:
Hello,

Not sure if this isn't slightly OT, but wonder if someone can help..
It seems on topic to me...

I have a piece of one of my mod_perl apps that potentially takes quite a
while to complete.  What I would like to do is to get Apache/mod_perl to
start a second process which would do the work, return a page to the
user, and get on with the next thing.. 
Using fork is expensive.  It will use up as much memory as the current 
child is already using, so you might as well just use the current child 
to finished the processing.

What I usually do in this situation is to register a cleanup handler 
that does the actual processing.  This means the child is locked up 
until the processing is complete, but the client is free to continue 
browsing since the cleanup phase runs after the request phase has 
already finished.

Just add something like the following to your code.

$request->register_cleanup(sub { # Do your heavy processing here });

If you are going to have a lot of clients using this page 
simultaneously, then you will need to make sure that all your child 
processes aren't taken up by these long running programs.  Otherwise any 
new requests will block until a child process is avaliable.

Along with the other suggestions that have already been made, you should 
have some options to look into now...

Cheers,

Cees



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Apache::AuthenNTLM-2.04 - missing NTLM header info

2003-12-05 Thread Harris, Jason (DIS)
Hello all,

I am running 

Apache 1.3.28
Perl 5.8
mod_perl 1.29
Apache::AuthenNTLM-2.04 
Solaris 2.9

Client: Windows 2000 Professional, IE 6.0.2800.1106

DC: Windows 2003 Server, AD

Each time I try the directory, I get the following in the errorlog

[20896] AuthenNTLM: Config Domain = dis  pdc = 198.238.113.11  bdc =
[20896] AuthenNTLM: Config Default Domain = dis
[20896] AuthenNTLM: Config Fallback Domain = dis
[20896] AuthenNTLM: Config AuthType = ntlm AuthName =
[20896] AuthenNTLM: Config Auth NTLM = 1 Auth Basic = 0
[20896] AuthenNTLM: Config NTLMAuthoritative = on  BasicAuthoritative = on
[20896] AuthenNTLM: Config Semaphore key = 23754 timeout = 2
[20896] AuthenNTLM: Authorization Header 
[Fri Dec  5 10:20:05 2003] [error] access to /nttest failed for  , reason:
Bad/Missing NTLM/Basic Authorization Header for /nttest
[20896] AuthenNTLM: Start NTLM Authen handler pid = 20896, connection =
2811592 conn_http_hdr = Keep-Alive  main =  cuser =  remote_ip =
198.238.112.187 remote_port =  remote_host = < > version = 2.04
[20896] AuthenNTLM: Object exists user = \
[20896] AuthenNTLM: Authorization Header NTLM
[20896] AuthenNTLM: protocol=NTLMSSP, type=1,
flags1=7(NEGOTIATE_UNICODE,NEGOTIATE_OEM,REQUEST_TARGET),
flags2=178(NEGOTIATE_ALWAYS_SIGN,NEGOTIATE_NTLM), domain length=3, domain
offset=43, host length=11, host offset=32, host=DISWKJASONH, domain=DIS
[20896] AuthenNTLM: Connect to pdc = 198.238.113.11 bdc =  domain = dis
[20896] AuthenNTLM: enter lock
[Fri Dec  5 10:20:08 2003] [error] access to /nttest failed for  , reason:
Connect to SMB Server faild (pdc = 198.238.113.11 bdc =  domain = dis error
= -11/0) for /nttest
[20896] AuthenNTLM: leave lock
[Fri Dec  5 10:20:08 2003] [error] access to /nttest failed for  , reason:
Cannot get nonce


It seems like there should be some gobbledee-gook after the AuthenNTLM:
Authorization Header NTLM line,  like a bunch of numbers and stuff.I
think.   This is my first try with this module.   Does this module do ok
with AD enabled domain controllers ?  Does the Solaris/Apache server need to
have samba running/be joined into the domain ?

Any help would be greatly appreciated.  Thanks

Jason Harris


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Charles C. Fu
In <[EMAIL PROTECTED]> on 05 Dec 2003,
   Cees Hek <[EMAIL PROTECTED]> wrote:
> Using fork is expensive.  It will use up as much memory as the
> current child is already using, so you might as well just use the
> current child to finished the processing.

In most OSes, fork just sets the memory to copy-on-write, makes
another process table slot,   It doesn't actually copy the memory,
so the memory cost is small.

In some cases (most notably Windows using Cygwin w/o copy-on-write
semantics), fork is emulated by copy the parent's memory.  In this
case, the memory cost certainly is significant.

-ccwf
-- 
Charles C. Fu   ,--
Founder___  __ __. . ,-/--
Web i18n, LLC  (_,(_,|/|/ /
www.web-i18n.net '

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Big Memory problem -Windows Apache 2.0.47, mod_perl-1.99_11, perl 5.8.0

2003-12-05 Thread Dany Ayotte
Hello

I have written a large web service application entirely written in Perl, 
build as Apache::Registry under mod_perl-1.99_11 build with perl 5.8.0 
under Apache 2.0.47, all compile with Microsoft visual C++ 6.0.

The same application run fine without too much memory leak on Linux 
(Apacge 1.3.x, mod_perl 1.27, perl 5.8.0) and Apple Mac OS/X, even on 
Solaris 8.0.

On Windows, that's another story. Each connection to Apache, the Apache 
process clone himself and double the amount of memory required to run. 
Worst, the memory is never released back to the OS until the Apache 
service is restart or until the computer is put on his knees. What's 
going wrong? I did not want to use Apache 1.x  on Windows because of the 
threading issue.

It look like a threading issue related to perl. I have a very small perl 
program which create thread and each thread created double the amount of 
memory required by the program. Does anybody have any clues?

Thanks
--
Dany Ayotte, Teamsoft Inc.


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: [mp2] 3rd-party module porting status

2003-12-05 Thread speeves

Did you send it to [EMAIL PROTECTED]

Yeah, Graham Barr gave me rights to all of the other mods.  Just didn't 
hear from anyone else on those two...

IMHO, it'd be silly to upload a new version for this purpose. Users 
will try to get the new version which has no functional or even 
documentation change. We know that your module is ported to 2.0, so 
you can just leave it as is.

As suggested in the other followup it's the META.yml that will need to 
be updated, not Changes. But there is a lot of dust around it at the 
moment and we need to wait for it to settle down.
Thanks, I agree.  Didn't know if I should just for kicks though...

speeves
cws
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Comments on Struts-like mod_perl module

2003-12-05 Thread Gunther Birznieks


Stuart Moffatt wrote:

All,

About a month ago, I was put on a project that was perl-based, but with no
framework. As our GUI team develops mostly in java, and now mostly with
struts, I came to love the MVC architecture. Simple to estimate, design, and
maintain. I loved struts mvc so much that I implemented a struts-like
framework in plain old CGI. I used it for the perl project with great
success: quick, modular development from the client to the API.
 

I like this as well. How is the performance under CGI though? Do you 
support an identical config to struts? Which version of struts do you 
support?

Do you sit on top of wombat? The Perl Servlet API?

I called it Straps (STRuts - A Perl Substitute). [Struts-developers: Let me
know if I've broken the rules for embedding Struts in the nickname]. It is a
bit of a cutesy name, but I didn't want to assume I could use Struts.pm --
and it really isn't just an interface to a struts-ish servlet, it actually
replaces one.
 

Sounds good to me.

The main controller, rather than a java servlet, is a cgi installed in the
docroot at /straps/servlet.cgi
All requests go through this cgi, fire off Actions and ActionForms (just
like struts), store data in the session. and then land on a resulting cgi
page that would get the data out of the session and load up an
HTML::Template for the view. The ActionForms contain our application data
models. 

 

Interesting! Do you emulate the Struts widgets in HTML::Template?

All in all, a rudimentary, but working version of a perl implementation of
struts.
But like most CGI apps, there were failings (performance, URI control, etc)

In the last two weeks, I've converted the "servlet" cgi to mod_perl, and
made it look like a real struts servlet. I have not ported the application
yet, but I have a new project that is also perl so I will build this app on
top of the mod_perl version of Straps, which I am tentatively calling
Apache::Straps. You all know the kinds of speed improvements I've seen
(100-150x on the loading of the framework alone with a small test
application), not to mention the hooks into the URI-mapping and request
cycle that I am ecstatic about.
 

I think the Apache-specific one should be Apache::App::Straps (similar 
to Chris' thing) but that you should make this module as Apache-specific 
as possible but require CGI::Straps or Straps or CGI::App::Straps as the 
core set of modules that defines straps.

If you put this project primarily under the Apache::* namespace, it will 
be mistakenly branded as being Apache-specific which it shouldn't be IMHO. 

The best two examples of modules that were created under Apache::* 
namespace and still (I believe) confuse people into thinking they are 
only for mod_perl is Apache::Session (which can be used for CGIs) and 
Apache::DBI (which can be used for other persistent Perl environments). 
I personally believe you should avoid this problem.

In addition, there are many other mechanisms for improving performance 
of CGI from SpeedyCGI and I think Matt Sergeant has a PersistentPerl 
interface, and then there is ActiveState's PerlEx (Not greatly supported 
these days but it does exist )for IIS and Velocigen as a commercial 
product to embed Perl in Netscape And ISAPI Servers like IIS... etc..

So I think if a group of people used SpeedyCGI, you might find your CGI 
version of Straps having reasonable performance.

Anyway, I thought the Right Thing To Do was get the idea out on this list
before any upload to CPAN, etc. I suppose at some point I'd have to talk to
the Struts people to find out if they mind as the framework and config file
uses the same naming conventions as struts.
Comments?

 

Where is the website? straps.sourceforge.com? :)

Is there a mailing list I can subscribe to? You might want to also cross 
post to the p5ee mailing list ... as servlet API to some degree falls a 
little bit under p5ee (servlets being a part of j2ee).

Good Luck!
Gunther




--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: a modperl wiki?

2003-12-05 Thread Les Mikesell
From: "justin" <[EMAIL PROTECTED]>


> can anyone on the list recommend me a good modperl+mysql based Wiki
> engine?

Twiki (http://twiki.org/) works great with mod_perl but it uses rcs
to keep version-controlled text files in the filesystem instead of
using mysql.   

---
  Les Mikesell
[EMAIL PROTECTED]


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: help, $apr->param hangs

2003-12-05 Thread Stas Bekman
Aleksandr Guidrevitch wrote:

I need to see that backtrace in hope to get an idea of what's going on.


How to do that ?
I started httpd within gdb, then send it a sigint:
(gdb) run -X -f /home/ag/development/tauction/conf/httpd.conf
Starting program: /usr/local/apache-perl/bin/httpd -X -f 
/home/ag/development/test/conf/httpd.conf
(no debugging symbols found)...(no debugging symbols found)...[New 
Thread 1024 (LWP 18788)]
why do you send it any signal at all? You say that it segfaults on its own 
when timeout happens. Just start the program under gdb and then issue that 
request that triggers the segfault.

Also I came to the following solution:
sub handler {
   ...
   open(F, ">/tmp/test-$$") && close(F);
   $apr->param;
   unlink "/tmp/test-$$";
   ...
}
then another server scans each second /tmp dir for the /^test-(\d+)$/ 
files modified
more than 2 second ago, kill the appropriate process $1 and removes the 
appropriate file in /tmp.
It is ugly, I know... But at the moment I don't see any better solution
Hmm, I wonder if Apache::Request should be changed to let the user control the 
timeout, without the backtrace I can't tell where the problem is, but if it's 
due to perl, then setting it on the C level before it reads the data might be 
different. Since it works fine after 300 secs timeout, isn't it?

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Stas Bekman
Rafael Garcia-Suarez wrote:

5.9.0 is broken. mod_perl won't support it. Please don't use it. Wait
for 5.9.1, or use a fresh bleadperl, if you want the shiny new features.
Or use 5.8.2.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: RH9.0, httpd-2.0.40-21.i386.rpm, perl-5.9.0

2003-12-05 Thread Stas Bekman
Phil Rhoades wrote:

[EMAIL PROTECTED] mod_perl-1.99_11]# perl Makefile.PL MP_APXS=/usr/local/ 
apache2/bin/apxs
Reading Makefile.PL args from @ARGV
  MP_APXS = /usr/local/apache2/bin/apxs
Configuring Apache/2.0.48 mod_perl/1.99_11 Perl/v5.9.0
*** configuration file /usr/local/apache2/modules/mod_perl.so does not  
exist
Checking if your kit is complete...

but I am trying to build mod_perl.so so why should it already exist?   
The rest of the configure looks OK.
It tries to inherit the config data from your globally installed apache's 
httpd.conf. Check that you don't load mod_perl.so from that globally installed 
httpd.conf.

In any case it's harmless in this particular .

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Stas Bekman
Cees Hek wrote:
Jim Morrison [Mailing-Lists] wrote:

Hello,

Not sure if this isn't slightly OT, but wonder if someone can help..


It seems on topic to me...

I have a piece of one of my mod_perl apps that potentially takes quite a
while to complete.  What I would like to do is to get Apache/mod_perl to
start a second process which would do the work, return a page to the
user, and get on with the next thing.. 


Using fork is expensive.  It will use up as much memory as the current 
child is already using, so you might as well just use the current child 
to finished the processing.
That will work only if you care to wait for all processes to finish untill you 
can restart apache. forking and detaching the process allows you shutdown your 
httpd servers without affecting your long term processes.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: a modperl wiki?

2003-12-05 Thread Wim Kerkhoff
Les Mikesell wrote:

From: "justin" <[EMAIL PROTECTED]>

 

can anyone on the list recommend me a good modperl+mysql based Wiki
engine?
   

That's a pretty vague request... what features are you looking for?

Twiki (http://twiki.org/) works great with mod_perl but it uses rcs
to keep version-controlled text files in the filesystem instead of
using mysql.   
 

If a more simple Wiki environment is required (one without the 
proverbial kitchen sink), perhaps have a look at Apache::MiniWiki. It's 
uses Rcs.pm for doing checkouts, commits, diffs, merges, logs, etc. This 
module runs as either a mod_perl handler or under Apache::Registry.

Wim

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Big Memory problem -Windows Apache 2.0.47, mod_perl-1.99_11, perl 5.8.0

2003-12-05 Thread Stas Bekman
Dany Ayotte wrote:
Hello

I have written a large web service application entirely written in Perl, 
build as Apache::Registry under mod_perl-1.99_11 build with perl 5.8.0 
under Apache 2.0.47, all compile with Microsoft visual C++ 6.0.

The same application run fine without too much memory leak on Linux 
(Apacge 1.3.x, mod_perl 1.27, perl 5.8.0) and Apple Mac OS/X, even on 
Solaris 8.0.

On Windows, that's another story. Each connection to Apache, the Apache 
process clone himself and double the amount of memory required to run.
It probably doesn't double, but adds the size of one thread.

Worst, the memory is never released back to the OS until the Apache 
service is restart or until the computer is put on his knees. What's 
going wrong? I did not want to use Apache 1.x  on Windows because of the 
threading issue.
Yes, but once the cloned perl interpreter has finished serving the request 
it's available for the next request. So it's not ever growing. Say you have at 
most 10 concurrent requests to modperl. You will need only 10 perl 
interpreters to satisfy them.

It look like a threading issue related to perl. I have a very small perl 
program which create thread and each thread created double the amount of 
memory required by the program. Does anybody have any clues?
If you can reproduce the problem with plain perl, there is no surprise you can 
see it with mod_perl. perl ithreads clone all the mutables data, and share 
only the OpCode tree (if it was preloaded at the server startup). So depending 
on whether you have a lot of mutable data or not, you will have more or less 
memory used.

Unfortunately threads don't benefit from forked process memory sharing, 
because they are designed to share everything created before they were spawned 
(Which is even better than forked sharing). But perl ithreads are a totally 
different beast. I believe they were implemented this way to make it easier 
for users, you don't have to worry about your variables when you run a program 
under threads. Of course memory is a bit of an issue here. So does the 
slowness of the perl_clone() (which is the function used to clone new 
interpreters).

So for some applications threaded perl/modperl will be a good choice, for 
others won't. Too bad win32 has no options and stuck with threads. On Unix we 
have the good old prefork mpm for the kind of apps with a lot of mutable data, 
and the worker mpm for apps benefitting from threads.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Help! PerlPreConnectionHandler not called

2003-12-05 Thread Stas Bekman
Weixian Shen wrote:
I wrote a simple handler that for preconnection phase. But it wasn't
called. I used PerlPreConnectionHandler directive in perl.conf which is
included by httpd.conf. I made intentional syntax error in the module,
restart apache, but no error log, everything works as before. If I were to
add the same module to PerlProcessConnectionHandler then I do see the
error message. What's wrong?
Environment: Redhat 9, Perl 5.8.0, Apache 2.0.40, mod_perl 1.99_07.5
everything is standard RPM from redhat up2date, latested.
I would appreciate any help or pointer you can give. I am totally clueless
here.
I can't see that problem with the current cvs (and probably 1.99_11). Please 
upgrade to 1.99_11 or cvs and try again, if the problem persists please post a 
short handler that you having a problem with. Thanks.

p.s. In the future we'd appreciate to receive complete bug reports as 
explained at http://perl.apache.org/bugs/. Thanks.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: help, problems on migrating to mod_perl

2003-12-05 Thread Randy Kobes
On Fri, 5 Dec 2003, SRef wrote:

> Env: Perl5.8 Apache2.0 mod_perl2.0(1.99xx?) PS: I did try
> to find the solution through mod_perl and apache
> documents, but in vain. Please help me, thanks.
>
> For example, I have a script file named "index.cgi" for my
> website entrance, and there are some template files in the
> same directory with it. index.cgi used to run correctly
> under "use warnings(FATAL => 'all'); use strict."
>
> when I try using mod_perl, problems occur:
> 1. when access my site http://localhost, it shows error"cann't open
> http://localhost";; I can only use http://localhost/index.cgi, how to sovle
> this?

This seems like a problem with your Apache configuration -
see the docs at http://httpd.apache.org/ for details.

> 2. it shows many error"sub1 redefined.sub2 redefined"when the second
> time or more to access the index.cgi.

This might be using modules or subroutines whose names
coincide - it's hard to know without seeing a simple
example of your script.

> 3. I use relative path in index.cgi, but it seems all goes mad when
> mod_perl::register reports" can't find file1.tmpl...cann't find file2.tmpl"
> I think when mod_perl::register works the current working directory is
> somewhere else than where index.cgi is.
> then i use chdir to change the working directory to where index.cgi is,
> I just want to know is there any better way to achieve this since we nearly
> always want the current path to be where your script is, rather than
> mod_perl::register . I also wonder if chdir will cause any problem with
> mod_perl::register .

There's been discussion of this in the past - search the
archives of the mod_perl mailing list (links are available
from http://perl.apache.org/) for a discussion.

> 4. Another error, mod_perl::register:  Unrecognized character \x11 at
> mark.gif. Anything wrong with the gif?

Does the gif display OK when loaded in a browser? Again,
a simple example illustrating the problem would help.

> 5. all globle var in index.cgi used to be "my", but it
> says requires explicity package name? I change it to
> "local", same proble occurs. When it be"our", no such
> error any more? I know difference among them in Perl. But
> can anyone explain them to me for mod_perl? Also, why
> mod_perl2.0 documents has no info about this? At least, I
> didn't find.

Try searching at http://perl.apache.org/ for, for example,
"scoped variable" - this might lead you to what you're
looking for.

> 6. use lib './' doesn't work when second(maybe third?) time invoke
> index.cgi.
> I don't want to put the lib file in perl/lib, nor put the line" use lib
> './' " in "start_up.pl". So is there any way to solve this?

As with most of the previous questions, it would help quite
a bit to see a short snippet of code illustrating the
problem, what the error logs say, if anything, and the
relevant part of your httpd.conf.

-- 
best regards,
randy kobes

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Jumping out of Apache/mod_perl..

2003-12-05 Thread Cees Hek
Stas Bekman wrote:
Cees Hek wrote:

Using fork is expensive.  It will use up as much memory as the current 
child is already using, so you might as well just use the current 
child to finished the processing.
That will work only if you care to wait for all processes to finish 
untill you can restart apache. forking and detaching the process allows 
you shutdown your httpd servers without affecting your long term processes.
I guess it depends on how long the process is going to take.  I should 
have mentioned that I would only use this for something that is going to 
run for a few minutes.  Long enough for a user to get anoyed and be 
tempted to press stop or refresh in the browser.

If it is truely a long term process, then it will definately be better 
to fork (or to use the other suggestion of a daemon process looking for 
new work in a specified location)

Cheers,

Cees

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html