<table><tr><td style="">rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D14606">View Revision</a></tr></table><br /><div><div><p>Actually, it's even worse than that: I didn't double-check my assumptions about the use of DrKonqi's return/exit code. Looking at the code again there is actually no way that information is even obtained. The <tt style="background: #ebebeb; font-size: 13px;">startProcess</tt> function simply starts DrKonqi and then waits for it to exit if so instructed; the only information obtained about the crashreporter is its PID.</p>

<p>And indeed, DrKonqi exits with 0 for me too when I cancel/close it.</p>

<p>In a way this is worse not just because my brain was cooked yesterday. It means we're getting different behaviour inside KCrash: the value of <tt style="background: #ebebeb; font-size: 13px;">crashRecursionCounter</tt>. And I'm back to not understanding how that's possible. I don't see how <tt style="background: #ebebeb; font-size: 13px;">crashRecursionCounter</tt> could ever be <tt style="background: #ebebeb; font-size: 13px;">>2</tt> unless you attempt to restart the crashed application. But that also doesn't work for me: it starts a new application = new PID = <tt style="background: #ebebeb; font-size: 13px;">crashRecursionCounter</tt> never increases.</p>

<p>That counter gets set to 2 here:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if (crashRecursionCounter < 2) {
    if (s_emergencySaveFunction) {
        s_emergencySaveFunction(sig);
    }
    if ((s_flags & AutoRestart) && s_autoRestartCommand) {
        QThread::sleep(1);
        startProcess(s_autoRestartArgc, const_cast<const char **>(s_autoRestartCommandLine), false);
    }
    crashRecursionCounter++;
}</pre></div>

<p>A bit strange that the counter would always be increased and not only when there has been an auto-restart attempt, but let's ignore that for now.</p>

<p>I see no other places where the counter is increased, so apparently the code assumes that the function itself can be called multiple times. But how? I see only 2 possibilities:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">When the application receives an additional signal that is connected to the <tt style="background: #ebebeb; font-size: 13px;">defaultCrashHandler()</tt> function</li>
<li class="remarkup-list-item">When the application is restarted without changing its PID and without re-initialising all its static variables - is that even possible (after a fatal exception)?</li>
</ul>

<p>In other words, how do you get the <tt style="background: #ebebeb; font-size: 13px;">crashRecursionCounter >= 4</tt> required for not printing the unable-to-start warning?</p>

<p>Answer: you never get to that check:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if (!s_coreConfig->isProcess()) {
    // Only exit if we don't forward to core dumps
    _exit(253);
}</pre></div>

<p>On my system:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">%> cat /proc/sys/kernel/core_pattern
|/usr/share/apport/apport %p %s %c %P</pre></div>

<p>Q.E.D. ...</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R285 KCrash</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D14606">https://phabricator.kde.org/D14606</a></div></div><br /><div><strong>To: </strong>rjvbb, Frameworks, sitter<br /><strong>Cc: </strong>dfaure, kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>