<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - crash recovery (forking into itself) should be made opt-in, and not be enabled by default"
   href="http://llvm.org/bugs/show_bug.cgi?id=18638">18638</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash recovery (forking into itself) should be made opt-in, and not be enabled by default
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yuri@tsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Currently all clang jobs fork themselves to improve crash recovery and
reporting. While this improves the crash reporting, this has several drawbacks:
* it unnecessarily slows down and complicates successful jobs, that are
(obviously) the vast majority of runs
* it makes profiling, debugging, tracing such process more difficult, since it
would normally require setting special option to follow fork childs. This also
the may trigger some other tool issues related to forks. For example, on
FreeBSD gdb doesn't stop in clang, I suspect because of this. If I were to
profile clang, valgrind would probably stumble on fork as well

Currently crash recovery fork is done by default. And option -cc1 opts out from
it.

My suggestion: make crash recovery opt-in, triggered by CFLAGS, for example
CFLAGS=-crash-recovery. The minority of users who experience crashes would be
able to set this option, and obtain the same crash logs.

On the other note, all unix utilities (grep,awk,etc) potentially have the same
issue: they may crash and may potentially benefit from such forking too. But
this isn't what is normally done. Each program should do one and only one core
thing. And such bells-and-whistles could be made available optionally, but
shouldn't be forced on majority of users.


==== sample crash output ===
clang -c -emit-llvm huge.c
clang: error: unable to execute command: Terminated: 15
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5 (trunk 200186)
Target: x86_64-unknown-freebsd9.2
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.

clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/huge-dbd4d7.c
clang: note: diagnostic msg: /tmp/huge-dbd4d7.sh
clang: note: diagnostic msg: 

********************</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>