IPC::Shareable::SharedMem: shmget: Permission denied

Discussion in 'Perl Misc' started by kath, Jan 16, 2009.

  1. kath

    kath Guest

    Hi,
    I have a simple script to test variable sharing between two perl
    processes,
    use IPC::Shareable;
    $robj = {status=>'init'};
    tie $robj->{status}, 'IPC::Shareable', 'data_glue', {create => 1, mode
    => 664, destroy => 1};
    $pid = fork();
    unless(defined $pid){
    print "Error durigng fork\n";
    }
    if($pid){
    $robj->{parent=>'parent'};
    }else{
    tie $robj->{status}, 'IPC::Shareable', 'data_glue', {create => 0, mode
    => 664, destroy => 0};
    $robj->{status} = 'updated';
    sleep(5);
    exit(0);
    }
    print "\n", $robj->{status}, "\n";

    When i run i get following error.
    IPC::Shareable::SharedMem: shmget: Permission denied
    at /usr/lib/perl5/site_perl/5.8.3/IPC/Shareable.pm line 566
    Could not create shared memory segment:
    at test_ipc_shareable.pl line 3

    Problem: I get above error when run as user account other than
    'root' . But the script used to work before, but started throwing this
    error, after server where this script runs was down due to storage
    corruption. I am getting this error after server came online.
    I am using perl v5.8.3 and IPC::Shareable v0.60. I tried reinstalling
    the package, using cpan shell, force make IPC::Shareable', but the
    unfortunately 'test IPC::Shareable' fails.

    Does any one know how to resolve this? Because running as 'root'
    creates other problems for my main scripts.

    Thanks in advance,
    katharnakh.
     
    kath, Jan 16, 2009
    #1
    1. Advertising

  2. kath

    kath Guest

    On Jan 16, 1:56 pm, Daniel Molina Wegener
    <> wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > kath <>
    > on Friday 16 January 2009 03:59
    > wrote in comp.lang.perl.misc:
    >
    >
    >
    > > Hi,
    > > I have a simple script to test variable sharing between two perl
    > > processes,
    > > use IPC::Shareable;
    > > $robj = {status=>'init'};
    > > tie $robj->{status}, 'IPC::Shareable', 'data_glue', {create => 1, mode
    > > => 664, destroy => 1};
    > > $pid = fork();
    > > unless(defined $pid){
    > > print "Error durigng fork\n";
    > > }
    > > if($pid){
    > > $robj->{parent=>'parent'};
    > > }else{
    > > tie $robj->{status}, 'IPC::Shareable', 'data_glue', {create => 0, mode
    > > => 664, destroy => 0};
    > > $robj->{status} = 'updated';
    > > sleep(5);
    > > exit(0);
    > > }
    > > print "\n", $robj->{status}, "\n";

    >
    > > When i run i get following error.
    > > IPC::Shareable::SharedMem: shmget: Permission denied
    > > at /usr/lib/perl5/site_perl/5.8.3/IPC/Shareable.pm line 566
    > > Could not create shared memory segment:
    > > at test_ipc_shareable.pl line 3

    >
    > Well, you are making the user to create the block under 0664
    > permissions, are the both users in the same group? In other case,
    > if both users are on different group they can't handle the shared
    > memory block.
    >
    > If you are under Linux, remember that when you create a new user,
    > the user holds a new individual group, and is not invited to new
    > groups until you invite him.
    >
    > Try setting both users in the same group by inviting them...
    >
    >
    >
    > > Problem: I get above error when run as user account other than
    > > 'root' . But the script used to work before, but started throwing this
    > > error, after server where this script runs was down due to storage
    > > corruption. I am getting this error after server came online.
    > > I am using perl v5.8.3 and IPC::Shareable v0.60. I tried reinstalling
    > > the package, using cpan shell, force make IPC::Shareable', but the
    > > unfortunately 'test IPC::Shareable' fails.

    >
    > > Does any one know how to resolve this? Because running as 'root'
    > > creates other problems for my main scripts.

    >
    > > Thanks in advance,
    > > katharnakh.

    >
    > Best regards,
    > - --
    > .O. | Daniel Molina Wegener | FreeBSD & Linux
    > ..O | dmw [at] coder [dot] cl | Open Standards
    > OOO |http://coder.cl/ | FOSS Developer
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.8 (FreeBSD)
    >
    > iEYEARECAAYFAklwS8EACgkQxyPEFPXO3WEmzQCdGyopJC+y9Tk8sUZW2B8rSq3A
    > 74IAnA3/AThKFEeAntYehpFK8QDCb4rG
    > =VtpM
    > -----END PGP SIGNATURE-----


    Thanks, the problem got resolved.

    katharnakh.
     
    kath, Jan 19, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sébastien Cottalorda

    IPC::Shareable Problem with multidimentional hash

    Sébastien Cottalorda, Sep 9, 2005, in forum: Perl Misc
    Replies:
    8
    Views:
    217
    Sébastien Cottalorda
    Sep 13, 2005
  2. sridevi

    IPC::Shareable

    sridevi, Dec 8, 2006, in forum: Perl Misc
    Replies:
    2
    Views:
    105
    Sisyphus
    Dec 8, 2006
  3. lsyx
    Replies:
    2
    Views:
    178
  4. David Jacobowitz

    Net::Server + IPC::Shareable == decent performance ?

    David Jacobowitz, Nov 8, 2007, in forum: Perl Misc
    Replies:
    1
    Views:
    147
  5. Snorik

    IPC:Shareable

    Snorik, Sep 18, 2008, in forum: Perl Misc
    Replies:
    19
    Views:
    544
    Snorik
    Sep 29, 2008
Loading...

Share This Page