Mark Hedges schrieb:
Just curious, did you try eliminating every other module that you might be loading (anywhere in any module loaded by Apache)? i.e. did you try a simple setup that only tries to open your database and does absolutely nothing else and loads no other CPAN modules. With "use strict" and "use warnings FATAL => 'all'" of course. --mark--
Time::HiRes was loaded in addition to the Apache2:: modules. FATAL warnings weren't on, just plain warnings. I changed the setup as follows: use strict; use warnings FATAL => 'all'; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw( OK ); use Apache2::RequestUtil (); use Apache2::Util (); use Apache2::Request (); use Sleepycat::Db; use Sleepycat::DbXml; I dropped the query I was doing, which took about 0.7 seconds. So now it's just opening the environment. Still seeing SEGVs. I think the failure is related to how threads or processes are torn down. What I'm getting is the following: Database handles still open at environment close Open database handle: tv.dbxml/structural_stats Open database handle: tv.dbxml/secondary_document_statistics_decimal Open database handle: tv.dbxml/secondary_document_index_decimal Open database handle: tv.dbxml/secondary_document_statistics_date Open database handle: tv.dbxml/secondary_document_index_date Open database handle: tv.dbxml/secondary_document_statistics_string Open database handle: tv.dbxml/secondary_document_index_string Open database handle: tv.dbxml/secondary_document Open database handle: tv.dbxml/content_document Open database handle: tv.dbxml/secondary_dictionary Open database handle: tv.dbxml/primary_dictionary Open database handle: tv.dbxml/secondary_sequence Open database handle: tv.dbxml/secondary_configuration [Tue Jan 20 17:47:39 2009] [notice] child pid 17142 exit signal Segmentation fault (11) What does this mean? There is a file called tv.dbxml, which is the Berkeley XML database (XmlContainer). The structural_stats etc are named databases within that database files, as *file and *database in open: int Db::open(DbTxn *txnid, const char *file, const char *database, DBTYPE type, u_int32_t flags, int mode); http://www.oracle.com/technology/documentation/berkeley-db/db/api_cxx/frame.html I'm just realizing Google doesn't know about these database names yet. The error message is pretty explicit about what's wrong here: "Database handles still open at environment close". Indeed, I do not explicitly close the handles. In a batch script, this doesn't pose any problem; mod_perl, however, isn't exactly equivalent to a batch script. The problem is: Where in threaded mod_perl do I get a chance to do fixup work, like closing handles? I tried PerlChildInitHandler/PerlChildExitHandler, only to notice that I then run into the issues of nothing being global, unless using threads::shared, which caused even more weird issues (remember the PerlChildInitHandler seemingly *blocking* on $DbEnv->open). So I went back to Mark's and Craig's initial recommendation of using package level my-variables (which are local to the thread) to hold the handles, initialize them lazily, and then using them as long as needed. The issue *seems* to be (I could be wrong) that in order for Berkeley to be happy, I'd have to be able to have some fixup code run the moment a thread decides it has to leave the stage, so the handles stored in the package-level my-variables can be closed in a controlled fashion. Can I have code run at that instant? Or any other ideas what's going on? Michael Ludwig