【问题标题】:A lot of SIGSEGV while strace'ing java processstrace'ing java 进程时有很多 SIGSEGV
【发布时间】:2011-04-13 12:08:26
【问题描述】:

当我在 CI 服务器(实际上是 maven 构建)上调试其中一个单元测试时,发生了一些有趣的事情。我使用strace -ff -e trace=network -p [pid] 连接到java 进程以跟踪构建过程的网络活动。这就是我所看到的:

Process 26324 attached
Process 26325 attached (waiting for parent)
Process 26325 resumed (parent 26312 ready)
Process 26325 detached
Process 26324 detached
Process 26320 detached
Process 26317 detached
Process 26308 resumed
[pid 26308] --- SIGCHLD (Child exited) @ 0 (0) ---
Process 26307 resumed
Process 26308 detached
[pid 26310] --- SIGCHLD (Child exited) @ 0 (0) ---
Process 26310 detached
[pid 25551] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 26309 detached
Process 26307 detached
[pid 25717] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
[pid 25715] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
[pid 25713] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
[pid 25551] socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 163
[pid 25551] setsockopt(163, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
[pid 25551] bind(163, {sa_family=AF_INET, sin_port=htons(6590), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
Process 26471 attached (waiting for parent)
Process 26471 resumed (parent 25551 ready)
[pid 25551] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
[pid 25551] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
[pid 26471] recvfrom(163,  <unfinished ...>
[pid 25551] socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 164
[pid 25551] setsockopt(164, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
[pid 25551] bind(164, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
[pid 25551] getsockname(164, {sa_family=AF_INET, sin_port=htons(45728), sin_addr=inet_addr("0.0.0.0")},[16]) = 0
[pid 25551] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
[pid 26471] <... recvfrom resumed> 0x8e80618, 65536, 0, 0x6ef6aea0, 0x6ef6ae9c) = ? ERESTARTSYS (To be restarted)
[pid 26471] --- SIGRT_29 (Real-time signal 27) @ 0 (0) ---
Process 26471 detached
Process 26472 attached (waiting for parent)
Process 26472 resumed (parent 25551 ready)
Process 26473 attached (waiting for parent)
Process 26473 resumed (parent 25551 ready)

所以,我们有一些网络活动(这是我实际搜索的内容),还有很多 SIGSEGV 信号。

构建正确完成(只是一个损坏的测试)。情况可确定并一遍又一遍地再现。这是什么意思?

【问题讨论】:

    标签: java segmentation-fault strace


    【解决方案1】:

    由于这是 java,这意味着您的 JVM 正在使用 SIGSEGVs 做某事。常见用途包括

    • 空指针解引用——JVM 将 SIGSEGV 捕获到地址 0 并将它们转换为 NullPointerExceptions

    • 垃圾收集写屏障——很少更改的页面被标记为只读,并且 SEGV 捕获对它们的写入。这样垃圾收集器就不必一直重新扫描所有内存。

    【讨论】:

    • 非常有趣,谢谢!您能否提供一些链接,以便我可以找到有关这些内容的更多信息?
    • 这是无害的还是应该解决?我在通过 truss 在 solaris 上运行的应用程序上看到了类似情况。
    • 我觉得不用担心:)
    • 第二点是非常危险的,当你做 JNI 并且那部分会阻塞所有信号(分别是 SIGSEGV)。然后,应用程序将遇到由 SIGSEGV 触发的非常随机的崩溃(看起来像竞争条件或无效的内存访问),这些崩溃非常难以追踪。
    • @spl: 如果程序看起来运行良好,那么是的,那些 SIGSEGV 实际上是 NullPointerExceptions
    猜你喜欢
    • 1970-01-01
    • 2018-12-18
    • 2013-06-28
    • 1970-01-01
    • 2016-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多