1

I currently have an issue with my Symfony2 application, using the Doctrine PHPCR bundle. When trying to display a Sonata admin list of posts, we got a segmentation fault:

[Thu Aug 01 12:33:11 2013] [notice] child pid 4239 exit signal Segmentation fault (11)

As we got a lot of posts, we sharded them to have correct performances. This way, our post path are similar to: "/blog/economics/2014/02/10/my-awesome-post". Our nodes are, with their corresponding classes:

|_ Blog (Generic)
    |_ Economics (Section)
        |_ 2014 (Shard)
            |_ 02 (Shard)
               |_ 10 (Shard)
                   |_ my-awesome-post (Post)

My admin list looks like:

/**
 * @param FormMapper $formMapper
 */
protected function configureListFields(ListMapper $listMapper)
{
    $listMapper
        // ...
        ->add('parentTitle', 'string', array('sortable' => true))
        // ...
    ;
}

And now, the two related document method:

/**
 * Return document section name or "/" by default
 *
 * @return string
 */
public function getParentTitle()
{
    $parent = $this->getSectionParent();

    if ($parent instanceof Section) {
        return $parent->getTitle();
    }

    return '/';
}

public function getSectionParent()
{
    $parent = $this->getParent();
    while ($parent instanceof Shard) {
        $parent = $parent->getParent();
    }

    return $parent;
}

After gropping a while, I noticed the segmentation fault occured in one of these two methods. Not sure exactly where. If I return a hard-written string in getParentTitle, all is working fine. Yet, as soon as I am calling the getSectionParent, the segmentation fault occurs.

I tried to debug it with gdb, and here is the most precise stack I found:

Core was generated by `/usr/sbin/apache2 -k start'.
Program terminated with signal 11, Segmentation fault.
#0  zval_mark_grey (pz=0xd0b48751b7bc) at /usr/src/php5/source/php-5.4.25/Zend/zend_gc.c:426
426     /usr/src/php5/source/php-5.4.25/Zend/zend_gc.c: Aucun fichier ou dossier de ce type.

Not sure if all these data are sufficient (I am pretty newbie in segfault debugging).

I tried to Google this message, but I did not find anything concluding. Yet, disabling the garbage collector through a zend.enable_gc = 0 works. However, I won't pass it in production, for memory consumption trivial reasons.

Any idea?

EDIT

After reinstalling from scratch my machine, I still got the issue. Yet, passing from default Debian PHP version (5.4.4) to DotDeb one (5.4.25) solved the issue. However, another segfault appeared, at the same place:

Core was generated by `/usr/sbin/apache2 -k start'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f09371c774b in timelib_timezone_db_data_builtin () from /usr/lib/apache2/modules/libphp5.so

I still need some help. :)

Jonathan Petitcolas
  • 4,254
  • 4
  • 31
  • 42
  • Which PHP version are you using? (Seems you've compiled from source) Have you tried to upgrade PHP? – hek2mgl Feb 10 '14 at 17:43
  • I am using PHP 5.4.25. I also tried with latest PHP 5.5 version available on DotDeb, without success. – Jonathan Petitcolas Feb 10 '14 at 17:56
  • Can you try to run that code on a vanilla ubuntu 12.04, using the distribution's binary packages? (no dotdeb, no self compiled stuff) (Knowing that this will require some effort, but this is what I would do now) – hek2mgl Feb 10 '14 at 18:34
  • I reinstalled on a Debian Wheezy (our production server is on Debian) with vanilla PHP (5.4.4). Same issue. Updating through DotDeb to 5.4.25 lead to another segfault, with `timelib_timezone_db_data_builtin`. Question updated. – Jonathan Petitcolas Feb 11 '14 at 14:52
  • I have the same error about segmentation fault 11, when trying to load data fixtures. It is really weird. The fixtures load perfectly fine for test environment, but not for dev/prod environment. However if I make a simple var_dump(1) inside the loop, there is no segmentation fault thrown by php. – tomazahlin Dec 22 '14 at 14:48
  • 1
    Update: After some more research, I found out that the local database was the problem (it was corrupted and I could not even remove it with mysql itself), so I created a new one. With a fresh database it works well now, without any segmentation error. – tomazahlin Dec 22 '14 at 15:20

0 Answers0