- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个奇怪的错误,现在在 2 台机器上重复出现。它可能仅限于 python 2.7 64 位,但目前还不清楚。在 Mac OS X 10.7 上,我得到:段错误:11在 10.6 上,每当我关闭 python 时,我都会收到一个简单的“段错误”。
但是,错误很难重现。简单的 python 脚本,例如: python -c "导入 sys;打印 sys.maxint"打开和关闭没有问题。
我怀疑 matplotlib 有问题,但同样 python -c “导入 pylab;pylab.plot();pylab.show()”也不会遇到任何问题。
但是,有许多不同的包确实会在 python 关闭时导致段错误,但不会在交互式 session 期间发生,也不会发生在脚本完成之前。因此,该错误不会影响我的任何代码 - 但它会在 10.7 中运行任何内容时造成困惑,因为会弹出焦点窃取错误消息。
我会努力列出并记录导致崩溃的脚本/模块,但我想我现在应该提出这个问题,看看是否有其他人遇到过类似的问题。
这是引用示例(感谢 Ned 的建议)。
Process: python2.7 [42731]
Path: /usr/local/bin/python
Identifier: python2.7
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [1838]
Date/Time: 2011-09-16 20:38:52.847 -0600
OS Version: Mac OS X 10.7.1 (11B2118)
Report Version: 9
Interval Since Last Report: 11388 sec
Crashes Since Last Report: 12
Per-App Crashes Since Last Report: 11
Anonymous UUID: CE462F4B-5DAF-482A-8901-28ADB7AB0AD6
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
VM Regions Near 0x8:
-->
__TEXT 0000000100000000-0000000100001000 [ 4K] r-x/rwx SM=COW /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Application Specific Information:
objc[42731]: garbage collection is OFF
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.python.python 0x00000001000c3f71 new_threadstate + 305
1 org.python.python 0x00000001000c3fe8 PyGILState_Ensure + 40
2 h5e.so 0x0000000106558c21 __pyx_f_4h5py_3h5e_err_callback + 33 (h5e.c:2045)
3 libhdf5.7.dylib 0x0000000106323940 H5E_dump_api_stack + 144
4 libhdf5.7.dylib 0x0000000106320428 H5Eget_auto2 + 136
5 libhdf5.7.dylib 0x00000001062bf2f0 H5_term_library + 64
6 libsystem_c.dylib 0x00007fff8ff1b7d0 __cxa_finalize + 282
7 libsystem_c.dylib 0x00007fff8ff1b652 exit + 18
8 python 0x0000000100000e51 _start + 255
9 python 0x0000000100000d51 start + 33
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8bcfd7e6 kevent + 10
1 libdispatch.dylib 0x00007fff8bdf760e _dispatch_mgr_invoke + 923
2 libdispatch.dylib 0x00007fff8bdf619e _dispatch_mgr_thread + 54
Thread 2:
0 libsystem_kernel.dylib 0x00007fff8bcfd192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ff2a594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff8ff2bb85 start_wqthread + 13
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8bcfd192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ff2a594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff8ff2bb85 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff8bcfd192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff8ff2a594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff8ff2bb85 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x00007fff8bcfcdf2 __select + 10
1 Tcl 0x00000001022eb80b NotifierThreadProc + 558
2 libsystem_c.dylib 0x00007fff8ff288bf _pthread_start + 335
3 libsystem_c.dylib 0x00007fff8ff2bb75 thread_start + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000001 rbx: 0x0000000000000001 rcx: 0x0000000000000b00 rdx: 0x00007fff5fbff034
rdi: 0x00000a0000000b03 rsi: 0x00000b0000000b00 rbp: 0x00007fff5fbff0c0 rsp: 0x00007fff5fbff0a0
r8: 0x00007fff5fbff03c r9: 0x00007fff5fbff038 r10: 0x0000000000000081 r11: 0x00000000e33a913f
r12: 0x00000001062bf2b0 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000101bd05a0
rip: 0x00000001000c3f71 rfl: 0x0000000000010202 cr2: 0x0000000000000008
Logical CPU: 0
Binary Images:
0x100000000 - 0x100000fff +python (??? - ???) <BA9D2124-1753-3A21-91BE-15C8CD5FE7F3> /usr/local/bin/python
0x100003000 - 0x100142fe7 +org.python.python (, [c] 2004-2011 Python Software Foundation. - ???) <C6142A6D-0D50-32D9-A058-2A2BA484D94E> /Library/Frameworks/Python.framework/Versions/2.7/Python
--SNIP - TOO LONG--
0x7fff98338000 - 0x7fff9841cdef libobjc.A.dylib (228.0.0 - compatibility 1.0.0) <C5F2392D-B481-3A9D-91BE-3D039FFF4DEC> /usr/lib/libobjc.A.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 6
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 1288178
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=170.9M resident=77.2M(45%) swapped_out_or_unallocated=93.7M(55%)
Writable regions: Total=169.1M written=87.2M(52%) resident=111.0M(66%) swapped_out=1536K(1%) unallocated=58.2M(34%)
REGION TYPE VIRTUAL
=========== =======
CG image 4K
CG raster data 64K
CG shared images 3416K
CoreGraphics 16K
CoreServices 1800K
MALLOC 140.4M
MALLOC guard page 48K
Memory tag=242 12K
Memory tag=251 8K
STACK GUARD 56.0M
Stack 10.1M
VM_ALLOCATE 16.1M
__CI_BITMAP 80K
__DATA 15.6M
__IMAGE 1256K
__LINKEDIT 53.4M
__TEXT 117.5M
__UNICODE 544K
mapped file 30.4M
shared memory 308K
=========== =======
TOTAL 446.8M
产生相同(近似)错误的 C 代码:helloworld.cpp -
#include<iostream>
using namespace std;
int main() {
char *blah;
cout << "Hello World" << endl << "I am the C sea" << endl;
cin >> blah;
cout << blah << endl;
return 0;
}
编译者:
g++ helloworld.cpp -o helloworld.out
./helloworld.out
错误报告#2:
Process: helloworld.out [10982]
Path: /Users/USER/*/helloworld.out
Identifier: helloworld.out
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [10803]
Date/Time: 2011-09-24 09:36:43.979 -0600
OS Version: Mac OS X 10.7.1 (11B2118)
Report Version: 9
Interval Since Last Report: 271170 sec
Crashes Since Last Report: 119
Per-App Crashes Since Last Report: 4
Anonymous UUID: CE462F4B-5DAF-482A-8901-28ADB7AB0AD6
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000104ca3000-0000000104ca4000 [ 4K] r-x/rwx SM=COW /Users/USER/*/*.out
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 helloworld.out 0x0000000104ca3d79 main + 169
1 ??? 0x0073657261757173 0 + 32481164257489267
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x0000000000000008 rdx: 0x0000000000000000
rdi: 0x00007fff7c8e24e8 rsi: 0x00007fab53000000 rbp: 0x00007fff648a28e0 rsp: 0x00007fff648a28d8
r8: 0x00000000fb343fb8 r9: 0x0000000000000000 r10: 0x0000000053000000 r11: 0x0000000000000246
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x0000000104ca3d79 rfl: 0x0000000000010202 cr2: 0x00007fab53001000
Logical CPU: 1
Binary Images:
0x104ca3000 - 0x104ca3ff7 +helloworld.out (??? - ???) <68FD4206-E8D6-340F-B25B-E2DE6FB1D3BC> /Users/USER/*/helloworld.out
0x7fff648a3000 - 0x7fff648d7ac7 dyld (195.5 - ???) <4A6E2B28-C7A2-3528-ADB7-4076B9836041> /usr/lib/dyld
0x7fff8bce6000 - 0x7fff8bd06fff libsystem_kernel.dylib (1699.23.2 - compatibility 1.0.0) <55377210-60A0-3F33-9D45-B2D19AA91859> /usr/lib/system/libsystem_kernel.dylib
0x7fff8bdf4000 - 0x7fff8be02fff libdispatch.dylib (187.5.0 - compatibility 1.0.0) <698F8EFB-7075-3111-94E3-891156C88172> /usr/lib/system/libdispatch.dylib
0x7fff8c415000 - 0x7fff8c41cfff libcopyfile.dylib (85.1.0 - compatibility 1.0.0) <65602684-33B1-32DE-802B-050CE07659AC> /usr/lib/system/libcopyfile.dylib
0x7fff8cf65000 - 0x7fff8cfa7ff7 libcommonCrypto.dylib (55010.0.0 - compatibility 1.0.0) <A5B9778E-11C3-3F61-B740-1F2114E967FB> /usr/lib/system/libcommonCrypto.dylib
0x7fff8cfcc000 - 0x7fff8cfccfff libkeymgr.dylib (23.0.0 - compatibility 1.0.0) <61EFED6A-A407-301E-B454-CD18314F0075> /usr/lib/system/libkeymgr.dylib
0x7fff8cfcd000 - 0x7fff8cfd1fff libmathCommon.A.dylib (2026.0.0 - compatibility 1.0.0) <FF83AFF7-42B2-306E-90AF-D539C51A4542> /usr/lib/system/libmathCommon.A.dylib
0x7fff8d001000 - 0x7fff8d006fff libcompiler_rt.dylib (6.0.0 - compatibility 1.0.0) <98ECD5F6-E85C-32A5-98CD-8911230CB66A> /usr/lib/system/libcompiler_rt.dylib
0x7fff8e5bb000 - 0x7fff8e5c3fff libsystem_dnssd.dylib (??? - ???) <1FA8F861-9D0D-33D2-939F-5BD382718B97> /usr/lib/system/libsystem_dnssd.dylib
0x7fff8e5d2000 - 0x7fff8e5d6fff libdyld.dylib (195.5.0 - compatibility 1.0.0) <F1903B7A-D3FF-3390-909A-B24E09BAD1A5> /usr/lib/system/libdyld.dylib
0x7fff8e67d000 - 0x7fff8e69aff7 libxpc.dylib (77.16.0 - compatibility 1.0.0) <1FEBB79D-8537-38A4-882D-1E2AE212CD31> /usr/lib/system/libxpc.dylib
0x7fff8e999000 - 0x7fff8e99fff7 libunwind.dylib (30.0.0 - compatibility 1.0.0) <1E9C6C8C-CBE8-3F4B-A5B5-E03E3AB53231> /usr/lib/system/libunwind.dylib
0x7fff8ebdd000 - 0x7fff8ebe8ff7 libc++abi.dylib (14.0.0 - compatibility 1.0.0) <8FF3D766-D678-36F6-84AC-423C878E6D14> /usr/lib/libc++abi.dylib
0x7fff8f110000 - 0x7fff8f111fff libsystem_sandbox.dylib (??? - ???) <8D14139B-B671-35F4-9E5A-023B4C523C38> /usr/lib/system/libsystem_sandbox.dylib
0x7fff8f21e000 - 0x7fff8f21ffff libunc.dylib (24.0.0 - compatibility 1.0.0) <0482C762-746D-37EB-A8C9-E1048CF70462> /usr/lib/system/libunc.dylib
0x7fff8f5d0000 - 0x7fff8f5d1ff7 libsystem_blocks.dylib (53.0.0 - compatibility 1.0.0) <8BCA214A-8992-34B2-A8B9-B74DEACA1869> /usr/lib/system/libsystem_blocks.dylib
0x7fff8feda000 - 0x7fff8ffb7fef libsystem_c.dylib (763.11.0 - compatibility 1.0.0) <D48352AB-D1F1-3D8F-875C-2C807425CB8C> /usr/lib/system/libsystem_c.dylib
0x7fff907e1000 - 0x7fff907e6fff libcache.dylib (47.0.0 - compatibility 1.0.0) <3D114C8A-AD1F-3C78-9E8C-B8F3810740E5> /usr/lib/system/libcache.dylib
0x7fff908ec000 - 0x7fff9095ffff libstdc++.6.dylib (52.0.0 - compatibility 7.0.0) <6BDD43E4-A4B1-379E-9ED5-8C713653DFF2> /usr/lib/libstdc++.6.dylib
0x7fff90e9b000 - 0x7fff90ec8fe7 libSystem.B.dylib (159.0.0 - compatibility 1.0.0) <B4654B67-7521-3CD2-A67D-E1393C459D23> /usr/lib/libSystem.B.dylib
0x7fff9165c000 - 0x7fff9165dfff libdnsinfo.dylib (395.7.0 - compatibility 1.0.0) <37FEFE78-BCB5-37EC-8E99-747469BCA4C7> /usr/lib/system/libdnsinfo.dylib
0x7fff91704000 - 0x7fff91740fff libsystem_info.dylib (??? - ???) <BC49C624-1DAB-3A37-890F-6EFD46538424> /usr/lib/system/libsystem_info.dylib
0x7fff920e2000 - 0x7fff920e3ff7 libremovefile.dylib (21.0.0 - compatibility 1.0.0) <AACAD200-A346-3653-89E2-D9D10FE4DC06> /usr/lib/system/libremovefile.dylib
0x7fff92227000 - 0x7fff92230fff libnotify.dylib (80.0.0 - compatibility 1.0.0) <BD08553D-8088-38A8-8007-CF5C0B8F0404> /usr/lib/system/libnotify.dylib
0x7fff92e3e000 - 0x7fff92e40fff libquarantine.dylib (36.0.0 - compatibility 1.0.0) <A6B3CF07-A0D0-3C56-9BEC-33CBDD63CB89> /usr/lib/system/libquarantine.dylib
0x7fff9385e000 - 0x7fff93864fff libmacho.dylib (800.0.0 - compatibility 1.0.0) <548BAEB6-8C4C-3B0F-AB0C-7E1C960BCAB5> /usr/lib/system/libmacho.dylib
0x7fff95371000 - 0x7fff9537bff7 liblaunch.dylib (392.18.0 - compatibility 1.0.0) <EB5C4B29-D3B7-38AC-A646-3D445C767F03> /usr/lib/system/liblaunch.dylib
0x7fff9777d000 - 0x7fff97782ff7 libsystem_network.dylib (??? - ???) <4ABCEEF3-A3F9-3E06-9682-CE00F17138B7> /usr/lib/system/libsystem_network.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 8407398
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=50.0M resident=14.0M(28%) swapped_out_or_unallocated=36.1M(72%)
Writable regions: Total=17.4M written=60K(0%) resident=104K(1%) swapped_out=0K(0%) unallocated=17.3M(99%)
REGION TYPE VIRTUAL
=========== =======
MALLOC 9396K
MALLOC guard page 16K
STACK GUARD 56.0M
Stack 8192K
__DATA 516K
__LINKEDIT 47.1M
__TEXT 3000K
shared memory 12K
=========== =======
TOTAL 123.8M
Model: MacBookAir4,2, BootROM MBA41.0077.B00, 2 processors, Intel Core i7, 1.8 GHz, 4 GB, SMC 1.73f63
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 384 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1333 MHz, 0x80AD, 0x484D54333235533642465238432D48392020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xE9), Broadcom BCM43xx 1.0 (5.100.98.75.10)
Bluetooth: Version 4.0.0f4, 2 service, 11 devices, 1 incoming serial ports
Serial ATA Device: APPLE SSD SM256C, 251 GB
USB Device: FaceTime Camera (Built-in), apple_vendor_id, 0x850a, 0xfa200000 / 3
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfa100000 / 2
USB Device: BRCM20702 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000 / 5
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x821f, 0xfa113000 / 6
USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x024c, 0xfa120000 / 4
USB Device: hub_device, 0x0424 (SMSC), 0x2513, 0xfd100000 / 2
USB Device: Internal Memory Card Reader, apple_vendor_id, 0x8404, 0xfd110000 / 3
最佳答案
从堆栈跟踪来看,您的 Python 解释器在进程退出时 C 库运行的“atexit”处理程序中崩溃。具体来说,清理“HDF5”库的代码似乎遇到了错误。我认为崩溃的发生是因为 Python 运行时大部分已被清理,并且当库尝试调用某个错误处理程序时,该处理程序已经消失。
您的 C 应用程序存在“相同”问题的唯一原因在于它还使用了未初始化的变量。
如果 Python 总是崩溃并出现非常相似的堆栈跟踪(在转储报告中查找“崩溃的线程:X”,然后在转储中找到 X 线程的崩溃回溯),那么 HDF5 有问题正在使用。也许这是 Mac Python 端口中的一个已知错误? (我不太确定 hdf5 库是什么。)
关于关闭/退出时出现 python 段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7450881/
我目前正在为 Cocoa/Objective-C 项目编写一个脚本来完全自动化我的编译-运行-调试过程。 我的最后一行代码是: lldb -f Build/MyApp.app -o "run" 这实际
我有一个带有登录屏幕的脚本,如果按下取消按钮,我想完全退出该应用程序。我尝试了 3 种方法: 系统退出() QApplication.quit() QCoreApplication.instance(
我有一个 Flash 应用程序,可以重定向到另一个页面。我很乐意捕获任何其他窗口卸载事件(单击链接/提交表单)并警告用户他们将丢失 Flash 应用程序中的进度。 但是,我找不到任何方法来判断 URL
我正在尝试在 Ubuntu 上用 Python 编写一个简单的程序,它将在播放视频完成后关闭/退出/退出 VLC Player。 能否请您指导我应该在我的程序中添加什么以获得我需要的结果。 impor
我在 Lynda.com 上学习 PHP 2 视频时遇到了一个问题,因为讲师似乎忽略了告诉我们他在视频中执行的步骤之一。我在这里上传了相关视频http://www.youtube.com/watch?
某天在群内有同学问到,在python下我用input或者raw_input都得输入完后回车才能获取到输入的值,那如何实现任意键退出暂停等功能呢,我当时也没有多想,因为接触python时间也不算长,主
我按顺序调用了几个函数(我无法编辑),但有些函数会重定向用户,所以我永远不会进入下一个函数。 我正在调用一个第三方函数,它调用了我能够阻止的 wp_redirect(),但是下一行是 exit;我不知
终止/退出主函数的 D 方式是什么? import std.stdio; import core.thread; void main() { int i; while (i <= 5)
我正在申请写作。用户可以打开应用程序、写一些文本、保存他们的工作等。 我试图做到这一点,以便点击 window close按钮将提示用户 (a) 保存他们的工作(如有必要)或 (b) 退出。 我正在尝
我正在通过在 repl 中检查别人的代码来玩弄它。 它不断调用 System/exit,这导致我的 repl 崩溃。这真是令人气愤。 在我有权访问的所有代码中,我都模拟了调用。 但它也会调用一些我没有
我正在使用 subprocess执行mimic的模块程序(指定 here )。下面的代码成功地读取了一些文本并写入了一个 mp3 文件。 import subprocess proc = subpro
退出 .then 范围后数组上的值被清除 在下面的代码中tableValues1.length 给我正确的长度,直到它位于每个循环内当它退出时,作用域数组长度为零。 请谁能帮我解决这个问题 - 谢谢
我正在尝试为 s3cmd 编写一个 docker 镜像。当我通过 docker-compose 运行从 Dockerfile 构建的图像时,容器在 docker compose run 命令之前退出。
这个问题已经有答案了: 已关闭12 年前。 Possible Duplicate: Quitting an application - is that frowned upon? 我编写了一个 And
我遇到 Selenium WebDriver 仅执行一次后退出 for 循环的问题。据推测,这是获取内容和在加载页面之前启动循环的问题。是否有可能让 webdriver 等待页面加载? List al
#include #include #include #include "Player.h" using namespace std; void PlayerMenu(); int main()
class Test{ public static void main(String args[]) { Patron list[] = new PatronData(
我正在做一些作业,遇到了这个问题。 Write a program that reads several lines of text and prints a table indicating the
我正在用 C 创建一个简单的 Linux 命令 shell。我无法理解我的代码在哪里出现问题。 “commands”是我希望作为一个父进程的子进程同时执行的 Linux 命令字符串列表。当所有执行完成
我的控制台应用程序有点问题。应用程序应该从用户那里获取数字并将它们添加到列表中,但是如果输入是“c”,它应该关闭。我不知道如何在不使用 Scanner.nextLine() 挂起应用程序并退出循环的情
我是一名优秀的程序员,十分优秀!