Periodic random script failures - Need pointers
Hi, I need help in figuring out why my mod perl registry script fails randomly/periodicall on 'https'. I am using modperl2 on ubuntu-dapper (libapache2-mod-perl2 2.0.2-2.3ubuntu1). The registry script is used to login over https. The script periodically/randomly gives internal error because in the following code snippet $r is coming as undefined. This happens randomly but periodically. Any pointers/insights to troubleshoot this would be greatly appreciated. my $r = Apache2::RequestUtil-request; my $host = $r-hostname|| $r-server-server_hostname; *=== This fails randomly because $r is undefined.* I am using mod-ssl Thanks, Manoj. -- Tired of reading blogs? Listen to your favorite blogs at http://www.blogbard.com
Re: Finding memory leaks
The following always works for me: Run apache2(pre fork) with '-X' option under valgrind: In my system it looks something like this: valgrind --leak-check=full /usr/sbin/apache2 -X If you are using any 'XS' based perl modules, it would show memory leaks/errors, if any in any of the loaded shared libs. On 10/24/07, Chetan Sarva [EMAIL PROTECTED] wrote: On Oct 24, 2007, at 3:59 AM, Philippe M. Chiasson wrote: Have you tried Apache::Leak? http://search.cpan.org/~gozer/mod_perl-1.30/Leak/Leak.pm Everything I've read about Apache::Leak says it points out lots of false positives and can be a huge waste of time. Maybe I'll give it a try anyway. I've got time to waste.
Re: monitoring server and which ports they are connected to.
Try 'sudo lsof -i:443'. This is what I get on my system. sudo lsof -i:443 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME apache2 14550 root5u IPv6 2251478 TCP *:https (LISTEN) apache2 14589 www-data5u IPv6 2251478 TCP *:https (LISTEN) apache2 26533 www-data5u IPv6 2251478 TCP *:https (LISTEN) On 10/2/07, Tyler Bird [EMAIL PROTECTED] wrote: Hi list, I am frustrated trying to restart apache and it complaining it can't bind to port 443 when it seems no services are attached to it. Does anyone know any command line utility that can report which programs are attached to which tcp port? any one know they correct netstat options to report this. Thanks in advance! Tyler
Re: load large data
You can use regular package inheritance(@ISA) support in perl to extend MyModule and created YourModule, where you can add any extra methods/override existing methods. On 9/25/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thank you. Sorry that module of Mymodule is a public module from CPAN.I can't modify it to add the init() and data() methods. How to do it then?thanks again. -Original Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: modperl@perl.apache.org Sent: Tue, 25 Sep 2007 4.52PM Subject: Re: load large data [EMAIL PROTECTED] wrote: Thank you. I have added these directives in httpd.conf, Perl use Mymodule; our $data = Mymodule-new; /Perl Then I run bin/apachectl configtest,but got the errors, Unknown type 'Mymodule' for directive data at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Apache2/PerlSectio ns.pm line 192.\n Please help.Thanks. As with all Perl code, there is more than one way to do it. Another way to accomplish what you are trying to do is through the use of startup.pl, which is run during apache startup. (I don't know why that error above is occurring so I'm posting this as an alternate approach). # httpd.conf PerlPostConfigRequire /home/pennyyh/perl/lib/startup.pl # startup.pl use strict; use warnings; use Mymodule; Mymodule-init; 1; ## Mymodule.pm package Mymodule; use strict; use warnings; our $data; sub new { ... } sub init { my $class = shift; $data = $class-new; } sub data { my $class = shift; return $data; } 1; then in your application you can access $data via $Mymodule::data, or better yet access it like so: my $data = Mymodule-data; # this returns the object created during # startup HTH, Fred -Original Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: modperl@perl.apache.org Sent: Tue, 25 Sep 2007 1.42AM Subject: Re: load large data On Mon, 24 Sep 2007 06:08:45 -0400 [EMAIL PROTECTED] wrote: Hello, I have a module,which loads large data into memory. my $data = Mymodule-new; this will take some ms to be finished. So I think I can create this object at startup time,and share the $data acrosss all apache child processes. Is it possible?How can I do it? Yeah you can do this in a Perl section at startup and your children can then use it. I'm assuming here that the info in $data doesn't change or that you're ok with having to restart Apache to see the changes. --- Frank Wiles, Revolution Systems, LLC. Personal : [EMAIL PROTECTED] http://www.wiles.org Work : [EMAIL PROTECTED] http://www.revsys.com Check out the new free AOL Email -- 2GB of storage and industry-leading spam and email virus protection. Check out the new free AOL Email -- 2GB of storage and industry-leading spam and email virus protection.
Re: seg faults when running modperl and GD::Graph
One option would to be run apache under single threaded mode(option -X) under gdb and see where it is crashing. Once you identify the .so where it is crashing, you can try reproducing the crash outside apache context. If you suspect it to be a memory corruption issue you can try running apache under valgrind. On 9/4/07, Matt Williamson [EMAIL PROTECTED] wrote: I don't think it can be php. I disabled php on the server, and I still get the seg faults [Tue Sep 04 21:45:19 2007] [notice] Apache/2.0.55 (Ubuntu) mod_perl/2.0.2 Perl/v5.8.7 configured -- resuming normal operations [Tue Sep 04 21:45:29 2007] [notice] child pid 18466 exit signal Segmentation fault (11) [Tue Sep 04 21:45:30 2007] [notice] child pid 18467 exit signal Segmentation fault (11) [Tue Sep 04 21:45:32 2007] [notice] child pid 18468 exit signal Segmentation fault (11) Any other ideas? Matt -Original Message- From: Rafael Caceres [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 04, 2007 1:38 PM To: Matt Williamson Cc: modperl@perl.apache.org Subject: Re: seg faults when running modperl and GD::Graph If you have PHP (with mod_php) enabled on that server, that's the culprit and it can be fixed by compiling PHP without GD support. On Tue, 2007-09-04 at 13:12 -0700, Matt Williamson wrote: I noticed that my server is segfaulting when I run a script using GD::Graph
Re: mod_perl2 compiling error
In general to create a shared object the constituent object files should be PICable. Look for Makefile(s) which compile the individual source files. It would have a variable like 'CFLAGS'. Adding '-fPIC' to it should take care of it. On 8/21/07, jónJósef Bjarnason [EMAIL PROTECTED] wrote: When running make for mod_perl 2.0.3 I get an error telling me to use -fPIC option. Does anyone know where to put that compiling option ? Regards Jon Apache 2.2.4 Perl 5.8.8 mod_perl 2.0.3 Ubuntu 6.06 LTS 64bit AMD when compiling -o mod_perl.so: `a local symbol' can not be used when making a shared object; recompile with -fPIC Þessi tölvupóstur og viðhengi gæti innihaldið trúnaðarupplýsingar og/eða einkamál og ereingöngu ætlaður þeim sem hann er stílaður á. Ef sending þessi hefur ranglega borist yður vinsamlega gætið fyllsta trúnaðar, tilkynnið sendanda og eyðileggið sendinguna eins og skylt er skv. 47. gr. laga nr. 81/2003 um fjarskipti. The information transmitted, including any attachment, may contain confidential and/or privileged material and is intended only for the addressee. If you receive this in error, please keep the information confidential, contact the sender and delete the material from your system.
Re: mod_perl2 compiling error
Hi Jon, Which OS platform are you working on? On platforms like ubuntu linux you can get precompile packages for all these modules. You just need to do: sudo apt-get install package-name. An option like this may already be available on your development platform. -Manoj. On 8/22/07, jónJósef Bjarnason [EMAIL PROTECTED] wrote: Thanks. I had to compile Perl again, then mod_perl2. mod_perl works now, nothing else thoguh, Problems compiling DBI, DBD..etc. (MySql on a different machine) I´m getting therevery slowly. Thank you all for your time and help. Regards Jon Þann 8/22/2007, skrifaði Manoj Bist [EMAIL PROTECTED]: In general to create a shared object the constituent object files should be PICable. Look for Makefile(s) which compile the individual source files. It would have a variable like 'CFLAGS'. Adding '-fPIC' to it should take care of it. On 8/21/07, jónJósef Bjarnason [EMAIL PROTECTED] wrote: When running make for mod_perl 2.0.3 I get an error telling me to use -fPIC option. Does anyone know where to put that compiling option ? Regards Jon Apache 2.2.4 Perl 5.8.8 mod_perl 2.0.3 Ubuntu 6.06 LTS 64bit AMD when compiling -o mod_perl.so: `a local symbol' can not be used when making a shared object; recompile with -fPIC
Re: How to display images ?-Not Working
Hi Rick, Please use Text::Template for generating the html you send to the client. As long as you keep appending the html string to $OUT, it should work under mod_perl2.0. http://search.cpan.org/~mjd/Text-Template-1.44/lib/Text/Template.pm Thanks, Manoj. On 8/21/07, RGKärcher [EMAIL PROTECTED] wrote: Hi guys , Thanks Michael and Georg but none of the examples works for me ... I'm using Apache::Asp . What could be the problem ? Thanks in Advance Rick --- Michael Peters [EMAIL PROTECTED] escribió: Georg Grabler wrote: On Tuesday 21 August 2007 15:48:23 RGKärcher wrote: print pa href=\http://www.mysite.net/\; img src=\site_images/$image \ width=\160\ height=\180\ alt=\image \ class=\float-left\ //a\n; Perl is just a bit differnt. Either, use ${image} instead of $image or use sprintf. You can use both of those, but you don't really need to. The above should work just fine. But don't all those escapes of the double quotes give you a headache? There are so many better ways of doing that: print qq|pa href=http://www.mysite.net/; img src=site_images/$image width=160 height=180 alt=image class=float-left / /a/p |; Having said that, when working with HTML you should really be using templates. I like Template Toolkit (http://search.cpan.org/perldoc?Template) and also use HTML::Template (http://search.cpan.org/perldoc?HTML::Template) but if you're coming from PHP then Mason might be more up your alley (http://search.cpan.org/perldoc?HTML::Mason) -- Michael Peters Developer Plus Three, LP Ricardo german Kärcher [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] ¡Sé un mejor fotógrafo! Perfeccioná tu técnica y encontrá las mejores fotos. Visitá http://ar.yahoo.com/promos/mejorfotografo.html
Re: Special characters
You need to know the encoding of the characters you are using in perl and handle them accordingly. The following link should have sufficient information to help you trouble shoot this. http://search.cpan.org/~jhi/perl-5.8.0/pod/perluniintro.pod On 8/21/07, Dan King [EMAIL PROTECTED] wrote: I am having issues running a web application, called OTRS, that uses DBI and DBD::Oracle. When I insert special characters, such as é or â they show up as question marks in the database when looking at them from sqlplus or through the web application. I am running the web app on Apache v1 with an Oracle 10g backend both on Solaris 9. The reason I am asking the question here is I am wondering if mod perl does any conversion of text that is typed into a text box. I have been able to successfully insert and read the special characters using sqlplus from the command line of the server running the web app, apache and Oracle as well as creating a small perl test script that looks as follows: #!/usr/local/bin/perl use warnings; use strict; use Data::Dumper; use DBI; use DBD::Oracle; my $dbh = DBI-connect(dbi:Oracle:host=localhost;sid=QAT, rm_ticket, rm_ticket); my $sql = qq{ UPDATE signature SET text='çè' WHERE id=1 }; my $sth = $dbh-prepare($sql); $sth-execute(); $sth-finish(); $dbh-disconnect; The reading script looks as follows: #!/usr/local/bin/perl use warnings; use strict; use Data::Dumper; use DBI; use DBD::Oracle; my $dbh = DBI-connect(dbi:Oracle:host=localhost;sid=QAT, rm_ticket, rm_ticket); my $sql = qq{ SELECT text from signature }; my $sth = $dbh-prepare($sql); $sth-execute(); my($text); $sth-bind_columns(undef, \$text); print Text of signature:\n\n; while( $sth-fetch() ) { print Object: $text\n; } $sth-finish(); $dbh-disconnect; Does anyone know why I can successfully write and read from the database when I am not using the web application but when I use the web application the special characters fail to work properly? Dan King Software Developer Canadian Resident Matching Service 613.237.0075 ext. 241 (Toll free) 877.CARMS.42 171 Nepean Street, Suite 300 Ottawa, ON, CANK2P 0B4 www.carms.ca This e-mail message, including any attachments, is for the sole use of the intended recipients and may contain confidential and or privileged information. If you are not the intended recipient or this information has been forwarded in error, please contact the sender by reply e-mail and destroy copies of the original message. Ce message (incluant toute pièce jointe) s'adresse uniquement au(x) destinataire(s) prévu(s) ou à une personne autorisée à le recevoir en son (leur) nom. Il pourrait contenir des renseignements confidentiels ou protégés. Si vous l'avez reçu par erreur, nous vous prions d'en informer l'auteur dans les meilleurs délais, de ne pas divulguer son contenu et de le supprimer de votre système. Merci.
Re: Problem with IPC:RUN on Windows
My understanding is that a perl module that manipulates stdout is not expected to work under mod_perl. IPC::Run manipulates stdout to make different processes connected by pipes work. You can also go through the following guidelines for porting your scripts to mod_perl. http://perl.apache.org/docs/1.0/guide/porting.html#Output_from_system_calls The following links has guidelines on running subprocesses from mod_perl. http://perl.apache.org/docs/1.0/guide/performance.html#Forking_and_Executing_Subprocesses_from_mod_perl On 8/16/07, jónJósef Bjarnason [EMAIL PROTECTED] wrote: Dear all It has been difficult to subscribe to the mailing list, I was refused due to some SPAM control when using my usual account [EMAIL PROTECTED] I would really like to know why that happened, as we do not send nor have we ever sent SPAM. But to my problem with IPC. I am using W2K on a dual CPU system running Apache 2.2.4 with mod_perl2. I am also using Leon Brocard's Graphviz module to create graphs on the fly, it starts the program dot.exe via IPC::RUN. dot.exe gets started but never returns anything and stays in queue until the system is shut down. Does anyone know if this is a known problem with IPC::RUN on Windows, and/or if it can be resolved and how. Thanks. Þessi tölvupóstur og viðhengi gæti innihaldið trúnaðarupplýsingar og/eða einkamál og ereingöngu ætlaður þeim sem hann er stílaður á. Ef sending þessi hefur ranglega borist yður vinsamlega gætið fyllsta trúnaðar, tilkynnið sendanda og eyðileggið sendinguna eins og skylt er skv. 47. gr. laga nr. 81/2003 um fjarskipti. The information transmitted, including any attachment, may contain confidential and/or privileged material and is intended only for the addressee. If you receive this in error, please keep the information confidential, contact the sender and delete the material from your system.
Re: Scripts works under CGI but not under mod_perl (and thread stack size)
Thanks a lot Perrin for advising to run prefork. I switched to prefork and I am now able to successfully run apache2 under the debugger/valgrind. I was finally able to narrow down the problem to symbol clashes between two shared libraries for which perl bindings were written. Using the right linker and objcopy options I am able to take care of the problem. On 8/14/07, Perrin Harkins [EMAIL PROTECTED] wrote: On 8/14/07, Manoj Bist [EMAIL PROTECTED] wrote: Is it possible to change the stack size in mod_perl(Similar to ulimit -s unlimited etc.)? The stack size? What are you trying to do? I'm not aware of anything special about stack size in mod_perl that would be different from any other compiled C program. Also, why do you mention threads? Are you running a threaded MPM? Unless you're on Windows, I'd advise you to run prefork. - Perrin
modperl and fprintf(stdout,...)
Hi, I would really appreciate if someone could answer the following question regarding modperl and writing to stdout for me: I have a perl binding for a C library which generates binary(audio/video) data. To push this binary data over an HTTP response, fprintf(stdout,...) does not work in context of modperl. Do I have to copy the binary data to a perl scalar variable and then do $r-print(...) in the perl script? Please do let me know if I need to provide more details. Thanks, Manoj.
Re: Scripts works under CGI but not under mod_perl (and thread stack size)
Is it possible to change the stack size in mod_perl(Similar to ulimit -s unlimited etc.)? Thanks, Manoj. On 8/13/07, Manoj Bist [EMAIL PROTECTED] wrote: Hi Perrin, Is there some recommended way to detect if STDOUT is being manipulated? This is what I am doing. 1. Build a standalone binary that uses this lib. 2. Run this binary in the debugger and insert breakpoints in read, write, open and close. The library is using TCP sockets to communicate with the server. Is there some way to debug apache/mod_perl in the debugger? Thanks a lot, Manoj. On 8/13/07, Perrin Harkins [EMAIL PROTECTED] wrote: On 8/13/07, Manoj Bist [EMAIL PROTECTED] wrote: Thanks for the response. The C library is a third party library which does the following: - Connect to a server running on port 7000 on the local machine. - Make an initialize call ==This call is consistently failing under mod_perl. Okay, so that's what you need to focus on. Do you know if it's connecting over TCP sockets or pipes? There may be issues if it's trying to manipulate STDOUT. The startup.pl that we are using has only 5 lines. I don't see how this could cause you trouble, unless you are loading other things directly from httpd.conf. It probably has to do with STDOUT. - Perrin
Re: Scripts works under CGI but not under mod_perl (and thread stack size)
Hi Perrin, Thanks for the response. I am using threaded MPM. The self-contained program that I created crashes if I set the stack size to 256K (using ulimit -s). At higher stack size limits it works fine. That's why I want to try bumping up the stack size for apache/mod_perl. So far I have not been able to find out if that is possible in apache2. 0. On 8/14/07, Perrin Harkins [EMAIL PROTECTED] wrote: On 8/14/07, Manoj Bist [EMAIL PROTECTED] wrote: Is it possible to change the stack size in mod_perl(Similar to ulimit -s unlimited etc.)? The stack size? What are you trying to do? I'm not aware of anything special about stack size in mod_perl that would be different from any other compiled C program. Also, why do you mention threads? Are you running a threaded MPM? Unless you're on Windows, I'd advise you to run prefork. - Perrin
Scripts works under CGI but not under mod_perl
Hi, I created a perl binding for a third party C library using swig. This works fine under CGI but consistently fails under mod_perl. Is there a known set of calls(mulithreading etc.) that is not expected to work under mod_perl? I have gone through almost all the mod_perl caveats that I could google. I have been struggling with this for quite some time. I would really appreciate any insights/pointers/ideas on troubleshooting this. Thanks, Manoj.
Re: Scripts works under CGI but not under mod_perl
Hi Perrin, Thanks for the response. The C library is a third party library which does the following: - Connect to a server running on port 7000 on the local machine. - Make an initialize call ==This call is consistently failing under mod_perl. - Grab binary data returned by the server. What is most baffling is that the same perl code works fine when run as a standalone application or as CGI but consistently fails under mod_perl. The parameters passed to these call are the following: - a struct which contains a couple of character strings - pointer to a handle that would be filled up after the call. I have tried running a standalone perl application that uses the perl binding under valgrind. However it did not expose memory issues. The startup.pl that we are using has only 5 lines. I have included it here. 11 use ModPerl::Registry; 12 use Apache2::Const; 13 use CGI qw(-compile :all); 14 use CGI::Carp (); 15 1; - Manoj. On 8/13/07, Perrin Harkins [EMAIL PROTECTED] wrote: On 8/13/07, Manoj Bist [EMAIL PROTECTED] wrote: I created a perl binding for a third party C library using swig. This works fine under CGI but consistently fails under mod_perl. Is there a known set of calls(mulithreading etc.) that is not expected to work under mod_perl? Modules with C code normally work fine with mod_perl. The only generic problems I can think of are ones where you open sockets or files in startup.pl and then fork and try to share them. Can you tell us more about what the C library does and how it fails? - Perrin
Re: Scripts works under CGI but not under mod_perl
Hi Perrin, Is there some recommended way to detect if STDOUT is being manipulated? This is what I am doing. 1. Build a standalone binary that uses this lib. 2. Run this binary in the debugger and insert breakpoints in read, write, open and close. The library is using TCP sockets to communicate with the server. Is there some way to debug apache/mod_perl in the debugger? Thanks a lot, Manoj. On 8/13/07, Perrin Harkins [EMAIL PROTECTED] wrote: On 8/13/07, Manoj Bist [EMAIL PROTECTED] wrote: Thanks for the response. The C library is a third party library which does the following: - Connect to a server running on port 7000 on the local machine. - Make an initialize call ==This call is consistently failing under mod_perl. Okay, so that's what you need to focus on. Do you know if it's connecting over TCP sockets or pipes? There may be issues if it's trying to manipulate STDOUT. The startup.pl that we are using has only 5 lines. I don't see how this could cause you trouble, unless you are loading other things directly from httpd.conf. It probably has to do with STDOUT. - Perrin