[mnet-devel] valgrind to the rescue on search panel seg fault

Zooko zooko at zooko.com
Tue Feb 18 12:26:54 GMT 2003


I started three searches, closed the middle one, closed the first one, 
closed the last one.

I then found the following in my mojolog (should be renamed "mnetlog").  
Things to note: the invalid address is 4 bytes before a vector of 
16 pointers.  Very likely we've indexed "-1" into the vector.  This 
theory is substantiated by the assertion failed "uiIndex < m_nCount".  
Since the index is an unsigned, "-1" evaluates to 2^32-1 in the 
assertion check, which is why it isn't < m_nCount.  I looked at our 
Python code and saw:

    def CloseTab(self, window_to_delete):
        ii = self.resultsPanels.index(window_to_delete)
        self.resultsPanels.remove(window_to_delete)
        if self.resultsNotebook.GetPageCount() != 1:
            self.resultsNotebook.DeletePage(ii)
            self.resultsNotebook.SetSelection(ii-1)
            self.resultsNotebook.Refresh()
        else:
            self.resultsNotebook.DeleteAllPages()
            self.ShowHtmlPage()

The line that is reported in the Python traceback after catching the C++ 
exception is "SetSelection(ii-1)".  Could "ii" be zero there?

--Z

[Debug] 07:18:27: C++ assertion "uiIndex < m_nCount" failed in ../include/wx/dynarray.h(468)
==4430== 
==4430== Thread 5:
==4430== Invalid read of size 4
==4430==    at 0x450D1EFE: wxNotebookBase::GetPage(int) (../include/wx/notebook.h:73)
==4430==    by 0x44FF3148: wxNotebook::SetSelection(int) (../src/gtk/notebook.cpp:381)
==4430==    by 0x44162304: _wrap_wxNotebook_SetSelection (src/gtk/windows2.cpp:727)
==4430==    by 0x80D328D: PyCFunction_Call (Objects/methodobject.c:77)
==4430==    by 0x8059C78: PyObject_Call (Objects/abstract.c:1754)
==4430==    by 0x809D484: PyEval_CallObjectWithKeywords (Python/ceval.c:3194)
==4430==    by 0x8093867: builtin_apply (Python/bltinmodule.c:101)
==4430==    by 0x80D3223: PyCFunction_Call (Objects/methodobject.c:118)
==4430==    by 0x809D7BF: call_function (Python/ceval.c:3287)
==4430==    by 0x809B949: eval_frame (Python/ceval.c:2092)
==4430==    by 0x809C37D: PyEval_EvalCodeEx (Python/ceval.c:2599)
==4430==    by 0x809D867: fast_function (Python/ceval.c:3377)
==4430==    by 0x809D6D5: call_function (Python/ceval.c:3299)
==4430==    by 0x809B949: eval_frame (Python/ceval.c:2092)
==4430==    by 0x809D8EE: fast_function (Python/ceval.c:3366)
==4430==    by 0x809D6D5: call_function (Python/ceval.c:3299)
==4430==    Address 0x45E6C8D0 is 4 bytes before a block of size 64 alloc'd
==4430==    at 0x4015CC33: __builtin_vec_new (vg_clientfuncs.c:158)
==4430==    by 0x4015CC6E: operator new[](unsigned) (vg_clientfuncs.c:171)
==4430==    by 0x45057246: wxBaseArrayPtrVoid::Grow(unsigned) (../src/common/dynarray.cpp:316)
==4430==    by 0x450577D5: wxBaseArrayPtrVoid::Insert(void const*, unsigned, unsigned) (../src/common/dynarray.cpp:316)
==4430==    by 0x450D1CD7: wxArrayPages::Insert(wxWindow*, unsigned, unsigned) (../include/wx/notebook.h:38)
==4430==    by 0x44FF3C3C: wxNotebook::InsertPage(int, wxWindow*, wxString const&, bool, int) (../src/gtk/notebook.cpp:602)
==4430==    by 0x450D2037: wxNotebookBase::AddPage(wxWindow*, wxString const&, bool, int) (../include/wx/notebook.h:131)
==4430==    by 0x44163500: _wrap_wxNotebook_AddPage (src/gtk/windows2.cpp:1257)
==4430==    by 0x80D328D: PyCFunction_Call (Objects/methodobject.c:77)
==4430==    by 0x8059C78: PyObject_Call (Objects/abstract.c:1754)
==4430==    by 0x809D484: PyEval_CallObjectWithKeywords (Python/ceval.c:3194)
==4430==    by 0x8093867: builtin_apply (Python/bltinmodule.c:101)
==4430==    by 0x80D3223: PyCFunction_Call (Objects/methodobject.c:118)
==4430==    by 0x809D7BF: call_function (Python/ceval.c:3287)
==4430==    by 0x809B949: eval_frame (Python/ceval.c:2092)
==4430==    by 0x809C37D: PyEval_EvalCodeEx (Python/ceval.c:2599)
NOTE: c_xor found, using accelerated C version of xor
NOTE: c_mencode found, using accelerated C version of mencode
2003-02-18_12:18:27 () Traceback (most recent call last):
2003-02-18_12:18:27 ()   File "/home/zooko/playground/mnet/mnet-HEAD/wxBroker/searchPanel.py", line 367, in OnCloseButton
2003-02-18_12:18:27 ()     self.searchPanel.CloseTab(self)
2003-02-18_12:18:28 ()   File "/home/zooko/playground/mnet/mnet-HEAD/wxBroker/searchPanel.py", line 242, in CloseTab
2003-02-18_12:18:28 ()     self.resultsNotebook.SetSelection(ii-1)
2003-02-18_12:18:28 ()   File "/usr/local/stow/python-CVS/lib/python2.3/site-packages/wxPython/windows2.py", line 55, in SetSelection
2003-02-18_12:18:28 ()     val = apply(windows2c.wxNotebook_SetSelection,(self,) + _args, _kwargs)
2003-02-18_12:18:28 () wxPython.wxc.wxPyAssertionError: C++ assertion "uiIndex < m_nCount" failed in ../include/wx/dynarray.h(468)
==4430== valgrind's libpthread.so: KLUDGED call to: sem_destroy
2003-02-18_12:18:30 (async_http_get) fetching url: http://mnet.sourceforge.net/broker/




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
mnet-devel mailing list
mnet-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mnet-devel




More information about the Mnet-devel mailing list