osx python上的子进程崩溃

时间:2013-07-23 06:32:42

标签: macos python-2.7 wxpython multiprocessing fork

我有一个GUI软件,我想在其中执行一些繁重的任务,因此我创建了新的子进程来运行这些任务。要做到这一点,我使用的是多处理模块,这在windows和unix上运行得非常好。但是,当我尝试相同的OSX 10.6进程崩溃发生时,我得到一个很长的错误报告,我无法破译。

以下是我用来制作子流程的内容: -

p = multiprocessing.Process(target = encode.encode , args = (self.path,self.savePath,) , name = "Encode Process")
p.start()
temp = wx.ProgressDialog('Please wait...', 'Encoding the File....This may take several minutes....\n\t....so sit back and relax....',parent = self,style = wx.PD_APP_MODAL | wx.PD_CAN_ABORT)
temp.SetSize((450,130))
while len(multiprocessing.active_children()) != 0:
      time.sleep(0.1)
      if not temp.UpdatePulse("Encoding the File....This may take several minutes...\n\tso sit back and relax.....")[0]:
                   p.terminate()
                   terminated = True
                   break
temp.Destroy()
p.join()
p.terminate()

以下是崩溃报告: -

Path:/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  Python [52639]

Date/Time:       2013-07-23 12:22:46.170 +0530
OS Version:      Mac OS X 10.6.7 (10J869)
Report Version:  6

Interval Since Last Report:          14328 sec
Crashes Since Last Report:           9
Per-App Crashes Since Last Report:   9
Anonymous UUID:                      DE5488A5-8468-4937-800F-F898E4F09392

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000000d28e02e
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
*** multi-threaded process forked ***

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   ...ple.ApplicationServices.ATS  0x929b43a0 _eGetGlyphVectorIndex + 219
1   ...ple.ApplicationServices.ATS  0x929bec46 OldGlyphsCacheRun(TStrike*, int, unsigned long, unsigned short const*, void (*)(unsigned long, unsigned short const*, unsigned long, unsigned char* const*, void const*), void*) + 354
2   ...ple.ApplicationServices.ATS  0x929c2502 _eGCGetGlyphDeviceMetrics + 475
3   ...ple.ApplicationServices.ATS  0x929c56fd GCGetGlyphDeviceMetrics + 117
4   com.apple.QD                    0x906cc386 GetLayoutDevMetricsGroup(ATSGlyphVector*, unsigned long, unsigned long, Rect*) + 1105
5   com.apple.QD                    0x906ca6c9 MakeLayoutDeviceValues + 616
6   com.apple.QD                    0x906ca434 PositionDeviceGlyphs + 136
7   com.apple.QD                    0x906c87a7 TTextLineLayout::EnsureLayoutIsUpToDate(unsigned long, unsigned char, unsigned long, TATSUGlyphRecordArray**) + 501
8   com.apple.QD                    0x90747ebe TTextLineLayout::OffsetToPosition(unsigned long, unsigned char, unsigned short, ATSUCaret*, ATSUCaret*, unsigned char*) + 168
9   com.apple.QD                    0x90735ca5 ATSUOffsetToCursorPosition + 117
10  com.apple.QD                    0x90735cfc ATSUOffsetToPosition + 61
11  com.apple.HIToolbox             0x957dea93 CUnicodeTextRun::CharacterToPixel(LineRunDisplayInfo const&, short, void*, void*) + 551
12  com.apple.HIToolbox             0x957ef995 CLine::RunCharToPixel(LineRunInfo const*, long, unsigned char, ATSUCaret*, ATSUCaret*) + 87
13  com.apple.HIToolbox             0x957eff7b CLine::CharacterToPixel(TCharOffset, char, ATSUCaret*) + 221
14  com.apple.HIToolbox             0x957f0063 CLine::GetLineHilites(TCharOffsetRange, CLineHilitesList*, unsigned char, char) + 79
15  com.apple.HIToolbox             0x957b60ea CTextensionDisplay::GetLineHilites(long, TCharOffsetRange, CLineHilitesList*, unsigned char, char) + 106
16  com.apple.HIToolbox             0x957e8819 CSelection::CalcRangeRect(TCharOffsetRange, TLongRect*, unsigned char) + 197
17  com.apple.HIToolbox             0x957e88df CSelection::CalcCaretRect() + 61
18  com.apple.HIToolbox             0x957e893d CSelection::GetCaretRect(TLongRect*) + 33
19  com.apple.HIToolbox             0x957b6132 CTextensionDisplay::CharToPoint(TCharOffset, long*, long*, long*) + 60
20  com.apple.HIToolbox             0x957b6e66 CTextensionDisplay::CharToPoint(TCharOffset, long*) + 58
21  com.apple.HIToolbox             0x957ebd2a CSelection::UpdateAnchors(TCharOffsetRange const&, unsigned char, unsigned char) + 98
22  com.apple.HIToolbox             0x957b9b4b CTextensionDisplay::EndEdit(TEditInfo const&, long, long, TCharOffset*) + 165
23  com.apple.HIToolbox             0x957c80e2 CTextension::EndEdit(TEditInfo const&, long, long, TCharOffset*, unsigned char) + 56
24  com.apple.HIToolbox             0x957d930a CUnicodeTextension::UnicodeReplaceRange(long, long, TReplaceParams const&, unsigned char, unsigned char) + 2600
25  com.apple.HIToolbox             0x957d9509 CUnicodeTextension::ReplaceRange(long, long, TReplaceParams const&, unsigned char, unsigned char) + 101
26  com.apple.HIToolbox             0x957ca5cd CReplaceTextCommand::DoMainAction() + 67
27  com.apple.HIToolbox             0x957ca035 CTextensionEditCommand::DoIt(short*) + 29
28  com.apple.HIToolbox             0x957c9920 CTextensionCommand::Execute(short*) + 54
29  com.apple.HIToolbox             0x957cf9c9 OpaqueTXNObject::ExecuteCurrCommand() + 113
30  com.apple.HIToolbox             0x957cff11 OpaqueTXNObject::NewCommand(short, AttrObjModifier const*, TKeyDownParams*, TReplaceParams*) + 1061
31  com.apple.HIToolbox             0x957bd030 DoSetDataCommand(OpaqueTXNObject*, unsigned long, unsigned long, TReplaceParams*) + 299
32  com.apple.HIToolbox             0x957c4fd3 TXNSetData + 683
33  libwx_macud-2.8.0.dylib         0x0171d9f8 wxMacMLTEControl::SetTXNData(wxString const&, unsigned long, unsigned long) + 168
34  libwx_macud-2.8.0.dylib         0x017207b5 wxMacMLTEControl::WriteText(wxString const&) + 205
35  libwx_macud-2.8.0.dylib         0x0171fa82 wxTextCtrl::WriteText(wxString const&) + 242
36  _controls_.so                   0x05c88633 _wrap_TextCtrl_AppendText + 247 (wxPython.h:48)
37  org.python.python               0x000c8841 PyEval_EvalFrameEx + 20769
38  org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
39  org.python.python               0x000c8b33 PyEval_EvalFrameEx + 21523
40  org.python.python               0x000c9933 PyEval_EvalFrameEx + 25107
41  org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
42  org.python.python               0x00042832 function_call + 162
43  org.python.python               0x0000f5b5 PyObject_Call + 85
44  org.python.python               0x00021ff6 instancemethod_call + 422
45  org.python.python               0x0000f5b5 PyObject_Call + 85
46  org.python.python               0x000c278e PyEval_CallObjectWithKeywords + 78
47  org.python.python               0x00038f02 PyFile_WriteObject + 354
48  org.python.python               0x000c6c4c PyEval_EvalFrameEx + 13612
49  org.python.python               0x000c9933 PyEval_EvalFrameEx + 25107
50  org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
51  org.python.python               0x00042832 function_call + 162
52  org.python.python               0x0000f5b5 PyObject_Call + 85
53  org.python.python               0x000c617b PyEval_EvalFrameEx + 10843
54  org.python.python               0x000c9933 PyEval_EvalFrameEx + 25107
55  org.python.python               0x000c9933 PyEval_EvalFrameEx + 25107
56  org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
57  org.python.python               0x00042832 function_call + 162
58  org.python.python               0x0000f5b5 PyObject_Call + 85
59  org.python.python               0x00021ff6 instancemethod_call + 422
60  org.python.python               0x0000f5b5 PyObject_Call + 85
61  org.python.python               0x0007dd17 slot_tp_init + 87
62  org.python.python               0x0007c710 type_call + 176
63  org.python.python               0x0000f5b5 PyObject_Call + 85
64  org.python.python               0x000c6ef6 PyEval_EvalFrameEx + 14294
65  org.python.python               0x000c9933 PyEval_EvalFrameEx + 25107
66  org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
67  org.python.python               0x00042832 function_call + 162
68  org.python.python               0x0000f5b5 PyObject_Call + 85
69  org.python.python               0x00021ff6 instancemethod_call + 422
70  org.python.python               0x0000f5b5 PyObject_Call + 85
71  org.python.python               0x000c278e PyEval_CallObjectWithKeywords + 78
72  _core_.so                       0x0100ab2e wxPyCallback::EventThunker(wxEvent&) + 234 (helpers.cpp:1759)
73  libwx_macud-2.8.0.dylib         0x0169c97a wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) + 108
74  libwx_macud-2.8.0.dylib         0x0169ca20 wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 80
75  libwx_macud-2.8.0.dylib         0x0169d81f wxEvtHandler::ProcessEvent(wxEvent&) + 225
76  libwx_macud-2.8.0.dylib         0x016cf6b1 wxControl::ProcessCommand(wxCommandEvent&) + 27
77  libwx_macud-2.8.0.dylib         0x016ca2f6 wxButton::MacControlHit(void*, void*) + 62
78  libwx_macud-2.8.0.dylib         0x01734d47 wxMacWindowControlEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 605
79  libwx_macud-2.8.0.dylib         0x017356a9 wxMacWindowEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 197
80  com.apple.HIToolbox             0x95582c2f DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
81  com.apple.HIToolbox             0x95581ef6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
82  com.apple.HIToolbox             0x955a47f3 SendEventToEventTarget + 52
83  com.apple.HIToolbox             0x955f3cce SendControlHit(HIView*, OpaqueEventRef*, short, unsigned long) + 296
84  com.apple.HIToolbox             0x955f3b4f HIView::NotifyControlHit(OpaqueEventRef*, short, unsigned long) + 45
85  com.apple.HIToolbox             0x9565865f HIView::ClickInternal(CGPoint const&, unsigned long, void (*)(OpaqueControlRef*, short), OpaqueEventRef*, bool) + 245
86  com.apple.HIToolbox             0x95659c18 HIView::ClickSelf(OpaqueEventRef*) + 368
87  com.apple.HIToolbox             0x95595af9 HIView::EventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 2363
88  com.apple.HIToolbox             0x95582c2f DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
89  com.apple.HIToolbox             0x95581ef6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
90  com.apple.HIToolbox             0x955a47f3 SendEventToEventTarget + 52
91  com.apple.HIToolbox             0x955f2b8e HIView::Click(OpaqueEventRef*) + 480
92  com.apple.HIToolbox             0x955f295b HandleClickAsHIView(OpaqueWindowPtr*, OpaqueEventRef*) + 151
93  com.apple.HIToolbox             0x955f1238 HandleWindowClick(OpaqueWindowPtr*, Point, short, unsigned long, OpaqueEventRef*) + 491
94  com.apple.HIToolbox             0x955f0d3b HandleMouseEvent(OpaqueEventHandlerCallRef*, OpaqueEventRef*) + 786
95  com.apple.HIToolbox             0x955f0652 StandardWindowEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 93
96  com.apple.HIToolbox             0x95582c2f DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
97  com.apple.HIToolbox             0x95581ef6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
98  com.apple.HIToolbox             0x955a47f3 SendEventToEventTarget + 52
99  com.apple.HIToolbox             0x955b634f ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 1257
100 com.apple.HIToolbox             0x95583080 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2672
101 com.apple.HIToolbox             0x95581ef6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
102 com.apple.HIToolbox             0x955a47f3 SendEventToEventTarget + 52
103 libwx_macud-2.8.0.dylib         0x016bfd9a wxApp::MacHandleOneEvent(void*) + 34
104 libwx_macud-2.8.0.dylib         0x016bfe62 wxApp::MacDoOneEvent() + 120
105 libwx_macud-2.8.0.dylib         0x016da3de wxEventLoop::Dispatch() + 32
106 libwx_macud-2.8.0.dylib         0x0179667d wxEventLoopManual::Run() + 97
107 libwx_macud-2.8.0.dylib         0x0176c7fe wxAppBase::MainLoop() + 76
108 _core_.so                       0x010018dc wxPyApp::MainLoop() + 52 (helpers.cpp:215)
109 _core_.so                       0x0104f03a _wrap_PyApp_MainLoop + 82 (_core_wrap.cpp:31686)
110 org.python.python               0x000c8841 PyEval_EvalFrameEx + 20769
111 org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
112 org.python.python               0x00042832 function_call + 162
113 org.python.python               0x0000f5b5 PyObject_Call + 85
114 org.python.python               0x00021ff6 instancemethod_call + 422
115 org.python.python               0x0000f5b5 PyObject_Call + 85
116 org.python.python               0x000c6ef6 PyEval_EvalFrameEx + 14294
117 org.python.python               0x000c9933 PyEval_EvalFrameEx + 25107
118 org.python.python               0x000ca90a PyEval_EvalCodeEx + 2042
119 org.python.python               0x000caa97 PyEval_EvalCode + 87
120 org.python.python               0x000ef158 PyRun_FileExFlags + 168
121 org.python.python               0x000f0087 PyRun_SimpleFileExFlags + 855
122 org.python.python               0x00109137 Py_Main + 3255
123 org.python.python               0x00001f82 0x1000 + 3970

我不确定问题是什么,因为它在windows和unix上运行得非常好。任何形式的帮助都表示赞赏。

编辑:我使用sudo再次运行它,这次没有崩溃,但另一方面没有进程启动,所以它没有任何区别。已经看过这个issue,但我应该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

确保子进程中没有任何内容尝试访问,创建或操作任何UI对象,包括位图或DC等内容。