1

我开发了一个 GitHub 存储库,其中包含python2.7 中用于绘图的多进程脚本示例。基本上,脚本分配一个进程来生成数据,这些数据通过队列传递到负责生成绘图的第二个进程。当我同时运行示例“multiproc_processIPC.py”或“multiproc_poolQ​​UEUE.py”时,我收到以下错误。请注意,在将我的 mac 升级到 OSX Sierra 之后出现此错误。有人知道这个问题的根源吗?任何帮助将不胜感激

===== 错误报告 =====

进程:python2.7 [82890] 路径:/Users/USER/*/python 标识符:python2.7 版本:??? 代码类型:X86-64(本机)父进程:python2.7 [82883] 负责人:python2.7 [82890] 用户 ID:501

日期/时间:2016-12-04 22:34:29.874 +0100 操作系统版本:Mac OS X 10.12.1 (16B2555) 报告版本:12 匿名 UUID:689587A6-D759-0F81-671D-1079942B7C42

自启动以来的唤醒时间:9000 秒

系统完整性保护:启用

崩溃的线程:0 调度队列:com.apple.main-thread

异常类型:EXC_BAD_INSTRUCTION (SIGILL) 异常代码:0x0000000000000001、0x0000000000000000 异常说明:EXC_CORPSE_NOTIFY

终止信号:非法指令:4 终止原因:命名空间信号,代码 0x4 终止进程:exc 处理程序 [0]

应用程序特定信息:LIBDISPATCH 客户端中的错误:从错误线程调用的 _dispatch_main_queue_callback_4CF 在 fork pre-exec 的子端崩溃

线程 0 崩溃::调度队列:com.apple.main-thread 0 libdispatch.dylib 0x00007fff8f9ddd21 _dispatch_main_queue_callback_4CF + 1291 1 com.apple.CoreFoundation 0x00007fff7a97abe9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE+ 9 2 com.apple.CoreFoundation 0x00007fff7a93c00d __CFRunLoopRun + 2205 3 com.apple.CoreFoundation 0x00007fff7a93b514 CFRunLoopRunSpecific + 420 4 com.apple.HIToolbox 0x00007fff79ed8fbc RunCurrentEventLoopInMode + 240 5 com.apple.HIToolbox 0x00007fff79ed8df1 ReceiveNextEventCommon + 432 6 com.apple.HIToolbox 0x00007fff79ed8c26 _BlockUntilNextEventMatchingListInModeWithFilter + 71 7 com.apple.AppKit 0x00007fff785c2b79 _DPSNextEvent + 1093 8 com.apple.AppKit 0x00007fff78cd81c3 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1637 9 Tk 0x0000000104b01285 0x104a47000 + 762501 10 Tk 0x0000000104b0171f 0x104a47000 + 763679 11 Tcl 0x00000001049d75f8 Tcl_DoOneEvent + 317 12 Tk 0x0000000104a55932 0x104a47000 + 59698 13 Tcl 0x00000001049695b7 0x10495b000 + 58807 14 Tcl 0x0000000104969e46 Tcl_EvalObjv + 59 15 _tkinter.so 0x00000001037dfe39 Tkapp_Call + 617 16 libpython2. 7.dylib 0x00000001000a3302 PyEval_EvalFrameEx + 3730 17 libpython2.7.dylib 0x00000001000ac913 fast_function + 179 18 libpython2.7.dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 19 libpython2.7。dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 20 libpython2.7.dylib 0x00000001000ac988 fast_function + 296 21 libpython2.7.dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 22 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 23 libpython2.7.dylib 0x00000001000ac988 fast_function + 296 24 libpython2.7. dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 25 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 26 libpython2.7.dylib 0x0000000100035c1b function_call + 347 27 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 28 libpython2.7.dylib 0x00000001000a3cea PyEval_EvalFrameEx + 6266 29 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 30 libpython2.7.dylib 0x00000001000ac988 fast_function + 296 31 libpython2.7.dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 32 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 33 libpython2.7.dylib 0x0000000100035c1b function_call + 347 34 libpython2.7. dylib 0x000000010000c761 PyObject_Call + 97 35 libpython2.7.dylib 0x000000010001e7d7 instancemethod_call + 503 36 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 37 libpython2.7.dylib 0x000000010006673a slot_tp_init + 106 38 libpython2.7.dylib 0x0000000100062465 type_call + 229 39 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 40 libpython2.7.dylib 0x00000001000a35a5 PyEval_EvalFrameEx + 4405 41 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 42 libpython2.7.dylib 0x0000000100035c1b function_call + 347 43 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 44 libpython2.7. dylib 0x000000010001e7d7 instancemethod_call + 503 45 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 46 libpython2.7.dylib 0x000000010006673a slot_tp_init + 106 47 libpython2.7.dylib 0x0000000100062465 type_call + 229 48 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 49 libpython2.7.dylib 0x00000001000a3cea PyEval_EvalFrameEx + 6266 50 libpython2.7.dylib 0x00000001000ac913 fast_function + 179 51 libpython2.7.dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 52 libpython2.7.dylib 0x00000001000ac913 fast_function + 179 53 libpython2.7.dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 54 libpython2.7. dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 55 libpython2.7.dylib 0x0000000100035c1b function_call + 347 56 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 57 libpython2.7.dylib 0x000000010001e7d7 instancemethod_call + 503 58 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 59 libpython2.7.dylib 0x000000010006673a slot_tp_init + 106 60 libpython2.7.dylib 0x0000000100062465 type_call + 229 61 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97 62 libpython2.7.dylib 0x00000001000a35a5 PyEval_EvalFrameEx + 4405 63 libpython2.7.dylib 0x00000001000ac913 fast_function + 179 64 libpython2.7. dylib 0x00000001000a338a PyEval_EvalFrameEx + 3866 65 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092 66 libpython2.7.dylib 0x00000001000ac856 PyEval_EvalCode + 54 67 libpython2.7.dylib 0x00000001000cb3d4 PyRun_FileExFlags + 164 68 libpython2.7.dylib 0x00000001000cc709 PyRun_SimpleFileExFlags + 409 69 libpython2.7.dylib 0x00000001000e01ca Py_Main + 2938 70 python 0x0000000100000f14 开始 + 52

线程 1:0 libsystem_kernel.dylib 0x00007fff8fb354e6 __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff8fc1d622 _pthread_wqthread + 1023 2 libsystem_pthread.dylib 0x00007fff8fc1d211 start_wqthread + 13

线程 2: 0 libsystem_kernel.dylib 0x00007fff8fb354e6 __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff8fc1d622 _pthread_wqthread + 1023 2 libsystem_pthread.dylib 0x00007fff8fc1d211 start_wqthread + 13

线程 3:0 libsystem_kernel.dylib 0x00007fff8fb354e6 __workq_kernreturn + 10 1 libsystem_pthread.dylib 0x00007fff8fc1d7b5 _pthread_wqthread + 1426 2 libsystem_pthread.dylib 0x00007fff8fc1d211 start_wqthread + 13

Thread 4: 0 libsystem_kernel.dylib 0x00007fff8fb34f4e __select + 10 1 Tcl 0x0000000104a08271 0x10495b000 + 709233 2 libsystem_pthread.dylib 0x00007fff8fc1daab _pthread_body + 180 3 libsystem_pthread.dylib 0x00007fff8fc1d9f7 _pthread_start + 286 4 libsystem_pthread.dylib 0x00007fff8fc1d221 thread_start + 13

Thread 5:: com.apple.NSEventThread 0 libsystem_kernel.dylib 0x00007fff8fb2d41a mach_msg_trap + 10 1 libsystem_kernel.dylib 0x00007fff8fb2c867 mach_msg + 55 2 libsystem_kernel.dylib 0x00007fff8fb21ed1 _kernelrpc_mach_port_set_attributes + 150 3 libdispatch.dylib 0x00007fff8f9e7739 _dispatch_runloop_queue_handle_init + 171 4 libdispatch.dylib 0x00007fff8f9d84b7 _dispatch_runloop_root_queue_create_4CF + 133 5 com.apple.CoreFoundation 0x00007fff7a9091e6 __CFRunLoopF​​indMode + 502 6 com.apple.CoreFoundation 0x00007fff7a909889 CFRunLoopAddSource + 201 7 com.apple.HIToolbox 0x00007fff79ed9897 AdjustCGSSourceInRunLoop(void ( )(__CFRunLoop, __CFRunLoopSource*, __CFString const*), __CFRunLoop*, __CFRunLoopSource*) + 180 8 com.apple.HIToolbox 0x00007fff79ed97bb AddCGSSourceToRunLoop(__CFRunLoop*) + 78 9 com.apple.HIToolbox 0x00007fff79eecc52 _BeginEventReceiptOnThread + 181 10 com.apple.AppKit 0x00007fff7870f4f8 _NSEventThread + 37 11 libsystem_pthread.dylib 0x00007fff8fc1daab _pthread_body + 180 12 libsystem_pthread.dylib 0x00007fff8fc1d9f7 _pthread_start + 286 13 libsystem_pthread.dylib 0x00007fff8fc1d221 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000307 rbx: 0x00000001003d93f0 rcx: 0x00007fff8f9f9530 rdx: 0x0000000000000307 rdi: 0x0000000000000001 rsi: 0x0000000000000006 rbp: 0x00007fff5fbfa160 rsp: 0x00007fff5fbfa0f0 r8: 0x0000000000000040 r9: 0x00000001003d9408 r10: 0xffffffffffffffff r11: 0x0000000000012068 r12 : 0x00000001003d93e0 r13: 0x00000001003d94a0 r14: 0x00007fff986f5a80 r15: 0x0000000102076898 rip: 0x00007fff8f9ddd21 rfl: 0x0000000000010202 cr2: 0x00007fff9db1224b

逻辑 CPU:3 错误代码:0x00000000 陷阱编号:6

二进制图像: 0x100000000 - 0x100000ff7 +python (???) /Users/USER/ /python 0x100003000 - 0x100146ff7 +libpython2.7.dylib (2.7) <87FF0E63-058F-3190-A882-8E25F3D889C7> /Users/USER/ /libpython2 .7.dylib 0x1002db000 - 0x1002dcff7 +_locale.so (???) /Users/USER/ /_locale.so 0x1002e0000 - 0x1002e6ff7 +itertools.so (???) /Users/USER//itertools.so <<<<<< 为简洁而省略的行 >>>>>> 0x7fff8fc2b000 - 0x7fff8fc32fff libsystem_symptoms.dylib (532.1.1) <8FB7CA37-79EF-3651-B5B9-B5E1E0947067> /usr/lib/system/libsystem_symptoms .dylib 0x7fff8fc33000 - 0x7fff8fc53ff7 libsystem_trace.dylib (518.20.8) /usr/lib/system/libsystem_trace.dylib 0x7fff8fc54000 - 0x7fff8fc59ffb libunwind.dylib (35.3) <9F7C2Fff8fc59ffb libunwind.dylib (35.3) <9F7C2C2-A9A7-01/0166AAA20>usrlib0/014-8AAA20>/usrlib0/014-8AAA208D-B libunwind.dylib 0x7fff8fc5a000 - 0x7fff8fc83ff7 libxpc.dylib (972.20.3) <85EB25FD-218F-38EE-9E69-391CC8EBE6C5> /usr/lib/system/libxpc.dylib

外部修改摘要:其他进​​程针对此进程进行的调用:task_for_pid:0 thread_create:0 thread_set_state:0 此进程进行的调用:task_for_pid:0 thread_create:0 thread_set_state:0 本机上所有进程的调用:task_for_pid:542465 thread_create :0线程集状态:0

VM 区域摘要:库的只读部分:总计 = 254.5M 驻留=0K(0%) swapped_out_or_unallocated=254.5M(100%) 可写区域:总计=96.5M 写入=0K(0%) 驻留=0K(0%) swapped_out =0K(0%) 未分配=96.5M(100%)

                            VIRTUAL   REGION 

区域类型大小计数(未合并) =========== ======= ======= 活动跟踪 256K 2 CoreUI 图像文件 144K 3 调度延续 8192K 2 内核分配一次8K 2 MALLOC 61.8M 54 MALLOC 保护页 32K 7 内存标签 242 12K 2 堆栈保护 56.0M 7 堆栈 10.1M 7 VM_ALLOCATE 48K 7 __DATA 21.0M 292 __IMAGE 528K 2 __LINKEDIT 115.0M 66 __TEXT 139。5M 288 __UNICODE 556K 2 映射文件 43.2M 9 共享内存 16.3M 12 =========== ======= ======= 总计 472.4M 747

型号:MacBookPro11,1,BootROM MBP111.0138.B17,2 个处理器,Intel Core i5,2,4 GHz,8 GB,SMC 2.16f68 显卡:Intel Iris,Intel Iris,内置内存模块:BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343531533641465238412D50422020 Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343531533641465238412D50422020 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x112), Broadcom BCM43xx 1.0 (7.21.171.47.1a8) Bluetooth :版本 5.0.1f7,3 个服务,17 个设备,1 个传入串行端口网络服务:AirPort,AirPort,en0 串行 ATA 设备:APPLE SSD SM0256F,251 GB USB 设备:USB 3.0 总线 USB 设备:Apple 内部键盘/触控板 USB 设备:BRCM20702 集线器 USB 设备:蓝牙 USB 主机控制器 Thunderbolt 总线:MacBook Pro、Apple Inc.、17.2

4

2 回答 2

3

尝试将“start method”设置为“spawn”而不是默认的“fork”。有关详细信息,请参阅https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

这对我有类似的问题。

于 2017-03-28T13:01:54.187 回答
0

好的,更多信息:如果我从终端运行第一个进程,其脚本“visl.py”是:

#!/usr/bin/env python
from multiprocessing import Process
import sys
sys.path.insert(0, './lib')
import visualizer

visualizer.Visualizer()

然后是来自不同终端实例的第二个进程,其脚本“logr.py”是:

#!/usr/bin/env python
from multiprocessing import Process
import sys
sys.path.insert(0, './lib')
import logger


args_logger = {'sampling_time_ms': 5, 'plotting_time_ms': 100}
logger.Logger(args_logger) 

有用。然后:如何从一个脚本运行两个 python 进程?

于 2016-12-09T20:37:49.897 回答