Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 38F8B616B for ; Mon, 20 Jun 2011 20:47:43 +0000 (UTC) Received: (qmail 72111 invoked by uid 500); 20 Jun 2011 20:47:42 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 72069 invoked by uid 500); 20 Jun 2011 20:47:42 -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 72060 invoked by uid 99); 20 Jun 2011 20:47:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 20:47:42 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jasonlfunk@gmail.com designates 209.85.161.45 as permitted sender) Received: from [209.85.161.45] (HELO mail-fx0-f45.google.com) (209.85.161.45) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 20:47:38 +0000 Received: by fxm2 with SMTP id 2so1262597fxm.18 for ; Mon, 20 Jun 2011 13:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=tFm9nXbLsIp7up6Pjt+2joZNEpF4ukhrcNwvf8OFU34=; b=G/NxxTEq0kQeZNExWwfQ5aKGa2WPDOmMapkOgDJACAio0Iqp6UoOolWGX2U3EU7aKs hIPtCJ9qN5RPbo2pMTHzDnaZgOc6xexPgF4Vyu+NimQ8kDYB8vU+vBu+/8aszHOAckOx 4eriEHGpowpMMI9oXk2M+/IzW7V9XWe3WLEMA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=afIGqqJo35gnRo4p1j1k6JwGf7Ylvpxdt5TEsWRZILcTKEt2BZ8rpw53L6vq8y5fU1 zFQCY4YJt/wruP3DjlLXBUxF245lU6Y9mcdk64SbrOyUi6yqd+zq6Z0q2pA8fXSAT0Ul 5WRVnQOzDam5tKDDyYB8OZlXBcbLwGiML/OZg= Received: by 10.223.53.85 with SMTP id l21mr145382fag.26.1308602837090; Mon, 20 Jun 2011 13:47:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.158.76 with HTTP; Mon, 20 Jun 2011 13:46:57 -0700 (PDT) In-Reply-To: <4330EAB7-1E2D-44C8-B8B6-9312843B03FC@inmon.com> References: <4330EAB7-1E2D-44C8-B8B6-9312843B03FC@inmon.com> From: Jason Funk Date: Mon, 20 Jun 2011 15:46:57 -0500 Message-ID: Subject: Re: Module External Configuration To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=00151747885c41c1a204a62ad7e8 --00151747885c41c1a204a62ad7e8 Content-Type: text/plain; charset=ISO-8859-1 I have moved my configuration over to shared memory (following mod_shm_counter as an example) and it conceptually seems to be working. I am storing a struct in the memory and members that share it's memory (such as the last mod time of the configuration file) persist over multiple children. However, when I am loading the configuration file I have to allocate additional memory. This apparently doesn't get stored in the same shared memory as it isn't sticking around. How do I dynamically allocate new memory to the struct that lives in shared memory? Jason On Mon, Jun 20, 2011 at 3:29 PM, Neil McKee wrote: > In the mod-sflow implementation I have one thread responsible for reading > in new configuration as it changes and writing it to a shared-memory area > where the worker-processes/threads can pick it up whenever it changes. I > don't know if that is the best way or not, but it's one data point for you. > Source code is here: > > http://mod-sflow.googlecode.com > > Neil > > > On Jun 20, 2011, at 11:39 AM, Jason Funk wrote: > > > Hello, > > > > The module that I am writing has an external configuration file that it > > parses and loads into configuration when the server loads. Before every > > request it checks to see if the configuration file has been updated and > if > > it has it reloads the configuration. The configuration should be shared > over > > the entire server. The problem I am running into is that after the > > configuration file is updated the new configuration gets reloaded and > stored > > in memory but after a little while, the configuration reverts back to > it's > > previous version. I assume that this is because a new process was spawned > to > > handle a new request and the updated memory didn't get carried over (even > > though the pointer address didn't change...) > > > > My question is this: What mechanism should I be using in order to > > store persistent, mutable, configuration data that is shared between > every > > child process? > > > > > > Jason > > --00151747885c41c1a204a62ad7e8--