Haven't done much hard core C programming for a while, however you
didn't mention whether you have made use of core files and gdb. Assuming
you have core files enabled (using ulimit) then following your segv you
should be able to tell you where it was last executing by reading in
with gdb.

As said this type of thing can be tricky to find but stuff like Electric
Fence I believe helps mark heap space with a signature that can allow
you to find culprit.

Also it sounds like a suitable test-rig to "exercise" your program might
help you generate the issue.

Finally you might hunt around for some robust open-source libraries that
you can use rather than rolling your own (assuming you can comply with
the licences they might have)
 

Martin Visser ,CISSP
Network and Security Consultant 
Technology & Infrastructure - Consulting & Integration
HP Services

3 Richardson Place 
North Ryde, Sydney NSW 2113, Australia 
Phone *: +61-2-9022-1670    Mobile *: +61-411-254-513
   Fax 7: +61-2-9022-1800     E-mail * : martin.visserAThp.com



-----Original Message-----
From: Tiwari, Rajnish [mailto:[EMAIL PROTECTED] 
Sent: Friday, 31 October 2003 1:05 PM
To: [EMAIL PROTECTED]
Subject: [SLUG] delete crashes ...


hi All,

        I have a multithreaded c/c++ app containing a simple
(self-developed)
        queue. 3 operations -'insert(..)',  'retrieve()' & 'length()'.
        As part of 'retrieve' a call to 'delete' is made to remove the
        head of the queue. Only 2 threads ever use this queue - strictly
one for
        inserting and another for retrieving ( and yes access is mutex
protected
        on all 3 operations ).

        Although very _infrequent_, the problem is that the call
        to delete in retrieve causes segmentation violation. It is a
real nuisance as
        one may run the app many times without fail but on some
occassions 
        it fails. 

        Has anyone encountered/resolved simliar problems in anyother app
? 
        Could this issue be the result of word alignment ? 
        I suspect a memory corruption - but I cannot seem to figure out 
        when/where/how it could happen.

        One characteristic of the app is that this queue is hammered
quite
        intensively - both inserts and retrieves.

        Any hints much appreciated. Thanks in advance.

Regards,
Rajnish

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to