-2

I have written a piece of code which is crashing Apache process. I would like to know if there is any way I can get any helpful information logged anywhere or if there is any way at all I can investigate what happened?

The code which is crashing:

$mysqli = new mysqli($host, $user, $pass, $db);
$stmtQuery = $mysqli->prepare("SELECT ?, 'name'");
$stmtQuery->bind_result($id, $name);

$stmtQuery->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
$stmtQuery->bind_param('i', $i);
$stmtQuery->execute();
$stmtQuery->get_result()->fetch_assoc();

There is nothing in PHP error_log.
In Apache error_log all I see is:

[mpm_winnt:notice] [pid 8212:tid 652] AH00428: Parent: child process 20232 exited with status 3221225477 -- Restarting.

I don't know what this status means, and I am looking for more insightful crash report.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • You could use Blackfire. Its an debugger tool which can help you identify this. – paskl Jul 29 '19 at 23:01
  • Have you seen this? https://stackoverflow.com/questions/1138269/apache-error-notice-parent-child-process-exited-with-status-3221225477-res – Don't Panic Jul 29 '19 at 23:50
  • 1
    Yes, that was the first google result. The solution says to increase stack size of Apache process, but if I triggered seg fault in PHP I would like to know why it happened. I was hoping that Apache would save some crash logs somewhere, but I can't find any. – Dharman Jul 29 '19 at 23:53
  • I was reading through a few results here and it the "fixes" people suggest for it vary pretty wildly. I haven't found anything yet about how to properly diagnose the reason for the crash, which I agree seems much more useful. – Don't Panic Jul 29 '19 at 23:58
  • Wow, there are tons of Q&A about this. I'm surprised I've never encountered it yet. – Don't Panic Jul 30 '19 at 00:01

1 Answers1

0

Think what you're looking for is strace:

strace -f $(pidof php5-fpm | sed 's/\([0-9]*\)/\-p \1/g')

Source: Debugging Stuck PHP-FPM Process With Strace

MPM worker & prefork might have different process names.

This would show the threading model: httpd -V | grep MPM

It might be a duplicate question; also this one seems related ...


It crashes because the value of ThreadStackSize had been exceeded -

likely caused due to cluelessly attempting to allocate a cursor window ...

mod_mysqli is at fault and the thread is being killed for the sake of stability.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216