IPC : destroy IPC::ShareLite-segments

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default IPC : destroy IPC::ShareLite-segments


    I use IPC::ShareLite-segments but havnt figured out an elegant way to
    destroy the created segments. The recommended way (manpage) always fails
    with "invalid argument", which reminds to a false shmctl-call.

    So I do a syscall on ipcs to get the id of the segment and call shmctl on
    my own, which doesnt feel good to me.

    ----------share_del.pl---------
    #!/usr/bin/perl -w

    use strict;
    use IPC::ShareLite;
    use IPC::SysV qw(IPC_RMID);

    # CREATE A SEGMENT WITH KEY=1234 alias 0x42d
    my $cache = new IPC::ShareLite (-key=>1234,
    -create=>'yes',
    -size=>50000,
    -destroy=>'no') or warn "$!\n";

    undef $cache;


    print `ipcs -m | grep 4d2`;

    # try to remove via ShareLite ..
    print "try with ShareLite\n";
    my $cache_d = new IPC::ShareLite (-key=>1234,
    -destroy=>'yes') or warn "could not destroy segment : $!\n";

    undef $cache_d;
    print `ipcs -m | grep 4d2`;

    # try to remove via direct call
    print "try with shmctl\n";
    $a=`ipcs -m | grep 4d2`;
    $b=$1 if $a=~/^.*?\s(.*?)\s/;
    shmctl($b,IPC_RMID,0) or warn "could not destroy segment : $!\n";
    print `ipcs -m | grep 4d2`;
    --------------------------

    $ ~/bin/devel/share_del.pl
    0x000004d2 26869763 pilsl 666 50000 0
    try with ShareLite
    could not destroy segment : Invalid argument
    0x000004d2 26869763 pilsl 666 50000 0
    try with shmctl


    any help ?
    thnx,
    peter

    --
    peter pilsl
    [email]pilsl_usenet@goldfisch.at[/email]
    [url]http://www.goldfisch.at[/url]

    peter pilsl Guest

  2. Similar Questions and Discussions

    1. The IPC::ShareLite is very slow than fetch data from file ??
      time shmTest.pl .... 0.11u 0.02s 0:00.13 100.0% ---------------------------------------------------------------------------- --- time...
    2. preloading in segments
      How can I preload a flashwebsite in segments? I'm building a website with 9 'rooms'. The background and the main navigation are the same in all the...
    3. How many rollback segments can a transaction use?
      Oracle8(TM) Server Concepts " When a transaction runs out of space in the current extent and needs to continue writing, Oracle finds an available...
    4. newbie DBA - rollback segments
      I'm new to the oracle dba roll, so please be gentle. I load several large tables every night. My database is only about 20gB and is 24x7. I...
    5. mapping segments to sessions
      I am trying to trace segment growth in the temp tablespace back to a specific session. The tablespace will grow rapidly (40Gb) without warning. I...
  3. #2

    Default Re: IPC : destroy IPC::ShareLite-segments



    peter pilsl wrote:
    > I use IPC::ShareLite-segments but havnt figured out an elegant way to
    > destroy the created segments. The recommended way (manpage) always fails
    > with "invalid argument", which reminds to a false shmctl-call.
    >
    > So I do a syscall on ipcs to get the id of the segment and call shmctl on
    > my own, which doesnt feel good to me.
    >
    > ----------share_del.pl---------
    > #!/usr/bin/perl -w
    >
    > use strict;
    > use IPC::ShareLite;
    > use IPC::SysV qw(IPC_RMID);
    >
    > # CREATE A SEGMENT WITH KEY=1234 alias 0x42d
    > my $cache = new IPC::ShareLite (-key=>1234,
    > -create=>'yes',
    > -size=>50000,
    > -destroy=>'no') or warn "$!\n";
    >
    > undef $cache;
    >
    >
    > print `ipcs -m | grep 4d2`;
    >
    > # try to remove via ShareLite ..
    > print "try with ShareLite\n";
    > my $cache_d = new IPC::ShareLite (-key=>1234,
    > -destroy=>'yes') or warn "could not destroy segment : $!\n";
    >
    > undef $cache_d;
    > print `ipcs -m | grep 4d2`;
    >
    > # try to remove via direct call
    > print "try with shmctl\n";
    > $a=`ipcs -m | grep 4d2`;
    > $b=$1 if $a=~/^.*?\s(.*?)\s/;
    > shmctl($b,IPC_RMID,0) or warn "could not destroy segment : $!\n";
    What happens if "$a=~/^.*?\s(.*?)\s/" fails?
    > print `ipcs -m | grep 4d2`;
    > --------------------------
    >
    > $ ~/bin/devel/share_del.pl
    > 0x000004d2 26869763 pilsl 666 50000 0
    > try with ShareLite
    > could not destroy segment : Invalid argument
    > 0x000004d2 26869763 pilsl 666 50000 0
    > try with shmctl
    >
    >
    > any help ?
    > thnx,
    > peter
    >

    --
    Ron Reidy
    Oracle DBA

    Ron Reidy Guest

  4. #3

    Default Re: IPC : destroy IPC::ShareLite-segments

    Ron Reidy wrote:

    >> shmctl($b,IPC_RMID,0) or warn "could not destroy segment : $!\n";
    >
    > What happens if "$a=~/^.*?\s(.*?)\s/" fails?
    >
    I dont think about this. The code is only for demonstration of my problem
    and not productional code.

    The problem and the warning occures at a different position.

    thnx,
    peter


    --
    peter pilsl
    [email]pilsl_usenet@goldfisch.at[/email]
    [url]http://www.goldfisch.at[/url]

    peter pilsl Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139