yaml + bindings to other languages

2006-05-05 Thread Jonathan Vanasco

this may make some of you cringe, so i apologize

i've moved over a bunch of image processing and file uploading from a  
mod_perl project to the turbogears python framework - i seriously  
hate the speed and quality of GD / ImageMagick, and python's imaging  
library was better suited to my needs.  keeping the imaging and  
document handling off of modperl conserved a ton of memory and  
resources too, so i'm happy.


the issue came though - how do i transparently handle the switchover  
for the users?


the answer:
  a- url dispatch proxies the relative urls to python
  b- use a cross-language data store for sessions -- which ended up  
being yaml.


there already is an apache session flex module for yaml, but it  
handles everything via the pure-perl yaml implementation


i patched it to use the syck library if available:

	http://dev.2xlp.com/svn/mod_perl/cpan_patches/ 
Apache::Session::Serialize::YAML/trunk/YAML.pm


the idea was from the JSON::Syck implementation - written by the same  
person who wrote yaml, but he's yet to update the official flex::yaml  
binding (he was working on a real release last month )


i desperately needed the speed bump ( 30-100x faster than the pure  
perl, though still 25-50% the speed of Storable ) - so in case anyone  
else in in a similar spot, you can try using the file above.


Re: PerlAccessHandler Leaks memory when using Soap::Lite to make a web service call (win32)

2006-05-05 Thread Philip M. Gollucci

[EMAIL PROTECTED] wrote:

I've been trying to solve this problem for a week now with no luck

I have an apache 2.x web server running mod_perl.

I'm trying to write a perlaccesshandler that has to make a web service 
call to a .net web service. The module works fine but each hit cause a 
leak of around 25-30k. The module is as follows:


package Apache::EVC3;

use Apache::Const qw(OK REDIRECT);

You're using an ancient version of mod_perl pre 2.0 RC5
This might be a leak thats been fixed.

READ:
http://perl.apache.org/docs/2.0/rename.html



use SOAP::Lite;

sub handler {
   
  my $r = shift;

  $r->content_type('text/html');

  my $soap = SOAP::Lite
-> uri(')
-> on_action( sub { return '""' } )
-> 
proxy('http://isci-msmuser:[EMAIL PROTECTED]/isci-ivcpi/msmws/msm.asmx'); 



  my $method = SOAP::Data->name('')
->attr({xmlns => 'somens'});

  my $query =
   SOAP::Data
->name(inputQuery =>
  SOAP::Data->value(
  SOAP::Data->name(applicationID => 'val1'),
  SOAP::Data->name(entrustID => 'val2')
  )
   ); 


  my $result = $soap->call($method => $query);

  return OK;

}

I don't see anything blatantly wrong.  It coiuld be SOAP::Data causing it 
though.

--

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."


PerlAccessHandler Leaks memory when using Soap::Lite to make a web service call (win32)

2006-05-05 Thread damion.fusco
Title: PerlAccessHandler Leaks memory when using Soap::Lite to make a web service call (win32)






I've been trying to solve this problem for a week now with no luck


I have an apache 2.x web server running mod_perl. 


I'm trying to write a perlaccesshandler that has to make a web service call to a .net web service. The module works fine but each hit cause a leak of around 25-30k. The module is as follows:

package Apache::EVC3;


use Apache::Const qw(OK REDIRECT);

use SOAP::Lite;


sub handler {

    

  my $r = shift;

  $r->content_type('text/html');


  my $soap = SOAP::Lite

    -> uri(')

    -> on_action( sub { return '""' } )

    -> proxy('http://isci-msmuser:[EMAIL PROTECTED]/isci-ivcpi/msmws/msm.asmx');


  my $method = SOAP::Data->name('')

    ->attr({xmlns => 'somens'});


  my $query =

   SOAP::Data

    ->name(inputQuery =>

  SOAP::Data->value(

  SOAP::Data->name(applicationID => 'val1'),

  SOAP::Data->name(entrustID => 'val2')

  )

   );  


  my $result = $soap->call($method => $query);


  return OK;


}


1;


Does anyone see anything blatantly obvious that could explain this? I've been pulling my hair out for a while.


D





Re: Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Thomas Schindl
Why do you have set MOD_PERL in the environment when running on the command
line? Whether it's Apache or Apache2 doesn't matter it doesn't make sense to
run modules which rely on apache-API from the commandline does it?

Tom

> --- Ursprüngliche Nachricht ---
> Von: Thomas Hilbig <[EMAIL PROTECTED]>
> An: mod_perl list 
> Betreff: Re: Reinstall gets Can't locate Apache.pm
> Datum: Fri, 5 May 2006 13:15:05 -0700 (PDT)
> 
> 
> 
> --- Tyler MacDonald <[EMAIL PROTECTED]> wrote:
> 
> > Thomas Hilbig <[EMAIL PROTECTED]> wrote:
> > > I was getting the error even from running perl
> > > interactively
> > > linux>perl
> > > use CGI ;
> > > Can't locate Apache.pm in @INC
> > > 
> > > I think the problem may be that I am simply
> > missing
> > > the MOD_PERL_API_VERSION environment variable in
> > my
> > > shell environment.  I had MOD_PERL set in my shell
> > > environment (from when??), but not the other.
> > > 
> > > Hopefully, I haven't butchered my Perl install
> > beyond
> > > repair.
> > 
> > Weird! Are you running the latest version of CGI?
> > If not, that could
> > be the problem, CGI had to be updated to support
> > mod_perl2.
> > 
> > Cheers,
> > Tyler
> > 
> Originally I was using CGI 3.16, but the 3.20 has the
> same check:
> 
> if (exists $ENV{MOD_PERL}) {
>   # mod_perl handlers may run system() on scripts
> using CGI.pm;
>   # Make sure so we don't get fooled by inherited
> $ENV{MOD_PERL}
>   if (exists $ENV{MOD_PERL_API_VERSION} &&
> $ENV{MOD_PERL_API_VERSION} == 2) {
> $MOD_PERL = 2;
> require Apache2::Response;
> require Apache2::RequestRec;
> require Apache2::RequestUtil;
> require Apache2::RequestIO;
> require APR::Pool;
>   } else {
> $MOD_PERL = 1;
> require Apache;
>   }
> }
> 
> Having the MOD_PERL environment but not having
> MOD_PERL_API_VERSION causes grief.  However, the
> instructions do say it is required so it's my fault
> for not catching it earlier.
> 
> Tom
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail


Re: Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Thomas Hilbig


--- Tyler MacDonald <[EMAIL PROTECTED]> wrote:

> Thomas Hilbig <[EMAIL PROTECTED]> wrote:
> > I was getting the error even from running perl
> > interactively
> > linux>perl
> > use CGI ;
> > Can't locate Apache.pm in @INC
> > 
> > I think the problem may be that I am simply
> missing
> > the MOD_PERL_API_VERSION environment variable in
> my
> > shell environment.  I had MOD_PERL set in my shell
> > environment (from when??), but not the other.
> > 
> > Hopefully, I haven't butchered my Perl install
> beyond
> > repair.
> 
>   Weird! Are you running the latest version of CGI?
> If not, that could
> be the problem, CGI had to be updated to support
> mod_perl2.
> 
>   Cheers,
>   Tyler
> 
Originally I was using CGI 3.16, but the 3.20 has the
same check:

if (exists $ENV{MOD_PERL}) {
  # mod_perl handlers may run system() on scripts
using CGI.pm;
  # Make sure so we don't get fooled by inherited
$ENV{MOD_PERL}
  if (exists $ENV{MOD_PERL_API_VERSION} &&
$ENV{MOD_PERL_API_VERSION} == 2) {
$MOD_PERL = 2;
require Apache2::Response;
require Apache2::RequestRec;
require Apache2::RequestUtil;
require Apache2::RequestIO;
require APR::Pool;
  } else {
$MOD_PERL = 1;
require Apache;
  }
}

Having the MOD_PERL environment but not having
MOD_PERL_API_VERSION causes grief.  However, the
instructions do say it is required so it's my fault
for not catching it earlier.

Tom

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Thomas Hilbig
> > I did follow the instructions in the link (some
> months
> > ago) when migrating from mp 0.99 to mp2, and lived
> > with the command line problem.  However, as I am
> > trying to reinstall everything (perl included) I
> don't
> > know why am seeing this problem at all.  Any
> > suggestions?
> 
>   Thomas,
> 
>   The problem isn't with your /lib/ tree at all, it
> has to be
> with your code. One of your perl modules, or a
> module you are using, is
> trying to "use Apache", when it shouldbe "use
> Apache2::RequestRec" or some
> such thing.
> 
>   - Tyler
I was getting the error even from running perl
interactively
linux>perl
use CGI ;
Can't locate Apache.pm in @INC

I think the problem may be that I am simply missing
the MOD_PERL_API_VERSION environment variable in my
shell environment.  I had MOD_PERL set in my shell
environment (from when??), but not the other.

Hopefully, I haven't butchered my Perl install beyond
repair.

Thanks for your help,
Tom

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Tyler MacDonald
Thomas Hilbig <[EMAIL PROTECTED]> wrote:
> > Ack! Before you drive yourself nuts with this, read
> > this page:
> > 
> > http://perl.apache.org/docs/2.0/rename.html
> I shouldn't have to clean up the perl tree of old
> Apache*.pm stuff as I blew away the whole tree by
> renaming it.  Now, it's the perl 5.8.8 install (make
> test) that is complaining about the Apache.pm. 
> 
> I did follow the instructions in the link (some months
> ago) when migrating from mp 0.99 to mp2, and lived
> with the command line problem.  However, as I am
> trying to reinstall everything (perl included) I don't
> know why am seeing this problem at all.  Any
> suggestions?

Thomas,

The problem isn't with your /lib/ tree at all, it has to be
with your code. One of your perl modules, or a module you are using, is
trying to "use Apache", when it shouldbe "use Apache2::RequestRec" or some
such thing.

- Tyler




Re: Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Thomas Hilbig


--- Tyler MacDonald <[EMAIL PROTECTED]> wrote:

> Thomas Hilbig <[EMAIL PROTECTED]> wrote:
> > I tried to reinstall CGI, Bundle::Apache2, but
> still
> > got the error.  Finally, I renamed the
> /usr/lib/perl5
> > directory and am trying to reinstall Perl 5.8.8
> from
> > source tar.  However, in the "make test" section I
> am
> > still getting the same errors on all CGI modules:
> > "Can't locate Apache.pm". 
> 
>   Ack! Before you drive yourself nuts with this, read
> this page:
> 
>   http://perl.apache.org/docs/2.0/rename.html
> 
>   Cheers,
>   Tyler
> 

I shouldn't have to clean up the perl tree of old
Apache*.pm stuff as I blew away the whole tree by
renaming it.  Now, it's the perl 5.8.8 install (make
test) that is complaining about the Apache.pm. 

I did follow the instructions in the link (some months
ago) when migrating from mp 0.99 to mp2, and lived
with the command line problem.  However, as I am
trying to reinstall everything (perl included) I don't
know why am seeing this problem at all.  Any
suggestions?


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Tyler MacDonald
Thomas Hilbig <[EMAIL PROTECTED]> wrote:
> I tried to reinstall CGI, Bundle::Apache2, but still
> got the error.  Finally, I renamed the /usr/lib/perl5
> directory and am trying to reinstall Perl 5.8.8 from
> source tar.  However, in the "make test" section I am
> still getting the same errors on all CGI modules:
> "Can't locate Apache.pm". 

Ack! Before you drive yourself nuts with this, read this page:

http://perl.apache.org/docs/2.0/rename.html

Cheers,
Tyler


Reinstall gets Can't locate Apache.pm

2006-05-05 Thread Thomas Hilbig
I had an old problem with a backup server that I am
trying to fix while updating perl, Apache, and
mod_perl2.  My CGI scripts worked under Apache/MP2,
however, everytime I tried to run them from in a shell
I got "Can't locate Apache.pm".   This was even though
I had installed Bundle::Apache2 and CGI was 3.16.

I tried to reinstall CGI, Bundle::Apache2, but still
got the error.  Finally, I renamed the /usr/lib/perl5
directory and am trying to reinstall Perl 5.8.8 from
source tar.  However, in the "make test" section I am
still getting the same errors on all CGI modules:
"Can't locate Apache.pm". 

Any suggestions??
Tom

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: modperl Apache keeps freezing up

2006-05-05 Thread Philip Mak
On Fri, May 05, 2006 at 12:06:24AM -0700, Philip M. Gollucci wrote:
> >If I kill and restart the Apache then it's fine but it'll freeze up in
> >a few days again. I'm perplexed.
> Start the server in -X or wait for it to happen and
> attach strace to the process.  If that doesn't help you could always 
> attach gdb to the process.

It happened again. I tried attaching gdb/strace to the main Apache
process that froze and got some data, but I don't know how to
interpret the results. Does anyone know how to interpret this?

Here's what gdb says:

(gdb) where
#0  0x557c19f8 in select () from /lib/tls/libc.so.6
#1  0x080a85fc in wait_or_timeout ()
#2  0x080aac5e in standalone_main ()
#3  0x080ab3d4 in main ()

And here's what strace says:

select(0, NULL, NULL, NULL, {0, 135000}) = 0 (Timeout)
time(NULL)  = 1146842062
waitpid(-1, 0xda1c, WNOHANG)= 0
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
time(NULL)  = 1146842063
waitpid(-1, 0xda1c, WNOHANG)= 0
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
time(NULL)  = 1146842064
waitpid(-1, 0xda1c, WNOHANG)= 0
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
time(NULL)  = 1146842065
(keeps repeating same sequence of calls)

Also here's a gdb of one of the child processes:

(gdb) where
#0  0x556ea67e in __read_nocancel () from /lib/tls/libpthread.so.0
#1  0x556afa4d in PerlIOUnix_read () from /usr/lib/libperl.so.5.8
#2  0x556ae1d2 in Perl_PerlIO_read () from /usr/lib/libperl.so.5.8
#3  0x556b0f6d in PerlIOBuf_fill () from /usr/lib/libperl.so.5.8
#4  0x556ae583 in Perl_PerlIO_fill () from /usr/lib/libperl.so.5.8
#5  0x556af07b in PerlIOBase_read () from /usr/lib/libperl.so.5.8
#6  0x556b0fe9 in PerlIOBuf_read () from /usr/lib/libperl.so.5.8
#7  0x556ae1d2 in Perl_PerlIO_read () from /usr/lib/libperl.so.5.8
#8  0x556b2b93 in PerlIO_getc () from /usr/lib/libperl.so.5.8
#9  0x55657f75 in Perl_sv_gets () from /usr/lib/libperl.so.5.8
#10 0x55648f32 in Perl_do_readline () from /usr/lib/libperl.so.5.8
#11 0x55645920 in Perl_pp_readline () from /usr/lib/libperl.so.5.8
#12 0x55644ce9 in Perl_runops_standard () from /usr/lib/libperl.so.5.8
#13 0x555e7459 in Perl_call_sv () from /usr/lib/libperl.so.5.8
#14 0x555e723d in Perl_call_sv () from /usr/lib/libperl.so.5.8
#15 0x0805b8be in perl_call_handler ()
#16 0x0805ac03 in perl_run_stacked_handlers ()
#17 0x080589e4 in perl_handler ()
#18 0x0809d0b2 in ap_invoke_handler ()
#19 0x080b3aba in process_request_internal ()
#20 0x080b3b17 in ap_process_request ()
#21 0x080aa0d7 in child_main ()
#22 0x080aa368 in make_child ()
---Type  to continue, or q  to quit---
#23 0x080aa6d6 in perform_idle_server_maintenance ()
#24 0x080aad77 in standalone_main ()
#25 0x080ab3d4 in main ()


Re: mod_proxy_add_forward

2006-05-05 Thread Issac Goldstand
In Apache 2, it's built in to mod_proxy.  In Apache 1 (as of a couple of
years ago, at least) it wasn't - that's why mod_proxy_add_forward was
originally written :)

 Issac

Michael Schout wrote:
> David Romero wrote:
>> Hi
>> I need the client ip on a backend server.
> 
> Plain old mod_proxy will pass along the ip in an X-Forwarded-For header.
> 
> Regards,
> Michael Schout


Re: modperl Apache keeps freezing up

2006-05-05 Thread Philip M. Gollucci

If I kill and restart the Apache then it's fine but it'll freeze up in
a few days again. I'm perplexed.

Start the server in -X or wait for it to happen and
attach strace to the process.  If that doesn't help you could always 
attach gdb to the process.


HTH


--

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."