13

Interesting stuff occurred while I debug one of the unit tests on CI server (maven build actually). I connect to java process with strace -ff -e trace=network -p [pid] to trace network activity of build process. And that's what I saw:

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)

So, there we have some network activity (it's what I am actually search for), and a lot of SIGSEGV signals.

Build finished correctly (just one broken test). Situation determinable and reproduced over and over again. What does this mean?

Denis Bazhenov
  • 9,680
  • 8
  • 43
  • 65

1 Answers1

20

Since this is java, it means that your JVM is using SIGSEGVs for something. Common uses include

  • null pointer dereferences -- the JVM catches SIGSEGVs to address 0 and turns them into NullPointerExceptions

  • garbage collection write barriers -- rarely changed pages are marked read only and SEGVs catch writes to them. This way the garbage collector doesn't have to rescan all of memory all of the time.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226
  • 1
    Very interesting, thank you! Can you provide some links where I can find more information about this stuff? – Denis Bazhenov Sep 17 '10 at 00:57
  • Is this harmless then or should it be addressed? I am seeing similar occuring on my application running on solaris via truss. – Tom Apr 04 '11 at 16:22
  • 1
    I think there is no need to be worried :) – Denis Bazhenov Apr 24 '11 at 03:38
  • Second point is very dangerous when you do JNI and that part blocks all signals (respectively SIGSEGV). Application will then encounter seamingly random SIGSEGV-triggered crashes (looking like race conditions or invalid memory access) that are very difficult to trace down. – Ales Teska Feb 11 '15 at 01:08
  • Given a line like this from an strace of a JVM: "--- SIGSEGV (Segmentation fault) @ 0 (0) ---" is it safe to assume that's a Null Pointer Exception because of those zeros? – spl Oct 19 '17 at 13:25
  • 1
    @spl: if the program seems to run fine, then yes, those SIGSEGVs are actually NullPointerExceptions – Chris Dodd Oct 20 '17 at 01:43