title: JVM signal chaining SIGPIPE
body: <p>We have a C++ application with an embedded JVM (Sun's). Because we register our own signal handlers, it's recommended we do so before initializing the JVM since it installs its own handlers (<a href="http://download.oracle.com/javase/1.4.2/docs/guide/vm/signal-chaining.html" rel="nofollow">see here</a>).</p>
  
  <p>From what I understood, the JVM knows internally if the signal originated from its own code and if not it passes it along the chain - to our handlers.</p>
  
  <p>What we started seeing is that we're getting SIGPIPEs, with a call stack that looks roughly like this (the top entry is our signal handler):</p>
  
  <pre><code>/.../libos_independent_utilities.so(_ZN2os32smart_synchronous_signal_handlerEiP7siginfoPv+0x9) [0x2b124f7a3989]
  /.../jvm/jre/lib/amd64/server/libjvm.so [0x2aaaab05dc6c]
  /.../jvm/jre/lib/amd64/server/libjvm.so [0x2aaaab05bffb]
  /.../jvm/jre/lib/amd64/server/libjvm.so(JVM_handle_linux_signal+0x718) [0x2aaaab05e878]
  /.../jvm/jre/lib/amd64/server/libjvm.so [0x2aaaab05bf0e]
  /lib64/libpthread.so.0 [0x3c2140e4c0]
  /lib64/libpthread.so.0(send+0x91) [0x3c2140d841]
  /.../jvm/jre/lib/amd64/libnet.so [0x2aaabd360269]
  /.../jvm/jre/lib/amd64/libnet.so(Java_java_net_SocketOutputStream_socketWrite0+0xee) [0x2aaabd35cf4e]
  [0x2aaaaeb3bf7f]
  </code></pre>
  
  <p>It seems like the JVM is deciding that the SIGPIPE that was raised from <code>send</code> should be passed along to our signal hander. Is it right when doing so?</p>
  
  <p>Also, why is the call stack incomplete? I mean obviously it can't show me java code before <code>socketWrite0</code> but why can't I see the stack before the java code?</p>