Phalcon causing PHP-FPM crash when getting Relationship for all primary keys greater than 99.

I have spent the past 3 hours or so trying to debug a really odd issue. I wrote the below post seeking answers however prior to posting it I had a further play. I changed absolutely nothing in my code, and did not restart any of my software and all of a sudden everything is working as expected. I am going ahead and posting it anyway on the off chance someone can enlighten me as to what may have caused this issue. I do not want things randomly breaking in production due to this issue.

I am using:

Phalcon 1.3.1 PHP 5.5.11 Nginx 1.4.7 mySQL 5.1.72

Original post

This is the most curious issue I have ever encountered within any framework. I would be extremely appreciative if someone could advise me on a solution.

I wanted to add a controller to delete a row from a particular table/model.

I have a number of controllers for deleting entries from their respective tables so this should have been a case of copy, paste, change some table/column names. Unfortunately it was not.

I have spent a long time debugging the issue - it is as follows.

$town = Town::findFirstById($townId);

$shops = $town->getShop();

If $townId is greater than 99, I get a 404 (because of my nginx settings). My nginx error log shows

2014/07/29 22:33:55 [error] 11589#0: *3485 upstream prematurely closed connection while reading response header from upstream, client:, server:

and my php-fpm log shows

[29-Jul-2014 22:44:46] WARNING: [pool www] child 77839 exited with code 1 after 837.714514 seconds from start

[29-Jul-2014 22:44:46] NOTICE: [pool www] child 77958 started

I.E For this specific model if i try and get the rows of a hasMany relationship using the magic getter it causes php-fpm to explode.

There are alternative ways for me to access this data - direct sql queries for example, however given the nature of the issue I want to find out what is broken.

Any help would be very much appreciated.


Try compiling Phalcon this way:

cd cphalcon/build/safe
sudo make install

I am happy to compile as directed above... but I am curious as to why? What does the above do?



It compiles Phalcon without the march=native compilation flags which sometimes lead gcc to incorrectly choose not compatible/available processor instructions which leads to sefgaults.