Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 9876 invoked from network); 21 Apr 2010 12:38:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Apr 2010 12:38:17 -0000 Received: (qmail 75225 invoked by uid 500); 21 Apr 2010 12:38:16 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 74722 invoked by uid 500); 21 Apr 2010 12:38:15 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 74490 invoked by uid 99); 21 Apr 2010 12:38:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Apr 2010 12:38:15 +0000 X-ASF-Spam-Status: No, hits=4.7 required=10.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of teknosoul@gmail.com designates 209.85.218.226 as permitted sender) Received: from [209.85.218.226] (HELO mail-bw0-f226.google.com) (209.85.218.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Apr 2010 12:38:08 +0000 Received: by bwz26 with SMTP id 26so7052905bwz.27 for ; Wed, 21 Apr 2010 05:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=+Mucq/SNFIwTfiYYFhbrjtuLibpOdU56Wv69ecug8sY=; b=vk5yGKf96wp7NBpsLtRBoDzTefkUVIZrDRm9iL8eMQugD7758W4k8g1OM0dUMx+Itp Ae+65RkGAulSG+FITuXxjxhPXyFVWtS+UBkXQXTRPXyVcPlSZL0sSo+evwHhO0MmKnQi nAZgSB/orEacsD81mtdcAvirXY6SdllQTOP3s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=FEO/04bZ402+nm7g++HkJk/X2Y9mI9/eiBN821apqnTs4RcQk0I2MkY44tE2JyAQfm 1nJtHc+ciGrCexjbzX4tv0FhR4vtgWwvjScZPS1SaEfu5lvx7FNloKSJE9tDbx2OTfAy dwzFGvXnPrg08/VCl526tiIyTbeAwVbHyIm5Y= MIME-Version: 1.0 Received: by 10.239.148.196 with HTTP; Wed, 21 Apr 2010 05:37:47 -0700 (PDT) In-Reply-To: <45730.82430.qm@web50706.mail.re2.yahoo.com> References: <120632.3523.qm@web50704.mail.re2.yahoo.com> <377280.88925.qm@web50703.mail.re2.yahoo.com> <45730.82430.qm@web50706.mail.re2.yahoo.com> Date: Wed, 21 Apr 2010 08:37:47 -0400 Received: by 10.239.185.81 with SMTP id b17mr755769hbh.191.1271853467656; Wed, 21 Apr 2010 05:37:47 -0700 (PDT) Message-ID: Subject: Re: Process lifetime and hooks to use From: Some Guy To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=001485f7c50e25646b0484be7689 X-Virus-Checked: Checked by ClamAV on apache.org --001485f7c50e25646b0484be7689 Content-Type: text/plain; charset=ISO-8859-1 I need to get it from the configuration file. If the post config hook runs prior to the ap monitor hook, then that would work. But what memory is all of that data allocated from? I don't want them disappearing on me. On Wed, Apr 21, 2010 at 4:22 AM, alin vasile wrote: > why don't you create global variables and put there the configuration data? > > > > > ________________________________ > From: Some Guy > To: modules-dev@httpd.apache.org > Sent: Wed, April 21, 2010 1:44:06 AM > Subject: Re: Process lifetime and hooks to use > > Thanks for your comments. Is a possible solution to the configuration > problem to keep a global reference to a pool that I create (w/o a parent)? > I can then use that pool to duplicate some of the string data I need from > the configuration and store those in my globals as well. > > I'll need to think of a way to document the code so people know what the > heck I'm doing too. People who aren't familiar with apache modules are > going to think I'm on crack. > > SB > > On Mon, Apr 19, 2010 at 5:00 PM, alin vasile >wrote: > > > > > > > comments inline > > > > > > > > > > ________________________________ > > From: Some Guy > > To: modules-dev@httpd.apache.org > > Sent: Mon, April 19, 2010 3:04:02 PM > > Subject: Re: Process lifetime and hooks to use > > > > I think my understanding of the monitor hook is fine. I can just use the > > passed in pool as my context and use the userdata_set/get APIs as I > > periodically fetch / update a file. > > >>[alin vasile] the pool is used to allocate the memory from. You'll need > > global variables to store the pointers. See Nick.s response > > > > What I'll need to play with is to see > > how I can set this up as a configuration parameter. If the post_config > > hook > > gets called in the parent process with the apr_pool_t* passed in also > being > > the same one that monitor gets, then that would work. > > >> [alin vasile] I'm not sure of that. > > > > The child hooks I think are the issue when dealing with the various MPMs, > > but it might not be a problem anymore since I can just use the pool > passed > > into child_init as the store for my lock and cache. Is the same pool > > passed > > in child_init accessible in the request handler via > > request->server->process->pool ? > > > > I see a lot of modules using these static variables and globals all over > - > > is this safe? Aren't the modules existing in multiple process spaces? > How > > does the author know which static variables are going to be safe to > access > > in each hook? I guess any statics assigned in the child_init are safe to > > use in the request handlers and other threads spawned in the child_init. > > And for the parent process it's probably best to just use the pool? > > >> [alin vasile] You can't init static variables in child_init. don't > > declare them static and, if needed, protect their read/write with locks > > > > Thanks, > > > > SB > > > > On Mon, Apr 19, 2010 at 1:41 AM, alin vasile > >wrote: > > > > > It depends what you want to do in this hook. > > > > > > --- On Sun, 4/18/10, Some Guy wrote: > > > > > > From: Some Guy > > > Subject: Re: Process lifetime and hooks to use > > > To: modules-dev@httpd.apache.org > > > Date: Sunday, April 18, 2010, 5:51 PM > > > > > > Ah great. I know what I should do with that. Any insight on the > > > differences in MPMs and what to watch out for? > > > > > > On Sun, Apr 18, 2010 at 12:22 PM, William A. Rowe Jr. > > > wrote: > > > > > > > On 4/18/2010 2:34 AM, alin vasile wrote: > > > > > the monitor hook gets only a pointer to an apr_pool_t structure. > > > > > > > > Take a look at apr_pool_data_* API's, that should provide you all of > > the > > > > context and persistence you need. > > > > > > > > You will never see anything about servers, connections or requests > > > because > > > > this is running in the *parent*, it is blissfully unaware of specific > > > > requests > > > > and is therefore immune from being hijaaked by remote code execution > > and > > > > less > > > > severe but destabilizing attacks on the request processing code > itself. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --001485f7c50e25646b0484be7689--