[OpenSIPS-Users] segmentation fault when calling pkg_malloc

Vasil Kolev vasil.kolev at attractel.com
Sun Mar 15 10:20:06 CET 2009


В 05:43 +0200 на 15.03.2009 (нд), Dan Pascu написа:
> On Thursday 12 March 2009, Vasil Kolev wrote:
> > This doesn't seem like running out of memory, more like a memory
> > corruption. The first thing to check is if either 'frag' or 'f' are
> > NULL or invalid (e.g. in gdb do "print f", "print frag" and see what
> > does that say). After that try dereferencing them, seeing how could
> > they get these values, etc.
> 
> I've seen this thing before. I'm willing to bet that the pointers are not 
> NULL. They are most likely composed of ascii byte codes from some SIP 
> message header (as a result of the allocator memory being overwritten by 
> part of the processed message).
> 
> Unfortunately I have no idea what causes this, and the only solution to a 
> similar problem I was experiencing was to replace the opensips private 
> memory allocator with the system memory allocator when building opensips.
> 
> Maybe the thread author can try using the system memory allocator to see 
> if the problem goes away. If so, we definitely have a problem with the 
> memory allocator. If not, he may have a different issue somewhere else in 
> his code.
> 

"Oh shit" seems like the appropriate response :)
(I'm not the thread author, but this would seem to affect me too)

Anyway, there seem to be three different memory allocators in opensips -
vqm_malloc, fm_malloc and qm_malloc (this is from looking in mem/mem.h),
is it possible that one has an issue and the rest not? Now the issue
might be that the system memory allocator is more resilient to some
strange type of corruption (for example, single byte overflow of
strings) and doesn't have this weird issue...

I'll probably have to look up a way to track opensips with valgrind (as
when using its allocator, it won't find the overflows) because I've also
seen such issues some time before (ultimately they turned out to be the
fault of the db_postgres module). 

-- 
Regards,
Vasil Kolev
Attractel NV
dCAP #1324, LPIC2




More information about the Users mailing list