RE: [mp2] segfault when connect to database
> httpd2 2.0.47, mod_perl 1.99_09 > -- > httpd does segfault when I try to connect to the database (mysql or > interbase). It faults somewhere in libnss_db.so. It works well if I > remove libnss_db* from the system. I noticed a while back that when I use PostgreSQL/W2K/2.0.46/mp1.99_10 I get a segfault _when Apache shuts down_. I don't have it compiled such that I can do a backtrace. mma
RE: clones and parents (bug report)
-8<-- Start Bug Report 8<-- 1. Problem Description: # Problem: When I add PerlOptions +Parent I get a segfault. # # Breaks with: # Windows 2000 SP2 # Apache 2.0.46 # ActiveState Perl 5.8.0 (build 804) # mod_perl 1.99.10dev(installed using mpinstall.pl, # re-installed TODAY to be safe) # # Pops up "Apache.exe - Application Error" box: # The instruction at "0x280830ed" # referenced memory at "0x". # The memory could not be "written". # # After killing the box the command line says: # C:\Apache2\bin> apache # Starting Apache... # and must be killed via . The error log is empty. # # In at least one case the Apache.exe process refused to stop # and COULD NOT BE SHUT DOWN VIA TASK MANAGER, requiring reboot. # This seems to happen when is not invoked immediately # after cancelling the message box. 2. Used Components and their Configuration: *** mod_perl version 1.9910 *** using C:/Perl/site/lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_AP_PREFIX=> \Apache2 MP_COMPAT_1X=> 1 MP_GENERATE_XS => 1 MP_INST_APACHE2 => 1 MP_LIBNAME => mod_perl MP_USE_DSO => 1 MP_USE_STATIC => 1 *** \Apache2/bin/Apache.exe -V Server version: Apache/2.0.46 Server built: May 27 2003 23:15:42 Server's Module Magic Number: 20020903:3 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/winnt" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/apache" -D SUEXEC_BIN="/apache/bin/suexec" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error.log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** C:\Perl\bin\perl.exe -V Summary of my perl5 (revision 5 version 8 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES _FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSV CRT_READFIX', optimize='-MD -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags '-nologo -nodefaultlib -release -libpath:"C:\Perl\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft.Net\Odbc.Net\" "C:\Perl\lib\CORE" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', ddlflags='-dll -nologo -nodefaultlib -release -libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 804 Built under MSWin32 Compiled at Dec 1 2002 23:15:13 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: C:/Perl/lib C:/Perl/site/lib . 3. This is the core dump trace: (if you get a core dump): # I don't have anything built with debug but even so the stack shows: # PERL58.DLL # PERL58.DLL # MOD_PERL.DLL # when I pop into the debugger from the alert panel. This report was generated by -e on Fri Jul 18 23:48:59 2003 GMT. -8<-- End Bug Report --8<-- # # C:\Apache2\conf\parental.conf # # Minimal configuration for breaking PerlOptions +parent. # Use Include directive in generic httpd.conf # # There is no startup.pl here, nor much of anything else. # I first discovered this issue in a fully populated environment # with all of that good stuff. I removed all of the other goop # and it still blows up here. When
RE: clones and parents
> > I never know whether to submit a bug report or not. Often > these things turn > > out to be known issues or I find out it was my own bug at some > later time... > > If you get a segfault, chances are that something is broken, since the sw > should gracefully handle cases when someone does something wrong > and not segfault. OK. Give me a day or so to double-check by coming up with a minimal test case. Which will aid in the debugging effort (one hopes). mma
RE: clones and parents
> > So is PerlOptions +Parent working? Whenever I enable it I get > a segfault on > > W2K / Ap2.0.46 / mp1.99.10dev. > > have you submitted a bug report? > http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems I never know whether to submit a bug report or not. Often these things turn out to be known issues or I find out it was my own bug at some later time... mma
RE: clones and parents
No wonder this seemed familiar. I wrote pretty much the same memo six weeks ago. D'oh! I've been spending too much time at the keyboard... So is PerlOptions +Parent working? Whenever I enable it I get a segfault on W2K / Ap2.0.46 / mp1.99.10dev. mma > -Original Message- > From: Marc M. Adkins [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 17, 2003 1:17 PM > To: [EMAIL PROTECTED] > Subject: clones and parents > > > Let's say I want to create a site with five virtual hosts. I want all of > them to share the basic MP2 stuff, Apache-related modules and so forth. > Then, for Virtual Host 1 (VH1 for short ;) I want to specify a set of > modules unique to VH1. For VH2-VH4 I want to specify another set of > modules, but the same set for all of those virtual hosts. > > So I feel like I want to have two interpreter pools. I want a > parent at the > top-most level (outside of all of the virtual hosts) that loads the basic > stuff. Then I want a parent and a pool for VH1. Then I want a > parent and a > pool for VH2-VH4 to share. > > I'm not clear on how to do this or even if it is possible. I > understand how > the Clone and Parent options work, but they depend on the structure of the > Apache configuration file. I don't offhand know of a way to group four > virtual hosts into a block so that they can inherit the same parent/pool. > > If I were trying to solve this (assuming that it isn't already possible > somehow) I might come up with the concept of named interpreter > parent/pools. > Something like: > > > PerlRequire "VH1/startup.pl" > ... > > > > > PerlRequire "VHX/startup.pl" > ... > > > > PerlInterpPoolVH1 > > > > PerlInterpPoolVHX > > > ... > > > PerlInterpPoolVHX > > > But that's just off the top of my head and probably wrong for any > number of > reasons. > > Any thoughts? Or better yet, a way to do this with MP2 already? > > mma > >
clones and parents
Let's say I want to create a site with five virtual hosts. I want all of them to share the basic MP2 stuff, Apache-related modules and so forth. Then, for Virtual Host 1 (VH1 for short ;) I want to specify a set of modules unique to VH1. For VH2-VH4 I want to specify another set of modules, but the same set for all of those virtual hosts. So I feel like I want to have two interpreter pools. I want a parent at the top-most level (outside of all of the virtual hosts) that loads the basic stuff. Then I want a parent and a pool for VH1. Then I want a parent and a pool for VH2-VH4 to share. I'm not clear on how to do this or even if it is possible. I understand how the Clone and Parent options work, but they depend on the structure of the Apache configuration file. I don't offhand know of a way to group four virtual hosts into a block so that they can inherit the same parent/pool. If I were trying to solve this (assuming that it isn't already possible somehow) I might come up with the concept of named interpreter parent/pools. Something like: PerlRequire "VH1/startup.pl" ... PerlRequire "VHX/startup.pl" ... PerlInterpPoolVH1 PerlInterpPoolVHX ... PerlInterpPoolVHX But that's just off the top of my head and probably wrong for any number of reasons. Any thoughts? Or better yet, a way to do this with MP2 already? mma
RE: Virtual Host Logging Perl Script (mod_macro note)
> > Right now it seems a bit silly having a separate ErrorLog line in each > > of the apache virtual host stubs, but as far as I am aware there isn't > > an easier way is there? > > You could look at mod_macro. mod_macro (http://www.coelho.net/mod_macro) works great for me. I found that I had to make a few changes to get it to build for Apache 2.0.46. To wit: 110c110 < module macro_module; --- > module AP_MODULE_DECLARE_DATA macro_module; 810c810,811 < char * name, * where, * recursion; --- > char * name, * recursion; > char * where = "???"; 951c952 < AP_DECLARE_DATA module macro_module = { --- > module AP_MODULE_DECLARE_DATA macro_module = { The preload of 'where' may be redundant, I don't remember. I believe that the use of AP_MODULE_DECLARE_DATA was change that I had to make or nothing would build. YMMV mma
RE: Does DBD::Pg work w/mp2?
> Is anyone using PostgreSQL via DBD::Pg in a threaded environment? > > It appears as though the DBD::Pg driver hasn't been made thread-safe yet. > However it's possible that I'm misusing it somehow, doing something in my > startup.pl that I shouldn't, whatever. So I'm asking if anyone else is > using DBD::Pg successfully w/mp2 at the current time??? >From the DBD::Pg mailing list: - The version in CVS should work with threading, but the version on CPAN does not yet. You can download a cvs copy: http://gborg.postgresql.org/project/dbdpg/projdisplay.php or just add these three lines to Pg.pm and recompile: diff -c -r1.37 Pg.pm *** Pg.pm 10 Jun 2003 19:14:53 - 1.37 --- Pg.pm 22 Jun 2003 21:22:31 - *** *** 38,43 --- 38,47 $errstr = ""; # holds error string for DBI::errstr $drh = undef; # holds driver handle once initialized + sub CLONE { + $drh = undef ; + } + sub driver{ return $drh if $drh; my($class, $attr) = @_; - I've tried it and it seems to work just fine. mma
Does DBD::Pg work w/mp2?
Is anyone using PostgreSQL via DBD::Pg in a threaded environment? I'm getting: [Fri Jun 20 11:47:57 2003] [error] [client 127.0.0.1] DBD::Pg::dr default_user failed: handle 1 is owned by thread 126e2e4 not current thread 11df014 (handles can't be shared between threads and your driver may need a CLONE method added) with DBD::Pg 1.22 (W2K, Apache 2.0.46, Perl 5.8, mod_perl 1.99.10-dev). It appears as though the DBD::Pg driver hasn't been made thread-safe yet. However it's possible that I'm misusing it somehow, doing something in my startup.pl that I shouldn't, whatever. So I'm asking if anyone else is using DBD::Pg successfully w/mp2 at the current time??? In the meantime the DBD::PgPP driver works OK, but of course it probably won't perform as well. mma
RE: PerlOptions Clone/Parent in mp2
> With something like a http://foo/*> block, mod_proxy does > the right thing ( and the simple ) of using the power of > ap_walk_config() to handler the parsing of the contents of the block. [...snip...] > Reason blocks can't do that is becasue we can't let httpd try and > parse perl code and make any sense of it. If you look closely, a > block simply slurps all its contents and feeds it to perl for > processing. Ah...I see...it's the MP_CMD_SRV_RAW_ARGS_ON_READ which translates into AP_INIT_RAW_ARGS with the all-important EXEC_ON_READ flag that allows you to waylay the configuration file on the way in. Otherwise the directives are partially processed and constructed into a tree, which you don't want. Turns out mod_macro does the same thing. Doesn't apply to my code, thank goodness. thx, mma
RE: PerlOptions Clone/Parent in mp2
> > The code to implement blocks (e.g. ...) in > config files is > > pretty gnarly, too. I know it's already there for , it's > one of the > > places I looked when I was considering doing one of my own and > wanted to see > > an example. The Apache framework is pretty strong for putting in new > > directives, but not so much for adding new blocks. > > Actually you can't quite do that in a 3rd party module. Currently > the pools > are internal to mod_perl. Making this customizable will require > adding hooks > to the internal tipool mechanism. When I wrote the above > pseudo-config I was > suggesting an internal support for these. I was actually not figuring to do it myself. ;) I was commenting on the code required to implement things like or . I've since queried the httpd-dev list and the 'official' example is in the source for mod_proxy (with a caveat that a three-pass config file parser may necessitate further changes at some point). It appears to be a lot simpler than the parsing that mod_perl is doing. I was wondering...is there a specific reason mod_perl implements the way it does or is it just code inertia? mma
RE: PerlOptions Clone/Parent in mp2
> However I think it is possible to make the architecture more > flexible to allow > pools sharing across specific vhosts, or even location containers (if the > scope is set to be only for the handler). e.g. something like: > > #base server > > > # parameters > > > # parameters > > > > PerlUseTiPool A > > > PerlUseTiPool A > > > > PerlUseTiPool B > > > PerlUseTiPool B > Yeah, that would do it. I don't know how many people will need this, probably not so many. And there might be a sufficient work-around in those rare (?) cases involving multiple Apache instantiations and a proxy server to tie it all together. Something like the high-volume configurations I've seen documented, only with one mod_perl-enhanced server for each TIPool. The code to implement blocks (e.g. ...) in config files is pretty gnarly, too. I know it's already there for , it's one of the places I looked when I was considering doing one of my own and wanted to see an example. The Apache framework is pretty strong for putting in new directives, but not so much for adding new blocks. mma
RE: getting *any* variables out of the server environment
IF you're using mp2...in your httpd.conf are you setting up the handlers with modperl or perl-script? The former doesn't provide any environment variables: http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_ I don't believe this applies to mp1. mma > -Original Message- > From: Ryan Muldoon [mailto:[EMAIL PROTECTED] > Sent: Monday, June 09, 2003 11:30 AM > To: [EMAIL PROTECTED] > Subject: getting *any* variables out of the server environment > > > I'm not able to get *any* variables out from the apache server > environment. As you might be able to imagine, this is extremely > frustrating, and inhibits my ability to do anything of use with > mod_perl. My basic technique has been: > my $uri = $r->uri; > return unless $r->is_main(); > my $subr = $r->lookup_uri($uri); > my $apachecertcomp = $subr->subprocess_env($certcomponent); > But this doesn't work. I also tried > my $var = $r->subprocess_env("VARIABLE_NAME"); > And this does not work either. I really need to be able to use > environment variables that mod_ssl sets in my authentication handler. > Any ideas? Thanks! > > --Ryan >
PerlOptions Clone/Parent in mp2
wrt Apache 2.0, mod_perl 2.0... I'm not using Clone or Parent at the current time, but I was re-reading the documentation on them for an unrelated reason and started thinking about how they would work. Suppose I want to set up five virtual hosts with modules A - E. Then I want to set up six virtual hosts with modules F - M. The first five virtual hosts can all share a pool of interpreters and the second six virtual hosts can share a different pool of interpreters. How might I declare two parent interpreters globally, one with modules A - E and the other with modules F - M such that I could share a pool of interpreters derived from the first parent with five virtual hosts and a pool of interpreters derived the second parent with a different six virtual hosts? This is all theoretical, I don't actually need this right now, and probably won't ever. Just trying to imagine how these options would be used. mma
Apache modules and mod_perl threads in same process?
For Apache 2.0.46 / mod_perl 1.99.10-dev: If I have an Apache module configured in httpd.conf, will the module code be executing in the same process as the mod_perl code? If there are multiple Apache processes (on W2K I always see 2) will the module code exist in all processes? mma
RE: DirectoryIndex doesn't see SetHandler path
> I hope that this is the issue. Marc has failed to say that he is using > mp2/apache2, so I won't be surprised if this is yet another > problem introduced > by apache-2.0 (incompatible mod_dir behavior wrt apache-1.3). see > my recent > bug reports to the httpd-dev list. Yah, yah, sorry, Apache 2.0.46 on W2K, ActiveState build 804 (Perl 5.8), mod_perl/1.99_10-dev. Postcards from the bleeding edge. Wish I'd given more attention to your postings on httpd-dev. I was thinking this might be a bug and it might not...I'm not always sure what is _supposed_ to happen. mma
DirectoryIndex doesn't see SetHandler path
This is going to seem odd...obscure...dumb... I've been using code like this to set up handlers: SetHandler perl-script PerlResponseHandler Some::Handler Now I'm using this code to set up handlers for individual pages. The directive above is in a sense telling Apache "there is a directory /some/path/index which contains files which should be processed via Some::Handler" but in fact there is no such directory. There is just a handler. So in my mind I'm defining a single page with a handler. All this works OK, weird though it may be, until I want a directory index. Say I want to go to url: /some/path The DirectoryIndex directive doesn't allow me to say that 'index' is a directory, only 'index.html'. That is to say, the following: DirectoryIndex index index.html doesn't cause Apache to automatically find /some/path/index, even if I have defined one using AddHandler. I'm assuming this is because there is no such file, the handler is attached to the /some/path/index directory, there isn't anything for Apache to find. For the moment I'm faking things out using the miracle of mod_rewrite: RedirectMatch ^/some/path/index\.html /some/path/index which makes it all work like I want. NOW Apache finds the handler for some reason. So I'm not complaining, and I don't need a fix, but I wonder if I'm missing something. * AddHandler attaches a handler to a set of files with a given suffix. * SetHandler attaches a handler to a location (a directory, right?) and all of the files therein. * There isn't (?) a directive that attaches a handler to a single leaf in the directory tree which may in fact be non-existent in such a manner that the DirectoryIndex directive will find the leaf. Have I missed something? Am I abusing the tool? mma
RE: Large Data Set In Mod_Perl
> On Thu, 2003-05-29 at 12:59, Marc M. Adkins wrote: > > That's news to me (not being facetious). I was under the > impression that > > cloning Perl 5.8 ithreads cloned everything, that there was no > sharing of > > read-only data. > > We're not talking about ithreads here, just processes. The data is > shared by copy-on-write. It's an OS-level feature. See the mod_perl > docs for more info. My original comment was regarding threads, not processes. I run on Windows and see only two Apache processes, yet I have a number of Perl interpreters running in their own ithreads. My understanding of Perl ithreads is that while the syntax tree is reused, data stored in the parent ithread is cloned. In addition, since I'm on Windows, I'm not convinced that the type of OS-level code sharing you're talking about is in fact done. Windows doesn't fork(). mma
FW: Large Data Set In Mod_Perl
> On Thu, 2003-05-29 at 11:59, Marc M. Adkins wrote: > > > > perhaps something such as copying the whole 800,000 rows to > > > > memory (as a hash?) on apache startup? > > > > > > That would be the fastest by far, but it will use a boatload of RAM. > > > It's pretty easy to try, so test it and see if you can spare > the RAM it > > > requires. > > > > Always one of my favorite solutions to this sort of problem > (dumb and fast) > > but in mod_perl won't this eat RAM x number of mod_perl threads??? > > No. If you load the data during startup (before the fork) it will be > shared unless you modify it. That's news to me (not being facetious). I was under the impression that cloning Perl 5.8 ithreads cloned everything, that there was no sharing of read-only data. mma
RE: Can't use sendmail more than once
> I have migrated my site from IIS and Active State to Apache 1.3 > and mod_perl > on a Windows machine. I use the site to send emails to registered users > using Mail::sendmail through our SMTP server (another machine). > > With Apache I can only send emails once after I start the Apache server, > thereafter it tells me it can't connect to the SMTP server. Restarting the > Apache server leads to again being able to only send emails once. I've been having similar problems using Mail::Sendmail 0.79 w/Apache 2.0.45 and mod_perl 1.99.10_dev on Windows. It works for a while (generally more than once) and then it can't connect. I haven't tracked it down yet. mma
RE: Large Data Set In Mod_Perl
> > perhaps something such as copying the whole 800,000 rows to > > memory (as a hash?) on apache startup? > > That would be the fastest by far, but it will use a boatload of RAM. > It's pretty easy to try, so test it and see if you can spare the RAM it > requires. Always one of my favorite solutions to this sort of problem (dumb and fast) but in mod_perl won't this eat RAM x number of mod_perl threads??? In this case one of the advantages of the DBMS is that it is one copy of the data that everyone shares. mma