Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with APCu : "ORM TreeListener does not support tree type:" #808

Closed
jdeniau opened this issue Aug 19, 2013 · 7 comments
Closed

Bug with APCu : "ORM TreeListener does not support tree type:" #808

jdeniau opened this issue Aug 19, 2013 · 7 comments

Comments

@jdeniau
Copy link

jdeniau commented Aug 19, 2013

Hello,

First of all thanks for your great extensions.

I have a tree type entity configured with annotation in "nested" tree type.

I activated PHP5.5 APCu extension, and after some time, a weird exceptions is throwned:

ORM TreeListener does not support tree type:

(with nothing after the "type:")

The website works fine some hours and does this after.

If I clear the APCu cache, all works fine for several hours.

Here is the stacktrace :

Stacktrace (most recent call first):

  File "[...]/vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/TreeListener.php", line 84, in getStrategy
    throw new \Gedmo\Exception\InvalidArgumentException($managerName." TreeListener does not support tree type: {$config['strategy']}");
  File "[...]/vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php", line 846, in validate
    return $this->listener->getStrategy($this->_em, $this->getClassMetadata()->name)->getName() === Strategy::NESTED;
  File "[...]/vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity/Repository/AbstractTreeRepository.php", line 52, in __construct
    if (!$this->validate()) {
  File "[...]/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php", line 689, in getRepository
    $repository = new $repositoryClassName($this, $metadata);
  File "[...]/app/cache/prod/jms_diextra/doctrine/EntityManager_520e1bbfadf9e.php", line 180, in getRepository
    $repository = $this->delegate->getRepository($className);
  File "[...]/src/Mapado/ActivityFrontBundle/Controller/ActivityController.php", line 85, in viewAction
    $rubricRepo = $this->getDoctrine()->getManager('rubric')->getRepository('MapadoRubric:Rubric');
  File "[...]/app/bootstrap.php.cache", line 2805, in handleRaw
    $response = call_user_func_array($controller, $arguments);
  File "[...]/app/bootstrap.php.cache", line 2779, in handle
    return $this->handleRaw($request, $type);
  File "[...]/app/bootstrap.php.cache", line 2908, in handle
    $response = parent::handle($request, $type, $catch);
  File "[...]/app/bootstrap.php.cache", line 2210, in handle
    return $this->getHttpKernel()->handle($request, $type, $catch);
  File "[...]/web/app.php", line 22, in null
    $response = $kernel->handle($request);

Do you have some hint that could help me resolve this bug ?

@l3pp4rd
Copy link
Contributor

l3pp4rd commented Aug 19, 2013

hi, it looks like extension metadata cache was emptied for unknown reasons. I tested it before with apc and php 5.3 and it worked perfectly well. Cases are:

  • if doctrine metadata cache gets cleaned or it is regenerated - extension metadata gets regenerated at the same time
  • if extension metadata gets cleaned or invalidated - it also gets regenerated on the first request for metadata.

I cannot know what can cause it. What mapping driver is used for your tree metadata? Annotation, yaml or xml?

@jdeniau
Copy link
Author

jdeniau commented Aug 19, 2013

I use the annotation drive.

Here is my entity class :

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * Rubric
 *
 * @ORM\Table("rubric")
 * @Gedmo\Tree(type="nested")
 * @ORM\Entity
 */
class Rubric
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @Gedmo\TreeLeft
     * @ORM\Column(type="integer")
     */
    private $treeLeft;

    // treeRight, etc.
}

@l3pp4rd
Copy link
Contributor

l3pp4rd commented Aug 19, 2013

How extension listeners are initialized? You use symfony2 or stof bundle or something else? Does it share annotation reader with listeners, like in example or like in symfony2 configuration ?

Try changing it, if it is shared - do not, if it is not - do.

@jdeniau
Copy link
Author

jdeniau commented Aug 19, 2013

Yes I use symfony2 + stof extension bundle.

Apparently, the annotation reader is shared according to this file.

I will try to remove the method call and see if anything changes tomorrow.

@Venzon
Copy link

Venzon commented Aug 19, 2013

I have same issue with PHP5.5 APCu on Ubuntu
This issue is present only with APCu i think
Restarting webserver helps for some time
I was doing some research and problem was with corrupted metadata in apc - instead of ascii chars I noticed some broken chars - maybe its segmentation fault of some kind
Here is my previous issue which is prolly related with this error: https://github.com/l3pp4rd/DoctrineExtensions/issues/796#issuecomment-21926602

@JCMais
Copy link

JCMais commented Feb 9, 2014

For everyone having this issue: krakjoe/apcu#35

@Kezino
Copy link

Kezino commented Aug 18, 2014

+1
PHP 5.5.3, APCu 4.0.1. Suddenly breaks after some time

@jdeniau jdeniau closed this as completed Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants