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
Recursive dumping of Doctrine entities can cause an infinite loop #462
Comments
So |
Is the behavior different with enabled and disabled xdebug? |
@dg Isolated I tested turning XDebug on / off and it probably doesn't affect it. The error occurs when I dump within a Doctrine entity a collection that has not yet been fetched from the database and contains only prepared selectors (an anonymous function that is called by an iterator). Unfortunately, I couldn't create a simple sample in pure PHP where it would be easy to see. Previous versions of Tracy did not have this problem. |
For example I use this Doctrine query: /** @var ZakaznikAdresa $za */
$za = $this->entityManager->getRepository(ZakaznikAdresa::class)
->createQueryBuilder('zakaznikAdresa')
->select('zakaznikAdresa, z, e')
->leftJoin('zakaznikAdresa.zakaznik', 'z')
->leftJoin('z.emails', 'e')
->where('zakaznikAdresa.id = :id')
->setParameters([
'id' => 4898,
])
->getQuery()
->getSingleResult();
dump($za);
dump($za->getZakaznik());
dump($za->getZakaznik()->getEmails()); And the last dump that causes a break is in entering comment in this issue. |
Without an example, I can't do anything. Create a repo with an example. Best with sqlite. |
Today I tried to simulate the error for about 2 hours so that I could create a repository with a sample. There really isn't a bug in Tracy. There is no real loop, just Doctrine inside the collection is very complicated and so he doesn't have time to draw the whole dump. When I reduce the default $maxDepth to the original value of 3 (it is now 7), the error stops occurring. What can be solved by not drawing some types of structures to such depth? |
I just started seeing this also although for me, I am seeing the error on line 433(although that might be very relevant with this timeout error). Also, I don't have Doctrine, so definitely not specific to that. |
Can confirm that issue too. It's a performance problem, dumps with DIC are just too big. It can take few minutes but dump is always printed. |
@dg Thanks! |
@janbarasek one forgotten line |
Thanks @dg - that fixes things for me! |
@dg I apologize for the slight delay, I carefully test each change on dozens of different examples and run different auxiliary tests. The dumper is now OK and I did not find any performance issue. Good job! :) |
Version: v2.8.2
Bug Description
Hi, I haven't been able to create a minimal example of this problem, how to simulate this, so a general description must suffice.
When I load an entity from a Doctrine that contains a collection of other entities internally (such as a OneToMany session) and dump that collection (which has not yet fetched data), the dump function often loops and runs out of time, even if it contains the bare minimum of data.
If I increase the timeout to 10 minutes, for example, the dump function will run out after a few minutes, but I couldn't find out exactly where the problem is.
The problem happens to me across projects and I also solved it during the training, when other people asked me about it.
Steps To Reproduce
The minimal example that triggers an infinite loop looks like this:
Expected Behavior
I tried to implement something like ttl that could stop recursion, but it didn't work. If you have a better idea, I will be very happy.
Thanks!
cc @matikara
The text was updated successfully, but these errors were encountered: