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

Memory exhaustion caused by the buildLink method #105

Closed
jonchikly opened this issue May 3, 2017 · 5 comments
Closed

Memory exhaustion caused by the buildLink method #105

jonchikly opened this issue May 3, 2017 · 5 comments
Labels
Milestone

Comments

@jonchikly
Copy link

jonchikly commented May 3, 2017

The code is stuck in what seems to be an infinite loop which causes a memory exhaustion when getting resources from the resource builder.

The issue seems to come from the buildLink method in the ResourceBuilder class (vendor/contentful/contentful/src/Delivery/ResourceBuilder.php)

Commenting out the lines below fix the issue:

            if (isset($rawDataList['entry'][$id]) && $depthCount < 20) {
                $depthCount++;
                return $this->buildEntry($rawDataList['entry'][$id], $rawDataList, $depthCount);
            }

Is there a fix for that?

@realityking realityking added the Bug label May 4, 2017
@realityking
Copy link
Contributor

Thanks for the report @jonchikly. To make it easier to investigate the issue I'd be great if you could send an email to support@contentful.com and include your space ID and API key. Please mention this issue.

I'd also need to know what memory limit is configured in PHP and what query was performed when this happens.

@realityking
Copy link
Contributor

Another user has reported the same issue allowing me to reproduce it. The problem seem to happen with very complex content models (many references) that contain a loop in the response. The $depthCount check was supposed to guard against this but was obviously not sufficient.

It's unlikely that we'll fix this bug this week. If you're affected please revert back to version 0.6.5, that is the newest version not being affected.

@jonchikly
Copy link
Author

Great @realityking. Thank you for your feedback. I am following up on this via email.

realityking added a commit that referenced this issue May 12, 2017
… creates too many objects.

The new behavior is, that any entry that appears multiple times in the graph of the response will be the same instance.

Fixes #105
@realityking realityking added this to the 2.0.0 milestone May 12, 2017
@realityking
Copy link
Contributor

I've created #113 that should fix this issue. I'd be great if you could test if @jonchikly. Thanks you.

realityking added a commit that referenced this issue May 12, 2017
… creates too many objects.

The new behavior is, that any entry that appears multiple times in the graph of the response will be the same instance.

Fixes #105
realityking added a commit that referenced this issue May 18, 2017
… creates too many objects.

The new behavior is, that any entry that appears multiple times in the graph of the response will be the same instance.

Fixes #105
realityking added a commit that referenced this issue May 18, 2017
… creates too many objects.

The new behavior is, that any entry that appears multiple times in the graph of the response will be the same instance.

Fixes #105
realityking added a commit that referenced this issue May 18, 2017
… creates too many objects.

The new behavior is, that any entry that appears multiple times in the graph of the response will be the same instance.

Fixes #105
@jonchikly
Copy link
Author

Thank you @realityking. I will have a look and let you know if anything. Have a good day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants