Received: (qmail 9757 invoked by uid 2012); 28 Jun 1999 16:01:24 -0000 Message-Id: <19990628160124.9756.qmail@hyperreal.org> Date: 28 Jun 1999 16:01:24 -0000 From: Joachim Marder Reply-To: marder@pobox.com To: apbugs@hyperreal.org Subject: ap_init_modules gets called twice. X-Send-Pr-Version: 3.2 >Number: 4667 >Category: apache-api >Synopsis: ap_init_modules gets called twice. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Mon Jun 28 09:10:01 PDT 1999 >Last-Modified: Tue Jun 29 22:20:00 PDT 1999 >Originator: marder@pobox.com >Organization: >Release: 1.3.4 >Environment: Linux balvenie 2.2.1 #2 SMP Fri Feb 12 14:43:14 CET 1999 i686 unknown Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release) >Description: I just noticed that ap_init_modules is getting called twice during server start, which causes the init callback function of my shared module to be called twice too. I saw that all entries to my log file which i did during initialization of my module appeared twice. It may be possible that this bug only appears with option -X on httpd >How-To-Repeat: write a line of text to a file during initialization of a module or use gdb with a breakpoint on ap_init_modules. >Fix: Remove one of the ap_init_modules calls >Audit-Trail: State-Changed-From-To: open-closed State-Changed-By: marc State-Changed-When: Mon Jun 28 13:49:07 PDT 1999 State-Changed-Why: It is that way on purpose. While it could possibly be changed now for various reasons, for backwards compatibility state the double init remains. Your module needs to be able to handle having the init function called multiple times anyway, since it happens at HUP/USR1. From: Marc Slemko To: Joachim Marder Cc: Apache bugs database Subject: Re: apache-api/4667: ap_init_modules gets called twice. Date: Tue, 29 Jun 1999 22:13:33 -0700 (PDT) On Tue, 29 Jun 1999, Joachim Marder wrote: > Hi. > > > Synopsis: ap_init_modules gets called twice. > > > > State-Changed-From-To: open-closed > > State-Changed-By: marc > > State-Changed-When: Mon Jun 28 13:49:07 PDT 1999 > > State-Changed-Why: > > It is that way on purpose. While it could possibly be > > changed now for various reasons, for backwards compatibility > > state the double init remains. > > > > Your module needs to be able to handle having the init > > function called multiple times anyway, since it happens at > > HUP/USR1. > > Sorry, but I don't know what you mean with HUP/USR1. Could > you please clarify this? When you send a SIGHUP to the server, all the init functions are called again. > The problem is that ap_get_module_config returns different > pointers in the two init calls, so I cannot see if I already > have initilized my stuff. What happens to the first config > struct and the data I filled in??? If I lock a file or for You need to read up on how pools work. > off a process I have a problem if init gets called a second > time and the config struct is empty again. You need to register the appropriate cleanup functions in the appropriate pools so that anything you do can be automatically cleaned up when the pool is destroyed. > > Best regards, > > Joachim Marder > > >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]