Re: DBI Connectons accumulate under Mod_perl

2009-11-16 Thread Artem Kuchin



Perrin Harkins:

On Fri, Nov 13, 2009 at 4:47 AM, Artem Kuchin  wrote:
  

Nope, i don't use those. Just plain DBI. Parent process does not open up any
connections.



This is getting really confusing because two of you are on this thread
with completely different problems.

Artem, if you aren't using Apache::DBI and your connections are
building up, it means you're keeping the connections around in a
global or closure variable and not calling disconnect.  Since you
aren't using something to keep your connections persistent, you should
call disconnect at the end of every request.  You should also look at
your code to see if you put $dbh in a global somewhere.

- Perrin
  

I am the original poster. Someone else has stolen my thread.
Anyway.
I AM calling disconnect  and the thing is wrapped in
sub handler {
   my $db=...

   ...

   $db->disconnect();
}

So, everything goes out of scope when handler finishes. I made it so to 
play nice with mod_per. NO globals

at all.

The apache run two site with such code. One site does not have a problem 
another builds up the connection.
It might be related to windows (it is all under windows and i never had 
such problem under freebsd).


Artem



Re: DBI Connectons accumulate under Mod_perl

2009-11-16 Thread David E. Wheeler
On Nov 16, 2009, at 1:10 AM, Artem Kuchin wrote:

> I am the original poster. Someone else has stolen my thread.
> Anyway.
> I AM calling disconnect  and the thing is wrapped in
> sub handler {
>   my $db=...
> 
>   ...
> 
>   $db->disconnect();
> }
> 
> So, everything goes out of scope when handler finishes. I made it so to play 
> nice with mod_per. NO globals
> at all.
> 
> The apache run two site with such code. One site does not have a problem 
> another builds up the connection.
> It might be related to windows (it is all under windows and i never had such 
> problem under freebsd).

Maybe you have a system call or some other forking call that can lead to stray 
handles? Some Perl modules will do it without you knowing. I suggest switching 
to DBIx::Connector, which detects such things, to see if it helps.

Best,

David

Re: _apr_bucket_shared_copy symbol not found

2009-11-16 Thread Philippe M. Chiasson

On 09-11-14 14:43 , Fred Moyer wrote:

Platform:  Snow Leopard

Versions used:  perl 5.10.1, mod_perl 2.0.5-dev, httpd 2.2.14

Error found during make test:

t/apr-ext/uuid.t  Can't load
'/Users/phred/dev/svn/modperl/mod_perl-2.0/blib/arch/auto/APR/APR.bundle'
for module APR:
dlopen(/Users/phred/dev/svn/modperl/mod_perl-2.0/blib/arch/auto/APR/APR.bundle,
9): Symbol not found: _apr_bucket_shared_copy

I compiled apache using the --with-included-apr option.  This is a new
toolchain setup.  Any thoughts?


Can you send me the exact version of httpd you built, and with what 
arguments?
mod_perl Makefile.PL arguments too. I just upgraded to Snow Leopard, so 
I should be able to try and reproduce.


--
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm)\.org/


Getting domain info on each hit.

2009-11-16 Thread Devrim Yasar
Hi,We want to retrieve URL and use it inside our vhosts, realtime.To demonstrate my case, I placed random numbers on ServerAdmin directive (just to test),$ServerAdmin = int(rand(100))."lo...@koko.com";As you may know, this random number is assigned only when you restart the server, and never changes until another restart.This is what we want: if julie.myperl.com is the requested domain, then $ServerAdmin = ju...@myperl.com, that is, realtime.Hopefully there is a solution, since this will help us remove thousands of config files, and save us from thousands of apache reloads.Thanks,Devrimhere is kind of similar situation and solution,http://httpd.apache.org/docs/1.3/mod/mod_vhost_alias.htmland here is why ask this question,we have built an API in which subdomains signify unix account names,so variable part of {$user}.kodingen.com must be used within vhost conf.http://serverfault.com/questions/84582/using-variables-within-apache-virtualhost-containers

Re: _apr_bucket_shared_copy symbol not found

2009-11-16 Thread Fred Moyer
On Mon, Nov 16, 2009 at 10:23 AM, Philippe M. Chiasson
 wrote:
> On 09-11-14 14:43 , Fred Moyer wrote:
>>
>> Platform:  Snow Leopard
>>
>> Versions used:  perl 5.10.1, mod_perl 2.0.5-dev, httpd 2.2.14
>>
>> Error found during make test:
>>
>> t/apr-ext/uuid.t  Can't load
>> '/Users/phred/dev/svn/modperl/mod_perl-2.0/blib/arch/auto/APR/APR.bundle'
>> for module APR:
>>
>> dlopen(/Users/phred/dev/svn/modperl/mod_perl-2.0/blib/arch/auto/APR/APR.bundle,
>> 9): Symbol not found: _apr_bucket_shared_copy
>>
>> I compiled apache using the --with-included-apr option.  This is a new
>> toolchain setup.  Any thoughts?
>
> Can you send me the exact version of httpd you built, and with what
> arguments?
> mod_perl Makefile.PL arguments too. I just upgraded to Snow Leopard, so I
> should be able to try and reproduce.

httpd:
 ~/dev/httpd-2.2.14 $ ./configure --with-included-apr
--prefix=/Users/phred/dev/httpd2/

mod_perl
~/dev/svn/modperl/mod_perl-2.0 $ perl Makefile.PL
MP_APXS=/Users/phred/dev/httpd2/bin/apxs

I've attached my config.status if that is needed.  Made an attempt at
inlining it but iterm and gmail don't lend well to doing such things.

Thanks for taking a look, let me know if you need any other info.

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

  Platform:
osname=darwin, osvers=10.0.0, archname=darwin-2level
uname='darwin pooky.redhotpenguin.com 10.0.0 darwin kernel version
10.0.0: fri jul 31 22:47:34 pdt 2009; root:xnu-1456.1.25~1release_i386
i386 i386 '
config_args='-Dprefix=/Users/phred/dev/perl-5.10.1'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-I/opt/local/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -I/opt/local/include'
ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
  Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='
-fstack-protector -L/usr/local/lib -L/opt/local/lib'
libpth=/usr/local/lib /opt/local/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
-L/usr/local/lib -L/opt/local/lib -fstack-protector'


Characteristics of this binary (from libperl):
  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
  Built under darwin
  Compiled at Nov 13 2009 15:49:27
  @INC:
/Users/phred/dev/perl-5.10.1/lib/5.10.1/darwin-2level
/Users/phred/dev/perl-5.10.1/lib/5.10.1
/Users/phred/dev/perl-5.10.1/lib/site_perl/5.10.1/darwin-2level
/Users/phred/dev/perl-5.10.1/lib/site_perl/5.10.1


config.status
Description: Binary data


Re: Getting domain info on each hit.

2009-11-16 Thread Philippe M. Chiasson
On 09-11-16 13:54 , Devrim Yasar wrote:
> Hi,
> 
> We want to retrieve URL and use it inside our vhosts, realtime.
> 
> To demonstrate my case, I placed random numbers on ServerAdmin directive
> (just to test),
> 
> 
> $ServerAdmin = int(rand(100))."lo...@koko.com";
> 
> 
> 
> 
> 
> As you may know, this random number is assigned only when you restart
> the server, and never changes until another restart.
> 
> This is what we want: 
> 
> if julie.myperl.com  is the requested domain,
> then $ServerAdmin = ju...@myperl.com , that is,
> realtime.
> 
> Hopefully there is a solution, since this will help us remove thousands
> of config files, and save us from thousands of apache reloads.

Something like this is probably what you are looking like

$r->server->server_hostname;
$r->server->server_admin('ju...@myperl.com');

Read from here:



-- 
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm)\.org/



signature.asc
Description: OpenPGP digital signature


Re: _apr_bucket_shared_copy symbol not found

2009-11-16 Thread Fred Moyer
On Mon, Nov 16, 2009 at 10:58 AM, Fred Moyer  wrote:
> On Mon, Nov 16, 2009 at 10:23 AM, Philippe M. Chiasson
>  wrote:
>> On 09-11-14 14:43 , Fred Moyer wrote:
>>>
>>> Platform:  Snow Leopard
>>>
>>> Versions used:  perl 5.10.1, mod_perl 2.0.5-dev, httpd 2.2.14
>>>
>>> Error found during make test:
>>>
>>> t/apr-ext/uuid.t  Can't load
>>> '/Users/phred/dev/svn/modperl/mod_perl-2.0/blib/arch/auto/APR/APR.bundle'
>>> for module APR:
>>>
>>> dlopen(/Users/phred/dev/svn/modperl/mod_perl-2.0/blib/arch/auto/APR/APR.bundle,
>>> 9): Symbol not found: _apr_bucket_shared_copy
>>>
>>> I compiled apache using the --with-included-apr option.  This is a new
>>> toolchain setup.  Any thoughts?
>>
>> Can you send me the exact version of httpd you built, and with what
>> arguments?
>> mod_perl Makefile.PL arguments too. I just upgraded to Snow Leopard, so I
>> should be able to try and reproduce.
>
> httpd:
>  ~/dev/httpd-2.2.14 $ ./configure --with-included-apr
> --prefix=/Users/phred/dev/httpd2/
>
> mod_perl
> ~/dev/svn/modperl/mod_perl-2.0 $ perl Makefile.PL
> MP_APXS=/Users/phred/dev/httpd2/bin/apxs

Looks like this was a rogue apr library installed by MacPorts that had
gotten into my LDPATH.  Saw a similar error building with
Crypt::SSLeay and figured out what was going on.

All tests successful!


>
> I've attached my config.status if that is needed.  Made an attempt at
> inlining it but iterm and gmail don't lend well to doing such things.
>
> Thanks for taking a look, let me know if you need any other info.
>
> Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
>
>  Platform:
>    osname=darwin, osvers=10.0.0, archname=darwin-2level
>    uname='darwin pooky.redhotpenguin.com 10.0.0 darwin kernel version
> 10.0.0: fri jul 31 22:47:34 pdt 2009; root:xnu-1456.1.25~1release_i386
> i386 i386 '
>    config_args='-Dprefix=/Users/phred/dev/perl-5.10.1'
>    hint=recommended, useposix=true, d_sigaction=define
>    useithreads=undef, usemultiplicity=undef
>    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
>    use64bitint=define, use64bitall=define, uselongdouble=undef
>    usemymalloc=n, bincompat5005=undef
>  Compiler:
>    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp
> -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
> -I/opt/local/include',
>    optimize='-O3',
>    cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN
> -no-cpp-precomp -fno-strict-aliasing -pipe -fstack-protector
> -I/usr/local/include -I/opt/local/include'
>    ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)', gccosandvers=''
>    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
>    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
>    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
> lseeksize=8
>    alignbytes=8, prototype=define
>  Linker and Libraries:
>    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='
> -fstack-protector -L/usr/local/lib -L/opt/local/lib'
>    libpth=/usr/local/lib /opt/local/lib /usr/lib
>    libs=-ldbm -ldl -lm -lutil -lc
>    perllibs=-ldl -lm -lutil -lc
>    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
>    gnulibc_version=''
>  Dynamic Linking:
>    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
>    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
> -L/usr/local/lib -L/opt/local/lib -fstack-protector'
>
>
> Characteristics of this binary (from libperl):
>  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
>                        USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
>  Built under darwin
>  Compiled at Nov 13 2009 15:49:27
> �...@inc:
>    /Users/phred/dev/perl-5.10.1/lib/5.10.1/darwin-2level
>    /Users/phred/dev/perl-5.10.1/lib/5.10.1
>    /Users/phred/dev/perl-5.10.1/lib/site_perl/5.10.1/darwin-2level
>    /Users/phred/dev/perl-5.10.1/lib/site_perl/5.10.1
>


code in sections executed twice in same process?

2009-11-16 Thread E R
Hi -

I am using mod-perl 1.3.41 with perl 5.8.9.

The only perl I have in my config file is:


  warn "This is a  section in process $$ at time @{[time]}\n";
  sleep(5);
  warn "Done sleeping\n";


When I start it up in single process mode (-X), I'll something like
this on stderr (to the console):

This is a  section in process 25597 at time 1258408992
Done sleeping

And also in the error log I'll see:

This is a  section in process 25597 at time 1258408998
Done sleeping

The pids will be the same, but the times will be different (about 5
secs. apart.)

Is this "normal", and what can I do so that the code in 
sections is only executed once in the parent process?

Thanks,
ER


Re: code in sections executed twice in same process?

2009-11-16 Thread André Warnier

E R wrote:
...


Is this "normal", and what can I do so that the code in 
sections is only executed once in the parent process?

I believe it is "normal", in the sense that Apache actually parses its 
configuration at least twice : one time "just for checking", then it 
throws everything away and parses it a second time "for real".


Then it will even (probably) run your section again, each time it starts 
a new child process.


You probably really want to read the following 2 pages :
http://perl.apache.org/docs/2.0/user/handlers/server.html
http://perl.apache.org/docs/2.0/user/config/custom.html