title: Recording the java stack-trace when a specific system call is made?
body: <p><strong>The Context</strong>: I am working on a Java based network server that accidentally leaks pipes. Every few days it hits its limit of 40,000 file descriptors and dies. Using <code>lsof</code> on the server prior to death shows it is choked with pipes. The pipes connect to itself, rather than another process. </p>
  
  <p>No part of the codebase creates or uses pipes - that we can see. </p>
  
  <p>Some older version of the JVM have created &amp; leaked a pipe when creating a socket, however this exhibits on java 1.7.0_75 which I believe does not suffer that bug.</p>
  
  <p><strong>My question is</strong>: Using the modern Linux toolchain, (such as perf) is it possible to snapshot the process when it calls the <a href="http://man7.org/linux/man-pages/man2/pipe.2.html" rel="noreferrer"><code>pipe(2)</code></a> system call - which I believe is the only way pipes are created. Furthermore, is it possible then to retrieve a Java stack-trace from that?</p>
  
  <p>Given this information it should be possible to answer the question "Who is creating pipes, and why?"</p>