in reply to IPC::Shareable::SharedMem: shmget: Permission denied

My guess is that after the reboot the shared memory segment was somehow created by root and not cleaned up. Now when you try to run the scripts as anything else, they try to access the existing one and fail to have permission because that segment is owned by root. And when you run it as root it doesn't clean it up because it didn't create it.

Try running it once by root with the following line at the end:

(tied $robj->{status})->remove();
If that doesn't clear things up, my guess is wrong. At that point you need help from someone who understands Unix system administration better than I do. :-(

Replies are listed 'Best First'.
Re^2: IPC::Shareable::SharedMem: shmget: Permission denied
by katharnakh (Novice) on Jan 19, 2009 at 06:51 UTC
    Thanks, the solution worked out.
    katharnakh
Re^2: IPC::Shareable::SharedMem: shmget: Permission denied
by katharnakh (Novice) on Jan 19, 2009 at 08:59 UTC
    Hi,
    After doing so like as above said, it worked for me when tried as 'root' and 'cbsrepl' users. But again for some reason, it started again throwing the same error.
    I tried once by having only two lines, just to check whether i can delete previously created one,
    use IPC::Shareable; tie $robj->{status}, 'IPC::Shareable', 'data_glue', {create => 0, mode + => 664, destroy => 0}; (tied $robj->{status})->remove();
    but after this there was nothing printed on the screen, as there is nothing to print. Then i checked
    > ipcs -ma ------ Shared Memory Segments -------- key shmid owner perms bytes nattch stat +us 0x61746164 16187392 root 230 65536 0 ------ Semaphore Arrays -------- key semid owner perms nsems 0x61746164 15630336 root 230 3 ------ Message Queues -------- key msqid owner perms used-bytes messages 0x00001f58 0 root 600 0 0
    But still, it looks something remains even after having (tied $robj->{status})->remove();. May be because of this am i getting the error again? If so, how can delete this and take measures to create once again and delete once done?
    Thanks in advance,
    katharnakh.
      At a guess, one time the program ran and the job was killed unexpectedly before it did its cleanup.

      If that is the case the best solution is probably to clean it up again as root, then run as "cbsrepl" and deliberately leave the memory segment there. Now it will work as cbsrepl and root indefinitely as long as nobody cleans up the existing memory segment. (But you'll need to deal with this when the machine next reboots, talk to your sysadmin about setting up an init script to create the memory segment as cbsrepl to avoid it next time.)