We don't bite newbies here... much | |
PerlMonks |
problem porting to threaded modeby cmac (Monk) |
on Jan 01, 2009 at 05:03 UTC ( [id://733599]=perlquestion: print w/replies, xml ) | Need Help?? |
cmac has asked for the wisdom of the Perl Monks concerning the following question:
Trying to shift our largely mod_perl2 web site to an Apache2 threaded MPM and perl ithreads. The following works under the non-threaded prefork MPM: The routines that use the databases re-stat the DB files and untie and re-tie a DB that has changed. Each child process must do this for itself. In the threaded environment, any thread within a process may discover that such an untie and re-tie is necessary, but such an operation should be effective for the other threads in the process as well. This means that @dbs and @dbModTime should be shared among the threads: Making only the changes above makes perl complain "Invalid value for shared scalar" about the $dbs[$db] = {}; line. This error message can be fixed as follows: Unfortunately, when this is done the DBs look empty, and the log notices for each DB show "0 entries". Removing the ':shared' tag for @dbs and the 'shared_clone()' wrapper for '{}' causes the log notices to show the proper number of entries for each DB, but blows up the Apache configuration process (before the 'resuming normal operations' message) with in error_log and the following on the terminal: I guess not having databases is better. I've tried using @dbs as an array of references to named, shared hashes: also no database content. The 'worker' and 'event' MPMs work identically w/r/t this problem. They say monks aren't into fancy threads, but suggestions of things to try will be very welcome. Happy New Year, cmac
Back to
Seekers of Perl Wisdom
|
|