This is just in case someone is reading this post through interest!!
I have sorted where the problem is. If you are interested, please read
on...

The program I wrote was the following...

---------  snip  -------------
my %myhash;
tie %myhash, 'IPC::Shareable', "hashkey", {create => 1, exclusive => 0,
mode => 0666, destroy => 1, size => 262144 };

while($dstIP = $sth1->fetchrow())
{                                    
   $myhash{$dstIP}{"dispatched"} = time();
   $myhash{$dstIP}{"response"}   = 0;    
   $myhash{$dstIP}{"num_polls"}  = 1;
   $myhash{$dstIP}{"action"}     = 0;
}               
--------- end snip -----------

>From the perldoc (I know - I should have RTFM!!) it says this....

-----------------------------------------------------
When a reference to a non-tied scalar, hash, or array is assigned to a
tie()d variable, IPC::Shareable will attempt to tie() the thingy being
referenced. This allows disparate processes to see changes to not only
the top-level variable, but also changes to nested data.  This feature
is intended to be transparent to the application, but there are some
caveats to be aware of.

First of all, IPC::Shareable does not (yet) guarantee that the ids
shared memory segments allocated automagically are unique.  The more
automagical tie()ing that happens, the greater the chance of a
collision.

Secondly, since a new shared memory segment is created for each thingy
being referenced, the liberal use of references could cause the system
to approach its limit for the total number of shared memory segments
allowed.
-------------------------------------------------

Of course, I had tied %myhash. The nested hash $myhash{$dstIP} is not
tied to shared memory. Therefore the value $myhash{$dstIP} will have a
new segment/semaphore created for each one I create. Well, once I
reached the maximum number of semaphores set for my Solaris box...

sysdef -i gave me '10  semaphore identifiers (SEMMNI)'

my perl script core dumped!!

Anyway, I did RTFM, just not closely enough!! I haven't fixed the
problem however, although someone mentioned Storable which I haven't
looked into yet!!

Andy

On Fri, 2003-08-15 at 14:30, Andy Ford wrote:
> I am getting somewhere now!!
> 
> If I call 'tie' after I have created the hash, all is fine. 
> Surely I should be able to create the shares memory and then add/remove
> entries in the hash at will!?
> 
> Andy
> 
> 
> On Fri, 2003-08-15 at 14:12, Andy Ford wrote:
> > This is the output of ipcs -A...
> > 
> > IPC status from <running system> as of Fri Aug 15 13:10:04 UTC 2003
> > T         ID      KEY        MODE        OWNER    GROUP  CREATOR  
> > CGROUP CBYTES  QNUM QBYTES LSPID LRPID   STIME    RTIME    CTIME 
> > Message Queues:
> > T         ID      KEY        MODE        OWNER    GROUP  CREATOR  
> > CGROUP NATTCH      SEGSZ  CPID  LPID   ATIME    DTIME    CTIME  ISMATTCH
> > Shared Memory:
> > m        610   0xbc054    --rw-rw-rw-     root    other     root   
> > other      0      65536  7680     0 no-entry no-entry 13:10:01        0
> > T         ID      KEY        MODE        OWNER    GROUP  CREATOR  
> > CGROUP NSEMS   OTIME    CTIME 
> > Semaphores:
> > 
> > before running the script, ipcs -A was clear so the shared memory was
> > created with ID 610
> > 
> > Andy
> > 
> > On Fri, 2003-08-15 at 13:44, Andy Ford wrote:
> > > Hello
> > > 
> > > I have had a good look round at what may be causing the error..
> > > Could not create semaphore set: No space left on device
> > > 
> > > What I am basically doing is the following...
> > > 
> > > tie %myhash, 'IPC::Shareable', "hashkey", {create => 1, exclusive => 0,
> > > mode => 0666, destroy => 1, size => 262144 };
> > > 
> > > while($dstIP = $sth1->fetchrow())
> > > {                                    
> > >    print "$dstIP\n";   
> > >    $myhash{$dstIP}{"dispatched"} = time();
> > >    $myhash{$dstIP}{"response"}   = 0;    
> > >    $myhash{$dstIP}{"num_polls"}  = 1;
> > >    $myhash{$dstIP}{"action"}     = 0;
> > >                                        
> > > }               
> > > 
> > > When I start up the process, I manage to print out 10 $dstIP addresses
> > > and then I get the error. This is rather a small amount of data to fit
> > > into 262144 bytes. Even if I increase this size, I get the same error at
> > > the same point. Without setting SHM fetchrow returns 20 $dstIP addresses
> > > and they print fine.
> > > 
> > > Any ideas
> > > 
> > > Andy
> > > 
> > 
> 


Reply via email to