Question

How can I debug a segmentation fault when running php script with hhvm? When I run it, I get:

Core dumped: Segmentation fault
Segmentation fault

In stacktrace I get that it error when I call a method of the same object.

Is there any code analyzer that might tell me wrong php code or somehow to get more verbose on errors or stack trace?

When I use

    $r = mysql_query($sql, $link); //crashes
    $r = mysql_query($sql); //does not crash
Was it helpful?

Solution

Debug build

To get a better understanding of the crash, you need to build HHVM for debug.

This can be done by adding -DCMAKE_BUILD_TYPE=Debug to your cmake.

More info can be found here: https://github.com/facebook/hhvm/wiki/Reporting-Crashes


Stack trace

You may also find a trace named stacktrace.[number].log in the /tmp directory.

If after inspecting the stack trace you realise that the bug is not on your side, it is best to submit a new issue here: https://github.com/facebook/hhvm/issues


Better logging

Once the issue is not a seg fault, you can get more out of your logging.

Here is how my hhvm.hdf log section looks like.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top