Getting phalcon 2.0.x segfaults in a very specific case

Hi all, but mostly Phalcon core developers...

I've been experiencing sporadic phalcon segfaults since early 1.3.x versions:

 kernel: [1642298.160975] php-fpm[28791]: segfault at ffffffef ip 0000000000822ee8 sp 00007ffd9d4f3170 error 4 in php-fpm[400000+ce3000]

They occur more or less regularly in a very specific case when responding with JSON in controller actions:

        $this->response->setJsonContent($response);
        return $this->response;

The problem is that I cannot come up with the code to reproduce the problem from CLI. Not all AJAX/JSON calls fail - only those that are used to transmit data for the client-side component "DataTables".

I am wondering if anyone would be willing to work with me on diagnosing the problem?

Thank you!

edited Jul '16

We don't know anything from this. You need to post gdb backtrace. Check this here - https://bugs.php.net/bugs-generating-backtrace.php

Also it would be good if you would compile php as debug and phalcon too(using zephir build-dev) and then post result from gdb, that would tell much more as well the devs. Also you should post it mostly on phalcon github on issues with gdb backtrace.

Also you know you can do just

return $this->response->setJsonContent($response); ?

Try to lower your recursion limits (PCRE) if your gdb backtrace mentions libpcre somewhere.

http://php.net/manual/en/pcre.configuration.php

I had similar issue, which caused too big recursion with preg_match_all.



30.0k

I've finally compiled php with --enable-debug but cannot seem to generate the core dump file.

I'm on Ubuntu 16.04 and have disabled Apport service. My /proc/sys/kernel/core_pattern has:

core

However, I cannot find it anywhere.

Any suggestions?

Thanks!



30.0k

That's exactly what I've been reading. The problem is that I cannot generate that core file having followed the instructions.

You didn't even followed them - /proc/sys/kernel/core_pattern returns core when it should return actual path pattern to core files.