doublesecretagency / craft-cpcss

Control Panel CSS plugin for Craft CMS
MIT License
117 stars 8 forks source link

Invalid CSS causes memory leak and CP becomes inaccessible #12

Closed chasegiunta closed 4 years ago

chasegiunta commented 4 years ago

So, for funsies, go ahead and place this within the "additional CSS" field...

#details-container {
  flex: 0 0 200px;
  width: 200px;

Doing so will cause the control panel to become completely inaccessible you'll hit your max memory limit pretty fast. Why? I have no idea. The settings are saved in the project config, so some weird parse or escaping issue could be the cause. I'm unsure, but it may be worth doing some sort of syntax checker before save.

To get the control to be unbroken you'll need to go into your projectconfig table in your database, find the row with the plugins.cp-css.settings.additionalCss path, and clear it out to "". Then, you can run the ./craft clear-caches/all.

lindseydiloreto commented 4 years ago

What the actual... ? That is utterly peculiar. 🤔

Though honestly... isn't that really a Craft bug? CP CSS is just saving a normal setting, it's Craft that's jamming it into the project config.

We might want to run this by someone at P&T before we dig too much further.

chasegiunta commented 4 years ago

@lindseydiloreto Maybe, but I'm unsure if it's actually the project config that's causing the issue, displaying of the css, or something in between.

You'd think if it was a project config issue, even the frontend wouldn't load, but the frontend loads just fine. It's only the Control Panel where the memory leak happens. That could be because it's only the control panel where that setting is being read...? I'll raise it in an issue within the cms repo.

lindseydiloreto commented 4 years ago
Allowed memory size of 2147483648 bytes exhausted (tried to allocate 167772176 bytes)

Something is definitely getting caught in a loop.

lindseydiloreto commented 4 years ago

It looks like this can be traced back to a minification plugin that Craft is using. We can consolidate this into the related Craft CMS thread, since the issue is more likely to be on that side.

lindseydiloreto commented 4 years ago

Per Brandon Kelly, this is fixed for the next release of Craft...

https://github.com/craftcms/cms/issues/5912#issuecomment-613569294