Error report

I was wondering if anyone could shed some light on the following
stack. It's from a users apple error report that gets generated when
the an application closes unexpectedly.

I've so far been unable to recreate the problem and I can't make such
sense of what might be happening from just this error report. The app
logs stderr and anything through sys.excepthook and nothing was
logged, but I suppose it could have crashed before it had the chance

About the extent of what I can make out is that Thread 0 crashed (the
main thread) and at the top of the stack is some threading waits? I
don't know if that means I should start looking at my thread safety.
I'm really not too sure!

However I can't think of anywhere that acquires a threading.Lock from
the main thread, but it's possible that that's happening somewhere (I
guess I should never need to do this, right?)

Any clues at all could prove to be very useful!

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x9a2c583e __psynch_cvwait + 10
1 libsystem_c.dylib 0x98191e78 _pthread_cond_wait + 914
2 libsystem_c.dylib 0x9813982a pthread_cond_wait + 48
3 org.python.python 0x02103aac PyThread_acquire_lock + 172
4 org.python.python 0x020bff53 PyEval_RestoreThread + 67
5 org.python.python 0x020eb771 PyGILState_Ensure + 65
6 _controls_.so 0x063219f1
wxPyControl::DoGetBestSize() const + 51
7 _core_.so 0x04b043d7 wxIntersectRect(wxRect*,
wxRect*) + 185661
8 org.python.python 0x020c6341 PyEval_EvalFrameEx + 20769
9 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
10 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
11 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
12 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
13 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
14 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
15 org.python.python 0x0203d632 PyFunction_SetClosure + 1890
16 org.python.python 0x0200a9c5 PyObject_Call + 85
17 org.python.python 0x0201d376 PyMethod_New + 2358
18 org.python.python 0x0200a9c5 PyObject_Call + 85
19 org.python.python 0x020c028e PyEval_CallObjectWithKeywords + 78
20 _core_.so 0x04ac8b2e
wxPyCallback::EventThunker(wxEvent&) + 234
21 libwx_macud-2.8.0.8.0.dylib 0x058aa97a
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) + 108
22 libwx_macud-2.8.0.8.0.dylib 0x058aaa20
wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 80
23 libwx_macud-2.8.0.8.0.dylib 0x058ab81f
wxEvtHandler::ProcessEvent(wxEvent&) + 225
24 libwx_macud-2.8.0.8.0.dylib 0x058ab564
wxEvtHandler::ProcessPendingEvents() + 86
25 libwx_macud-2.8.0.8.0.dylib 0x05804cea
wxAppConsole::ProcessPendingEvents() + 102
26 libwx_macud-2.8.0.8.0.dylib 0x058a2ebf
wxMacProcessNotifierAndPendingEvents + 33
27 libwx_macud-2.8.0.8.0.dylib 0x058cddd2
wxApp::MacHandleOneEvent(void*) + 90
28 libwx_macud-2.8.0.8.0.dylib 0x058cde62 wxApp::MacDoOneEvent() + 120
29 libwx_macud-2.8.0.8.0.dylib 0x058e83de wxEventLoop::Dispatch() + 32
30 libwx_macud-2.8.0.8.0.dylib 0x059a467d wxEventLoopManual::Run() + 97
31 libwx_macud-2.8.0.8.0.dylib 0x0597a7fe wxAppBase::MainLoop() + 76
32 _core_.so 0x04abf8dc wxPyApp::MainLoop() + 52
33 _core_.so 0x04b0d03a wxIntersectRect(wxRect*,
wxRect*) + 221600
34 org.python.python 0x020c6341 PyEval_EvalFrameEx + 20769
35 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
36 org.python.python 0x0203d632 PyFunction_SetClosure + 1890
37 org.python.python 0x0200a9c5 PyObject_Call + 85
38 org.python.python 0x0201d376 PyMethod_New + 2358
39 org.python.python 0x0200a9c5 PyObject_Call + 85
40 org.python.python 0x020c49f6 PyEval_EvalFrameEx + 14294
41 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
42 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
43 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
44 org.python.python 0x020c6dbb PyEval_EvalFrameEx + 23451
45 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
46 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
47 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
48 org.python.python 0x020c8597 PyEval_EvalCode + 87
49 org.python.python 0x020ecac8 PyRun_FileExFlags + 168
50 org.python.python 0x020eda03 PyRun_SimpleFileExFlags + 867
51 org.python.python 0x020edb88 PyRun_SimpleFile + 40
52 org.pythonmac.unspecified.Application 0x000067f1 start + 17777
53 org.pythonmac.unspecified.Application 0x00006f89 main + 1481
54 org.pythonmac.unspecified.Application 0x00002382 start + 258
55 org.pythonmac.unspecified.Application 0x000022a9 start + 41

Thanks!

Paul

I was wondering if anyone could shed some light on the following
stack. It's from a users apple error report that gets generated when
the an application closes unexpectedly.

I've so far been unable to recreate the problem and I can't make such
sense of what might be happening from just this error report. The app
logs stderr and anything through sys.excepthook and nothing was
logged, but I suppose it could have crashed before it had the chance

About the extent of what I can make out is that Thread 0 crashed (the
main thread) and at the top of the stack is some threading waits? I
don't know if that means I should start looking at my thread safety.
I'm really not too sure!

However I can't think of anywhere that acquires a threading.Lock from
the main thread, but it's possible that that's happening somewhere (I
guess I should never need to do this, right?)

It's not showing calls to the threading.Lock Python function, but rather calls to Python's C API functions for acquiring the global interpreter lock. The interesting stuff is further up the stack.

At level 25 there is a call to ProcessPendingEvents and then at 20 there is an event being dispatched to some Python event handler. My guess is that this is probably a wx.CallAfter event being processed, although it could be some other event that was posted rather than being processed immediately.

Then there is some Python code frames executing. (The event handler calls some other python function, that calls another, etc.) And then there is a call to wx.InstersectRect at level 7. This is where things appear to be a little squirrely as the stack shows that there is a call from there to some window's DoGetBestSize from wx.IntersectRect, but there is nothing like that in the code. (I've pasted it in below.)

Best guesses at this point are that something is corrupting the program's memory or at least the crash report generated for the program, or that something happened with the wxPython build.

Anyway, you can probably narrow things down by looking at things called by wx.CallAfter or other pending event handlers.

Any clues at all could prove to be very useful!

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x9a2c583e __psynch_cvwait + 10
1 libsystem_c.dylib 0x98191e78 _pthread_cond_wait + 914
2 libsystem_c.dylib 0x9813982a pthread_cond_wait + 48
3 org.python.python 0x02103aac PyThread_acquire_lock + 172
4 org.python.python 0x020bff53 PyEval_RestoreThread + 67
5 org.python.python 0x020eb771 PyGILState_Ensure + 65
6 _controls_.so 0x063219f1
wxPyControl::DoGetBestSize() const + 51
7 _core_.so 0x04b043d7 wxIntersectRect(wxRect*,
wxRect*) + 185661
8 org.python.python 0x020c6341 PyEval_EvalFrameEx + 20769
9 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
10 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
11 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
12 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
13 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
14 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
15 org.python.python 0x0203d632 PyFunction_SetClosure + 1890
16 org.python.python 0x0200a9c5 PyObject_Call + 85
17 org.python.python 0x0201d376 PyMethod_New + 2358
18 org.python.python 0x0200a9c5 PyObject_Call + 85
19 org.python.python 0x020c028e PyEval_CallObjectWithKeywords + 78
20 _core_.so 0x04ac8b2e
wxPyCallback::EventThunker(wxEvent&) + 234
21 libwx_macud-2.8.0.8.0.dylib 0x058aa97a
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) + 108
22 libwx_macud-2.8.0.8.0.dylib 0x058aaa20
wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 80
23 libwx_macud-2.8.0.8.0.dylib 0x058ab81f
wxEvtHandler::ProcessEvent(wxEvent&) + 225
24 libwx_macud-2.8.0.8.0.dylib 0x058ab564
wxEvtHandler::ProcessPendingEvents() + 86
25 libwx_macud-2.8.0.8.0.dylib 0x05804cea
wxAppConsole::ProcessPendingEvents() + 102
26 libwx_macud-2.8.0.8.0.dylib 0x058a2ebf
wxMacProcessNotifierAndPendingEvents + 33
27 libwx_macud-2.8.0.8.0.dylib 0x058cddd2
wxApp::MacHandleOneEvent(void*) + 90
28 libwx_macud-2.8.0.8.0.dylib 0x058cde62 wxApp::MacDoOneEvent() + 120
29 libwx_macud-2.8.0.8.0.dylib 0x058e83de wxEventLoop::Dispatch() + 32
30 libwx_macud-2.8.0.8.0.dylib 0x059a467d wxEventLoopManual::Run() + 97
31 libwx_macud-2.8.0.8.0.dylib 0x0597a7fe wxAppBase::MainLoop() + 76
32 _core_.so 0x04abf8dc wxPyApp::MainLoop() + 52
33 _core_.so 0x04b0d03a wxIntersectRect(wxRect*,
wxRect*) + 221600
34 org.python.python 0x020c6341 PyEval_EvalFrameEx + 20769
35 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
36 org.python.python 0x0203d632 PyFunction_SetClosure + 1890
37 org.python.python 0x0200a9c5 PyObject_Call + 85
38 org.python.python 0x0201d376 PyMethod_New + 2358
39 org.python.python 0x0200a9c5 PyObject_Call + 85
40 org.python.python 0x020c49f6 PyEval_EvalFrameEx + 14294
41 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
42 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
43 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
44 org.python.python 0x020c6dbb PyEval_EvalFrameEx + 23451
45 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
46 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
47 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
48 org.python.python 0x020c8597 PyEval_EvalCode + 87
49 org.python.python 0x020ecac8 PyRun_FileExFlags + 168
50 org.python.python 0x020eda03 PyRun_SimpleFileExFlags + 867
51 org.python.python 0x020edb88 PyRun_SimpleFile + 40
52 org.pythonmac.unspecified.Application 0x000067f1 start + 17777
53 org.pythonmac.unspecified.Application 0x00006f89 main + 1481
54 org.pythonmac.unspecified.Application 0x00002382 start + 258
55 org.pythonmac.unspecified.Application 0x000022a9 start + 41

Thanks!

Paul

     PyObject* wxIntersectRect(wxRect* r1, wxRect* r2) {
         wxRegion reg1(*r1);
         wxRegion reg2(*r2);
         wxRect dest(0,0,0,0);
         PyObject* obj;

         reg1.Intersect(reg2);
         dest = reg1.GetBox();

         wxPyThreadBlocker blocker;
         if (dest != wxRect(0,0,0,0)) {
             wxRect* newRect = new wxRect(dest);
             obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), true);
             return obj;
         }
         Py_INCREF(Py_None);
         return Py_None;
     }

···

On 12/11/12 9:11 AM, Paul Wiseman wrote:

--
Robin Dunn
Software Craftsman

I was wondering if anyone could shed some light on the following
stack. It's from a users apple error report that gets generated when
the an application closes unexpectedly.

I've so far been unable to recreate the problem and I can't make such
sense of what might be happening from just this error report. The app
logs stderr and anything through sys.excepthook and nothing was
logged, but I suppose it could have crashed before it had the chance

About the extent of what I can make out is that Thread 0 crashed (the
main thread) and at the top of the stack is some threading waits? I
don't know if that means I should start looking at my thread safety.
I'm really not too sure!

However I can't think of anywhere that acquires a threading.Lock from
the main thread, but it's possible that that's happening somewhere (I
guess I should never need to do this, right?)

It's not showing calls to the threading.Lock Python function, but rather
calls to Python's C API functions for acquiring the global interpreter lock.
The interesting stuff is further up the stack.

At level 25 there is a call to ProcessPendingEvents and then at 20 there is
an event being dispatched to some Python event handler. My guess is that
this is probably a wx.CallAfter event being processed, although it could be
some other event that was posted rather than being processed immediately.

Could this be a wx.Timer event? I think I know where this is in the app if so.

The Timer event handler is calling Refresh, will this go straight to
OnPaint, or does it register a new event for the main loop? I guess
either way the stack could be one of these events

Then there is some Python code frames executing. (The event handler calls
some other python function, that calls another, etc.) And then there is a
call to wx.InstersectRect at level 7. This is where things appear to be a
little squirrely as the stack shows that there is a call from there to some
window's DoGetBestSize from wx.IntersectRect, but there is nothing like that
in the code. (I've pasted it in below.)

Is there any way to tell what / where wx.IntersectRect is being called
from? I don't call it myself anywhere, so I guess the call must be
called from within the wxPython source.

Trouble is I can follow the stack up to these python function calls,
but 4 function calls later is quite a lot of possible routes from the
timer's event handle. so I'm not sure exactly where it was when it
crashed.

Best guesses at this point are that something is corrupting the program's
memory or at least the crash report generated for the program, or that
something happened with the wxPython build.

Anyway, you can probably narrow things down by looking at things called by
wx.CallAfter or other pending event handlers.

Thanks Robin for checking this out! I should have mentioned I'm
running 2.8.12.1 - I don't know if IntersectRect might have been
different in an old version- is there a way I can check?

···

On 12 December 2012 23:22, Robin Dunn <robin@alldunn.com> wrote:

On 12/11/12 9:11 AM, Paul Wiseman wrote:

Any clues at all could prove to be very useful!

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x9a2c583e __psynch_cvwait + 10
1 libsystem_c.dylib 0x98191e78 _pthread_cond_wait + 914
2 libsystem_c.dylib 0x9813982a pthread_cond_wait + 48
3 org.python.python 0x02103aac PyThread_acquire_lock + 172
4 org.python.python 0x020bff53 PyEval_RestoreThread + 67
5 org.python.python 0x020eb771 PyGILState_Ensure + 65
6 _controls_.so 0x063219f1
wxPyControl::DoGetBestSize() const + 51
7 _core_.so 0x04b043d7 wxIntersectRect(wxRect*,
wxRect*) + 185661
8 org.python.python 0x020c6341 PyEval_EvalFrameEx + 20769
9 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
10 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
11 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
12 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
13 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
14 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
15 org.python.python 0x0203d632 PyFunction_SetClosure + 1890
16 org.python.python 0x0200a9c5 PyObject_Call + 85
17 org.python.python 0x0201d376 PyMethod_New + 2358
18 org.python.python 0x0200a9c5 PyObject_Call + 85
19 org.python.python 0x020c028e PyEval_CallObjectWithKeywords
+ 78
20 _core_.so 0x04ac8b2e
wxPyCallback::EventThunker(wxEvent&) + 234
21 libwx_macud-2.8.0.8.0.dylib 0x058aa97a
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) + 108
22 libwx_macud-2.8.0.8.0.dylib 0x058aaa20
wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 80
23 libwx_macud-2.8.0.8.0.dylib 0x058ab81f
wxEvtHandler::ProcessEvent(wxEvent&) + 225
24 libwx_macud-2.8.0.8.0.dylib 0x058ab564
wxEvtHandler::ProcessPendingEvents() + 86
25 libwx_macud-2.8.0.8.0.dylib 0x05804cea
wxAppConsole::ProcessPendingEvents() + 102
26 libwx_macud-2.8.0.8.0.dylib 0x058a2ebf
wxMacProcessNotifierAndPendingEvents + 33
27 libwx_macud-2.8.0.8.0.dylib 0x058cddd2
wxApp::MacHandleOneEvent(void*) + 90
28 libwx_macud-2.8.0.8.0.dylib 0x058cde62 wxApp::MacDoOneEvent() + 120
29 libwx_macud-2.8.0.8.0.dylib 0x058e83de wxEventLoop::Dispatch() + 32
30 libwx_macud-2.8.0.8.0.dylib 0x059a467d wxEventLoopManual::Run() + 97
31 libwx_macud-2.8.0.8.0.dylib 0x0597a7fe wxAppBase::MainLoop() + 76
32 _core_.so 0x04abf8dc wxPyApp::MainLoop() + 52
33 _core_.so 0x04b0d03a wxIntersectRect(wxRect*,
wxRect*) + 221600
34 org.python.python 0x020c6341 PyEval_EvalFrameEx + 20769
35 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
36 org.python.python 0x0203d632 PyFunction_SetClosure + 1890
37 org.python.python 0x0200a9c5 PyObject_Call + 85
38 org.python.python 0x0201d376 PyMethod_New + 2358
39 org.python.python 0x0200a9c5 PyObject_Call + 85
40 org.python.python 0x020c49f6 PyEval_EvalFrameEx + 14294
41 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
42 org.python.python 0x020c7433 PyEval_EvalFrameEx + 25107
43 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
44 org.python.python 0x020c6dbb PyEval_EvalFrameEx + 23451
45 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
46 org.python.python 0x020c6633 PyEval_EvalFrameEx + 21523
47 org.python.python 0x020c840a PyEval_EvalCodeEx + 2042
48 org.python.python 0x020c8597 PyEval_EvalCode + 87
49 org.python.python 0x020ecac8 PyRun_FileExFlags + 168
50 org.python.python 0x020eda03 PyRun_SimpleFileExFlags + 867
51 org.python.python 0x020edb88 PyRun_SimpleFile + 40
52 org.pythonmac.unspecified.Application 0x000067f1 start + 17777
53 org.pythonmac.unspecified.Application 0x00006f89 main + 1481
54 org.pythonmac.unspecified.Application 0x00002382 start + 258
55 org.pythonmac.unspecified.Application 0x000022a9 start + 41

Thanks!

Paul

    PyObject* wxIntersectRect(wxRect* r1, wxRect* r2) {
        wxRegion reg1(*r1);
        wxRegion reg2(*r2);
        wxRect dest(0,0,0,0);
        PyObject* obj;

        reg1.Intersect(reg2);
        dest = reg1.GetBox();

        wxPyThreadBlocker blocker;
        if (dest != wxRect(0,0,0,0)) {
            wxRect* newRect = new wxRect(dest);
            obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), true);
            return obj;
        }
        Py_INCREF(Py_None);
        return Py_None;
    }

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I was wondering if anyone could shed some light on the following
stack. It's from a users apple error report that gets generated when
the an application closes unexpectedly.

I've so far been unable to recreate the problem and I can't make such
sense of what might be happening from just this error report. The app
logs stderr and anything through sys.excepthook and nothing was
logged, but I suppose it could have crashed before it had the chance

About the extent of what I can make out is that Thread 0 crashed (the
main thread) and at the top of the stack is some threading waits? I
don't know if that means I should start looking at my thread safety.
I'm really not too sure!

However I can't think of anywhere that acquires a threading.Lock from
the main thread, but it's possible that that's happening somewhere (I
guess I should never need to do this, right?)

It's not showing calls to the threading.Lock Python function, but rather
calls to Python's C API functions for acquiring the global interpreter lock.
The interesting stuff is further up the stack.

At level 25 there is a call to ProcessPendingEvents and then at 20 there is
an event being dispatched to some Python event handler. My guess is that
this is probably a wx.CallAfter event being processed, although it could be
some other event that was posted rather than being processed immediately.

Could this be a wx.Timer event? I think I know where this is in the app if so.

I think that Timer events happen normally, meaning without needing to go through ProcessPendingEvents.

The Timer event handler is calling Refresh, will this go straight to
OnPaint, or does it register a new event for the main loop? I guess
either way the stack could be one of these events

Refresh tells the system that the window (or a portion of it) needs to be repainted, and then the system will deliver a paint event sometime in the near future.

Then there is some Python code frames executing. (The event handler calls
some other python function, that calls another, etc.) And then there is a
call to wx.InstersectRect at level 7. This is where things appear to be a
little squirrely as the stack shows that there is a call from there to some
window's DoGetBestSize from wx.IntersectRect, but there is nothing like that
in the code. (I've pasted it in below.)

Is there any way to tell what / where wx.IntersectRect is being called
from? I don't call it myself anywhere, so I guess the call must be
called from within the wxPython source.

You can hack at the Python wrapper for IntersectRect in wx/_core.py and add code there to print the current stack using the traceback module, or just set a breakpoint there if you are using a debugger.

Trouble is I can follow the stack up to these python function calls,
but 4 function calls later is quite a lot of possible routes from the
timer's event handle. so I'm not sure exactly where it was when it
crashed.

Best guesses at this point are that something is corrupting the program's
memory or at least the crash report generated for the program, or that
something happened with the wxPython build.

Anyway, you can probably narrow things down by looking at things called by
wx.CallAfter or other pending event handlers.

Thanks Robin for checking this out! I should have mentioned I'm
running 2.8.12.1 - I don't know if IntersectRect might have been
different in an old version- is there a way I can check?

It hasn't changed.

···

On 12/13/12 5:18 AM, Paul Wiseman wrote:

On 12 December 2012 23:22, Robin Dunn <robin@alldunn.com> wrote:

On 12/11/12 9:11 AM, Paul Wiseman wrote:

--
Robin Dunn
Software Craftsman