Re: Segfaults and corresponding questions!

From: Jose Da Silva <Digital_at_joescat.com>
Date: Wed Aug 08 2007 - 22:50:59 CEST

On August 7, 2007 09:01:01 am Ryan Pavlik wrote:
> Passing request on to the larger population :)

Usually programmers run the biggest/latest hardware and don't run into alloc
problems therefore segfault problems aren't likely going to show up.

Users, on the other hand, sometimes have limited/aging hardware and sometimes
even misconfigured machines lacking a /swap or a swap-type-file and then they
may get alloc problems untested by the programmers.

A place to begin is by going to the root directory and verifying all the
allocated memory is answered.
This usually discovers a few problems:
grep -r "alloc" *

...can sometimes find several unanswered allocs (see 3 attached diff files).

Note: attached fixes were not tested/validated. Please update if looks okay.
Note: don't forget to free initially unused memory if your routine allocs
memory but fails to finish the routine - likewise, close opened files too.
Note: there were many more alloc in other files that should be answered.

alloc includes malloc, calloc, realloc

Jose.

> -------- Original Message --------
> Hey there! In theory the TCP backend should be excitingly close,
> however, whenever I clicked "OK" to add the account, I'm getting a
> segfault. I've tried passing different datatypes, making the data a
> member of the object instead of a local variable, and so on, and I
> haven't had any success. Here's the backtrace - is there a clue I'm
> missing? (In a non-debug build, not in GDB, it just closes the dialog
> without adding any account.)
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=OUTPUT_DEBUG_STRING_EVENT)
> warning: TCPWin32AccountHandler::embedDialogWidgets()
>
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=OUTPUT_DEBUG_STRING_EVENT)
> warning: Add Account - OK button clicked
>
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=OUTPUT_DEBUG_STRING_EVENT)
> warning: TCPWin32AccountHandler::storeProperties()
>
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=EXCEPTION_DEBUG_EVENT)
> gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x6337dfce
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x6337dfce in AccountHandler::addProperty (this=0x33825c8, key=@0x22f048,
> value=@0x22f028)
> at
> c:/src/abi25/abiword-plugins/tools/abicollab/backends/tcp/win/../../../ba
> ckends/xp/AccountHandler.h:68
> 68 {
> m_properties.insert(PropertyMap::value_type(key, value
> )); }
> (gdb) bt
> #0 0x6337dfce in AccountHandler::addProperty (this=0x33825c8,
> key=@0x22f048,
> value=@0x22f028)
> at
> c:/src/abi25/abiword-plugins/tools/abicollab/backends/tcp/win/../../../ba
> ckends/xp/AccountHandler.h:68
> #1 0x63364b64 in TCPWin32AccountHandler::storeProperties (this=0x33825c8)
> at TCPWin32AccountHandler.cpp:160
> #2 0x6335f620 in AP_Win32Dialog_CollaborationAddAccount::_onCommand (
> this=0x33824b8, hWnd=0x8048c, wParam=1, lParam=1180752)
> at ap_Win32Dialog_CollaborationAddAccount.cpp:189
> #3 0x6335ed86 in AP_Win32Dialog_CollaborationAddAccount::s_dlgProc (
> hWnd=0x8048c, msg=273, wParam=1, lParam=1180752)
> at ap_Win32Dialog_CollaborationAddAccount.cpp:48
> #4 0x77e3a454 in USER32!SetWindowPlacement ()
> from C:\WINNT\system32\USER32.DLL
>
>
>
> (BTW - every time I start Abi in GDB with a debug build, I get several
> segfaults - I can just "continue" through them but I'd be curious to
> find out what is the deal and if they in fact affect production builds.
> I had these before, and removing AbiGrammar just shifted it to the next
> plugin, IIRC. I did file a bug, I think. Looks like "lab()" keep
> showing up
>
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=EXCEPTION_DEBUG_EVENT)
> gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x033976a0
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x033976a0 in malloc () at c:/src/abi25/abi/src/af/util/xp/ut_vector.h:221
> 221 UT_sint32 UT_GenericVector<T>::grow(UT_uint32 ndx)
> Current language: auto; currently c++
> (gdb) bt
> #0 0x033976a0 in malloc () at
> c:/src/abi25/abi/src/af/util/xp/ut_vector.h:221
> #1 0x033910cc in lab ()
> from
> C:\src\abi25\abi\src\MINGW32_1.0.10_i386_DBG_OBJ\Plugins\AbiGrammar.dll
>
> (continue...)
>
> gdb: kernel event for pid=260 tid=1496 code=EXCEPTION_DEBUG_EVENT)
> gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x033abfd0
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x033abfd0 in malloc () at c:/src/abi25/abi/src/af/util/xp/ut_vector.h:412
> 412 UT_uint32 UT_GenericVector<T>::binarysearch(const void* key,
> compar_fn_t
> compar)
> (gdb) bt
> #0 0x033abfd0 in malloc () at
> c:/src/abi25/abi/src/af/util/xp/ut_vector.h:412
> #1 0x033910cc in lab ()
> from
> C:\src\abi25\abi\src\MINGW32_1.0.10_i386_DBG_OBJ\Plugins\AbiMathView.dll
>
> (continue...)
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=EXCEPTION_DEBUG_EVENT)
> gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x0339b220
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0339b220 in malloc () at c:/src/abi25/abi/src/af/xap/xp/xap_App.h:214
> 214 virtual UT_sint32
> makeDirectory(co
> nst char * szPath, const UT_sint32 mode ) const = 0;
> (gdb) bt
> #0 0x0339b220 in malloc () at c:/src/abi25/abi/src/af/xap/xp/xap_App.h:214
> #1 0x033910cc in lab ()
>
> (continue...)
>
> ContinueDebugEvent (cpid=260, ctid=1496, DBG_CONTINUE);
> gdb: kernel event for pid=260 tid=1496 code=EXCEPTION_DEBUG_EVENT)
> gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x03395610
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x03395610 in malloc () at c:/src/abi25/abi/src/af/xap/xp/xap_App.h:237
> 237
> (gdb) bt
> #0 0x03395610 in malloc () at c:/src/abi25/abi/src/af/xap/xp/xap_App.h:237
> #1 0x033910cc in lab ()
>
>
> Weird, huh?)
>
>
> Thanks for your help!
>
> --
> Ryan Pavlik
> AbiWord Win32 Platform Maintainer, Art Lead: www.abisource.com
> AbiWord Community Outreach Project: www.cleardefinition.com/oss/abi/blog/
>
> "Optimism is the father that leads to achievement."
> -- Helen Keller
>
> "The folder structure in a modern Linux distribution such as Ubuntu
> was largely inspired by the original UNIX foundations that were
> created by men with large beards and sensible jumpers."
> -- Jono Bacon, The Ubuntu Guide

Received on Wed Aug 8 22:48:47 2007

This archive was generated by hypermail 2.1.8 : Wed Aug 08 2007 - 22:48:47 CEST