When i delete exit(1), nothing has changed but when i commented out all the mutexes it works, counter is working well. That's great. :) that means shared memory is working well.
in terms of mutexes i need to create mutex in post config in handler 1. lock mutex 2. process global variable 3. unlcok mutex If i'm right what is the problem with that code, do you have any ideas or advices about these segmentation faults. Oğuzhan TOPGÜL On Wed, Nov 23, 2011 at 12:39 AM, Sorin Manolache <sor...@gmail.com> wrote: > On Tue, Nov 22, 2011 at 21:25, Oğuzhan TOPGÜL <oguzhantop...@gmail.com> > wrote: > > hey guys, > > i'm in terrible with these shared memory. > > I tried to write a basic module by looking at the examples that basic > module > > just holds a counter and prints it to the client. > > when i compile the code attached, i got no error messages. But in apache > > error.log file i got > > lots of > > [notice] child pid 32653 exit signal Segmentation fault (11) > > and my module does not working. > > if you have time to look at my code and send me your advices i'll be > > appreciated. Because i'm getting crazy about these shared memory > concepts. > > I just want to define a global variable and process it in each request > from > > different sources. > > Regards, > > Oğuzhan TOPGÜL > > First remove the exit(1) from child_init. Otherwise apache does not > succeed in creating any children. > > If this does not solve your problem, comment all lines dealing with > the mutex and retry. I'm not saying that you don't need mutexes but > commenting them out would at least restrict the area where the > segfaults happen. > > S > > > > > > > On Tue, Nov 22, 2011 at 9:14 PM, Oğuzhan TOPGÜL <oguzhantop...@gmail.com > > > > wrote: > >> > >> Thank you guys so much. > >> What i want to do with shared memory is to hold the requester IPs and a > >> counter that holds how many times an IP made request. I'm planning to > hold > >> them in a binary tree. > >> I thought holding these IPs and counters in a file is slower than > holding > >> them in a shared memory because of the file I/O loss. And using binary > tree > >> as a data structure is going to make my search process faster and > easier. > >> Do you have any suggestions about shared memory-file usage or data > >> structure usage. > >> Regards > >> Oğuzhan TOPGÜL > >> > >> > >> On Tue, Nov 22, 2011 at 5:15 PM, Nick Kew <n...@apache.org> wrote: > >>> > >>> On Tue, 22 Nov 2011 09:41:02 -0500 > >>> "Pranesh Vadhirajan" <vadhira...@teralogics.com> wrote: > >>> > >>> > Nick, can you suggest some of these higher-level abstractions, > please? > >>> > I have been trying to make a module of mine work with a POSIX > shared memory > >>> > implementation, but I'm going nowhere with that. Are you referring > to the > >>> > apache shared memory implementation (apr_shm_...) or something else? > Either > >>> > way, if you could suggest what I should look into, it would be > greatly > >>> > appreciated. > >>> > >>> apr_shm is the old way of doing it. > >>> > >>> Today I'd recommend looking at mod_slotmem, and the socache modules. > >>> I used the latter for mod_authn_socache, which is a simple example. > >>> > >>> -- > >>> Nick Kew > >> > > > > >