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 Allocation Error on field settings page after upgrade #580

Closed
myleshyson opened this issue May 18, 2022 · 12 comments
Closed

Memory Allocation Error on field settings page after upgrade #580

myleshyson opened this issue May 18, 2022 · 12 comments
Milestone

Comments

@myleshyson
Copy link
Contributor

Description

I've been trying to debug this the last few days and struggling to figure out what's going on. I upgraded my craft installation to 4.0.2 and neo to 3.0.4. Everything seems to work ok until I go to edit our only neo field. When trying to access the field setting for that neo field, the request hangs up and I eventually get a memory allocation error.

Used Xdebug and found that the problem function seems to be in benf\neo\assets\SettingsAsset:110.

This also happens when trying to create a new neo field. When selecting neo from the field type list, the field setting request just hangs.

We have a particularly large neo field with like 12 block types in it, so that also might be contributing. Though I think it might be something else since it loaded almost instantly in Craft 3.

Steps to reproduce

  1. Upgrade Craft 3 to Craft 4 with an existing neo field
  2. Try to go to that neo fields settings.

Other information

  • Neo version: 3.0.4
  • Craft version: 4.0.2
@lukas-jansen
Copy link

lukas-jansen commented May 18, 2022

I got a likewise performance issue after upgrading from craft 3 to 4, when opening the field settings it takes a really long time to load, if I look in the craft debug toolbar there are a lot of request to get all the new condition rules for the fields (also +12 block types).

On the other side the frontend did have a really big performance improvement on loading times.🎉

@myleshyson
Copy link
Contributor Author

myleshyson commented May 18, 2022

Yea I just upped my ini settings and it after loading for 4-5 minutes it finally rendered. Since the actual hangup happens in here I can't tell yet if this issue is with neo or Craft.

@ttempleton
Copy link
Contributor

There were some changes for the Craft 4 version of Neo so that each block type's field layout designer is individually rendered (previously, we were just rendering an empty field layout designer and populating the existing field layouts in JavaScript). So there is some more work Neo is doing behind the scenes now - that said, taking five minutes to load is somewhat excessive...

Anyway, I've just done a test upgrading to Craft 4 with a Neo field with 15 block types, and didn't experience any errors or performance issues. @myleshyson, @JansenLukas, if you can reliably reproduce this, could one of you please send a database backup and composer.json/lock files to [email protected] and we'll have a look at it.

@thupsi
Copy link

thupsi commented May 23, 2022

I can also confirm that Iexperienced similar issues (very slow loading times for the field edit page). Nothing close to 5 minutes, but still way slower than Craft 3. Front end / entry edit much faster though!

@myleshyson
Copy link
Contributor Author

Opened up an issue in craft core as well since the bottleneck seems to mainly come from their Cp helper class.

@mihob
Copy link

mihob commented May 23, 2022

Same issue here. The neo field editor page is much much slower than in Craft 3

@maxstrebel
Copy link

Can confirm, it consumes huge amounts of memory. There's a main NEO field which has more than 10 blocks and won't load even with 1GB of memory. Don't know if its the helper or NEO

image

image

@ttempleton
Copy link
Contributor

Thanks for sending us an email @myleshyson. I'll keep an eye on the Craft issue for now, in case it turns out there's something Neo-related that needs to be fixed, but at the moment, from what you've posted in the Craft issue, it does look like there are general performance issues with field layout designers. It certainly makes sense that would be more noticeable with Neo fields than anywhere else in Craft.

If there are still performance issues with Neo in particular after any possible improvements are made in Craft, I'll have a look at lazy-loading the field layout designers to improve the initial load times.

@myleshyson
Copy link
Contributor Author

myleshyson commented May 24, 2022

Alright Brandon fixed the performance issue on the craft side with craftcms/cms@d5f405c. Our neo field still loads kinda slow (it takes 7 seconds for me now instead of 600+), but honestly it's more than fine. We have a stupid number of fields so it's somewhat expected to have performance hits here and there. Lazy loading would be a nice to have, but at least for now the plugin is usable again!

@ttempleton
Copy link
Contributor

Great to hear about the performance improvement on Craft's end. I'm still personally not happy with Neo field settings taking 7 seconds to load because of rendering all of the field layout designers, since it should be expected that Neo fields could have many block types with many subfields, and presumably at that point you're not going into the Neo field settings page to edit every block type's field layout at once. So I'll have a look at lazy loading the field layout designers for the Neo 3.1 release.

@ttempleton ttempleton added this to the 3.1.0 milestone May 25, 2022
@ttempleton
Copy link
Contributor

I've added lazy loading of field layout designers in the enhancement/lazy-load-flds branch and it'll be included in Neo 3.1. I'll comment here again when Neo 3.1 is released, it should be later this month.

@ttempleton
Copy link
Contributor

Just released Neo 3.1.0 with the field layout designer lazy loading. Hopefully that's the last of the performance issues with Neo field settings, but please let me know if you're still experiencing any performance issues.

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

No branches or pull requests

6 participants