Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13543 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80230 invoked by uid 1010); 26 Oct 2004 22:42:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79924 invoked from network); 26 Oct 2004 22:42:15 -0000 Received: from unknown (HELO colo.lerdorf.com) (66.198.51.121) by pb1.pair.com with SMTP; 26 Oct 2004 22:42:15 -0000 Received: from rasmus2.corp.yahoo.com (rasmus2.corp.yahoo.com [207.126.233.18]) by colo.lerdorf.com (8.13.1/8.13.1/Debian-15) with ESMTP id i9QMgD9n009618; Tue, 26 Oct 2004 15:42:13 -0700 Date: Tue, 26 Oct 2004 15:42:09 -0700 (PDT) X-X-Sender: rasmus@t42p.lerdorf.com To: Wez Furlong cc: internals , Andi Gutmans , Marcus Boerger In-Reply-To: <4e89b426041026153151d211ae@mail.gmail.com> Message-ID: References: <4e89b4260410261513911b5ae@mail.gmail.com> <4e89b426041026153151d211ae@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] dl() unload / module shutdown issue still unresolved From: rasmus@php.net (Rasmus Lerdorf) On Tue, 26 Oct 2004, Wez Furlong wrote: > On Tue, 26 Oct 2004 15:23:45 -0700 (PDT), Rasmus Lerdorf wrote: > > On Tue, 26 Oct 2004, Wez Furlong wrote: > > > It should be safe to never ever dlclose() a module. > > > > Do you mean never to dlclose() a module loaded via dl() at request time or > > do you mean that in general it should be safe to never dlclose() a module > > even if it came in via an extension line in the php.ini file? The former > > is likely a true statement, but the latter is definitely not. > > I did mean the latter. What's the issue there? It's a bit tricky. When Apache starts up it does a double-pass of the conf files in order to do a syntax check. It needs to load all its modules in order to do this so our libphp4.so gets loaded which in turn causes us to load all our extensions. Then Apache unloads libphp4.so and starts over and reloads libphp4.so. Now, in between these two dlopens of libphp4.so memory usage can change dramatically. For example, if you have a bunch of mod_rewrite rules in your Apache conf the second time libphp4.so is loaded it can easily be a page higher in memory. If the extensions that PHP loaded on the first pass were not unloaded then any callback addresses in the extensions are going to be off by a page and you will get some very nasty crashes. -Rasmus