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 4865060BE for ; Mon, 20 Jun 2011 21:57:23 +0000 (UTC) Received: (qmail 9840 invoked by uid 500); 20 Jun 2011 21:57:22 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 9808 invoked by uid 500); 20 Jun 2011 21:57:22 -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 9800 invoked by uid 99); 20 Jun 2011 21:57:22 -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 21:57:22 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,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 sorinm@gmail.com designates 209.85.216.45 as permitted sender) Received: from [209.85.216.45] (HELO mail-qw0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 21:57:18 +0000 Received: by qwj8 with SMTP id 8so1324393qwj.18 for ; Mon, 20 Jun 2011 14:56:57 -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:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=iL3UFMGEz0u7o/EJGsmO/rJvw6n2gXZ/l4lD6icOYMY=; b=Zx8v1OtDpNohTVlaB7wwnAe+IIRfQDdJdIocc5e4WAfPch6CaCoqJes1j0cWUp0PkP w24NMUJa59qSGlywKR4cd5k8VysohSUnGaivL9YmAOfNKROXVEghJLgxxPArvaI07jjO wzpxjxxcf1nI6UiUoENtiAwR+JsPeU2h2hPc8= 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:content-transfer-encoding; b=fyfg6jFBLSkabH7RLcOjLmOg0J02Q4vnWSh1PIZLy9tEG5G0c5ldU7q6x8mxrspm44 AljG38tSev5nj6RWi7uXXOFA04EDTM8S0PPjacg20SjHoBQq+6RJR++cGNVwVMnrxgSD BllFhblT0xBaUKpb4Zi3A3A9HYiXLralNnv74= MIME-Version: 1.0 Received: by 10.224.11.2 with SMTP id r2mr4269743qar.214.1308607017450; Mon, 20 Jun 2011 14:56:57 -0700 (PDT) Received: by 10.224.53.202 with HTTP; Mon, 20 Jun 2011 14:56:57 -0700 (PDT) In-Reply-To: References: <4330EAB7-1E2D-44C8-B8B6-9312843B03FC@inmon.com> Date: Mon, 20 Jun 2011 23:56:57 +0200 Message-ID: Subject: Re: Module External Configuration From: Sorin Manolache To: modules-dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Jun 20, 2011 at 22:46, Jason Funk wrote: > 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 a= s > the last mod time of the configuration file) persist over multiple childr= en. > 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 mem= ory > to the struct that lives in shared memory? Try C++ and boost::interprocess::managed_shared_memory and boost::interprocess::allocator. Sorin > > Jason > > On Mon, Jun 20, 2011 at 3:29 PM, Neil McKee wrote: > >> In the mod-sflow implementation I have one thread responsible for readin= g >> in new configuration as it changes and writing it to a shared-memory are= a >> where the worker-processes/threads can pick it up whenever it changes. = =A0 I >> don't know if that is the best way or not, =A0but it's one data point fo= r you. >> =A0 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 i= t >> > parses and loads into configuration when the server loads. Before ever= y >> > request it checks to see if the configuration file has been updated an= d >> if >> > it has it reloads the configuration. The configuration should be share= d >> 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 spaw= ned >> to >> > handle a new request and the updated memory didn't get carried over (e= ven >> > 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 >> >> >