Thursday, September 15, 2011

My answer to "Registering a user crashes LampCMS: shmop_open(): unable to attach or create shared memory segment"

This is my answer to a Question on Support site for LampCMS project


It looks like this may be a problem for some users. This may very well be caused by Suhosin or by SELinux. I can't be sure, but just a quick search for this issue revealed that it's a common problem with many other projects.

I am now thinking of a couple of possible solutions:

Add config option to !config.inc ENABLE_SHARED_MEMORY and set it to true by default but if you notice problems with this function then setting to false will cause this GEOIP module to not use shared memory and use a slower file-based reads.

A Second possibility is to download the comma-separated GEOIP file from Maxmind.com and then write a script that imports it to MongoDB then just use MongoDB to lookup location by ip address. This will work for everyone. It's very easy to write that import script, but I have to think of how to do this most effeciently, not sure if I want to keep all data in one Mongo collection or use 2 or 3.
What I mean is that maybe store country/state in one location, city in another and ip to locationID in another one. OR can just follow the Mongo NO-Joins way and just store the data in one collection, keep its size fairly large but never have any joins during select. Basically it will require a little more RAM like 300MB but since the old way of storing binary DB in shared memory required at least 50MB, we can just say that the new way will require just 250MB more but will eliminate the need for shared memory and will eliminate the need to cache already resolved ip - to - location records in cache, which is currently stored in Mongo anyway.


I'm working on the solution. It will be done probably over the weekend.

No comments:

Post a Comment