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

Huge memory consumption in v2 #57

Open
Axel29 opened this issue Aug 9, 2022 · 3 comments
Open

Huge memory consumption in v2 #57

Axel29 opened this issue Aug 9, 2022 · 3 comments

Comments

@Axel29
Copy link

Axel29 commented Aug 9, 2022

Preconditions (*)

  1. Version 2.x

Steps to reproduce (*)

  1. Instanciate a \Storyblok\Client object
  2. Call the "resolveLinks" method with the "story" parameter passed to it
  3. Call the "resolveRelations" method and add some relations to the client
  4. Call the "getStoryByUuid" method to fetch a story by its UUID
  5. Watch your RAM while the whole process is running

Expected result (*)

  1. The query is made with no issue and the RAM isn't consumed more than it should

Actual result (*)

  1. The RAM decreases until it is completely consumed by the process
  2. The process gets killed

Explanation

The bug seems to have appeared in the commit #adb52f212e5f3ff38457ea4c7781a85f9f99e460 after adding the calls to the enrichStory method in the responseHandler method.

When I put a dump() in the enrichContent method, it parses way more data than when the resolveRelations method isn't called.

@joaokamun
Copy link
Contributor

@Axel29 can you give me some more info? which php version, operating system, how many links and relations?

@Axel29
Copy link
Author

Axel29 commented Aug 9, 2022

@Axel29 can you give me some more info? which php version, operating system, how many links and relations?

Hello @joaokamun , I'm using PHP 7.4, on Docker (images from Magento Cloud Docker) thus on Linux, and only 2 relations added to the resolveRelations() method.

@roberto-butti
Copy link
Collaborator

Hey @Axel29 did you still have the issue with the latest version? After the commit you mentioned we refactored and improved the resolve relation mechanism under the hood.

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

3 participants