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

Race condition when saving Matrix fields #3400

Closed
aghull opened this issue Oct 24, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@aghull
Copy link
Contributor

commented Oct 24, 2018

Description

When saving matrix fieldsets under heavy load, the compiled classes fail to accurately compile the full field set, causing missing property errors.

In Craft\services\Fields#saveField the updateFieldVersion method is called. This method is run for each field in the matrix. The fieldversion is bumped on the first field saved and prevented from being bumped again in the same request:

return;

If a request arrives in craft after the first field is saved but before a brand new field is saved, it caches the compiled ContentBehaviour class with the new fieldversion, but without the new field, preventing the new field from ever appearing in the compiled class.

Removing the line above that prevents multiple fieldversion changes resolves this bug.

Steps to reproduce

  1. Place the site under heavy load
  2. Save a large matrix field with a new field added
  3. Load any front-end Craft page

Additional info

  • Craft version: 3.0.22
  • PHP version: 7.1.17
  • Database driver & version: mysql 5.7.22
@aghull

This comment has been minimized.

Copy link
Contributor Author

commented Oct 24, 2018

brandonkelly added a commit that referenced this issue Oct 24, 2018

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Oct 24, 2018

@aghull Thanks for looking into that and providing the fix. Your PR is merged in for the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.