Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 65132 invoked from network); 11 Sep 2009 23:11:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Sep 2009 23:11:03 -0000 Received: (qmail 56902 invoked by uid 500); 11 Sep 2009 23:11:01 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 56829 invoked by uid 500); 11 Sep 2009 23:11:01 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 56821 invoked by uid 99); 11 Sep 2009 23:11:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Sep 2009 23:11:01 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of siracusa@gmail.com designates 74.125.92.149 as permitted sender) Received: from [74.125.92.149] (HELO qw-out-1920.google.com) (74.125.92.149) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Sep 2009 23:10:52 +0000 Received: by qw-out-1920.google.com with SMTP id 5so808670qwc.40 for ; Fri, 11 Sep 2009 16:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:user-agent:date:subject:from :to:message-id:thread-topic:thread-index:in-reply-to:mime-version :content-type:content-transfer-encoding; bh=/SHSpg0drGHsT1n0Kzmc6ZBxELGwtjFXefBO3O8qOGk=; b=r5et26Gw8PJ9wjajsngfubvn2zGL/iQXG046SpYdzvGe/uXZd6YpmX4x5PS/NDxMPD RVq/wofI9/r2DpTK6/apphu1OjLD6GA6NOVHCpC/NrEpT6Nz96Rmat8Jkd5+1nWXXX9U 813bKZt9lsI+hxGdqS2ejm/k6wpnTRaEm0WX0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=DWgYL2dNZ0PxUpAXKG8boNgAgqt8KKwOXv6k04LWrtlDZQNbKzEczz3i88i/Fy2MSt 2fmmZ8NxC9UfeUvemRN0C2q2MKqJgEZTMoqVlLFulLQx87qBCgB/MfakT3h1BJo6moYj Bm05Whi9Y5nn+g0g686EAKa7iaTPY+shgCIj8= Received: by 10.224.24.136 with SMTP id v8mr3150050qab.79.1252710630917; Fri, 11 Sep 2009 16:10:30 -0700 (PDT) Received: from ?10.0.1.40? (pool-173-76-154-194.bstnma.fios.verizon.net [173.76.154.194]) by mx.google.com with ESMTPS id 23sm1069959qyk.15.2009.09.11.16.10.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 11 Sep 2009 16:10:30 -0700 (PDT) User-Agent: Microsoft-Entourage/12.20.0.090605 Date: Fri, 11 Sep 2009 19:10:27 -0400 Subject: Re: a better way to recognize module changes From: John Siracusa To: Mod Perl Mailing List Message-ID: Thread-Topic: a better way to recognize module changes Thread-Index: AcozNQyHP2Dwn/48qkeRZtj8DkSbGA== In-Reply-To: <4DB1DB28-1142-43AA-B8A6-68DCBE3E306C@pobox.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 9/11/09 6:57 PM, Jonathan Swartz wrote: >> PerlSetVar ReloadAll On >> >> PerlSetVar ReloadHttpds My::Moose >> >> So that modules in ReloadHttpds terminates existing user httpd >> processes and causes the server to fork off new httpd children. > > But again, if Apache::Reload runs as part of the child process itself, > how can it implement ReloadHttpds effectively? It would have to kill > itself off, which would mean your first request would generate an > error - not a good user experience. The last thing I did in this area looked something like this: PerlCleanupHandler My::WebApp::Restarter PerlSetVar WatcherInterval 60 PerlSetVar WatcherCompileCheck 1 where all the handler did was fork off a watcher process if one didn't already exist. The watcher would then stat() all the files in %INC periodically. If one had changed, it'd attempt to compile it (if WatcherCompileCheck was true) catching/absorbing any errors to prevent ugly output, and then restart the apache server by sending it a signal if the file compiled okay. Doing a full restart avoids all the odd module re-load issues (and there are many). The polling interval may seem too long, but this would all happen as you were working on the code and before you reached back to a browser window to reload a page. By the time you did, the hope was that the server would already be back up again. One obvious improvement would be to use kqueue/inotify/FSEvents to avoid polling entirely, making it much more likely that the server would be back in time for your next request. -John