This issue keeps coming up and it's time to wrap them all up into a single issue so folks have a clear understanding of what's going on. The presenting problem is a FieldException error on install informing you that some Field or another didn't get created because it doesn't exist. Sadly, this is not true - as long as the installer is installing module dependencies in order, the Fields actually do exist but because of a stale cache Drupal doesn't know about them.
What this means is you cannot install a module and its dependency at the same time without risking these errors (particularly this applies to products, orders, and line item). To avoid the problem completely, install the modules iteratively in the order of their dependencies or use the installation profile at http://github.com/rszrama/drupalcommerce.
The fact that this works properly through the installer and not the system modules form is the reason this should be classified as a core bug. During the installer, caches are getting cleared as necessary thanks to the batch process (I presume). The behavior here then is different from what you get when you enable modules via the normal admin interface, and that shouldn't happen.
So, the solutions at a core level would involve changing the nature of that form's submission to be more like the installer or flushing more caches after each module is installed than just the entity cache (the Field cache, for example... or really any cache that contains module defined information).
For the sake of Drupal Commerce, in our install-time functions that depend on Fields from other modules, I have a working solution - I just can't commit it / make a patch immediately because it involves files that I have w.i.p. code in. :-/ Basically, if I know a Field should exist by virtue of a module's dependencies and it does not exist, I'm flushing the Field cache prior to creating the new Field. This is poor, though, in that it will result in the Field cache being cleared and rebuild at unnecessary times, but it's better than fielding a new FieldException issue every few days. The real fix should be in core.
For more information, see the stalled core issue: #727876: Enabling modules one at a time works differently than enabling them all at once
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 906668.field_cache_clear.patch | 3.11 KB | rszrama |
Comments
Comment #1
rszrama commentedUgh, the installation profile is actually at http://github.com/rszrama/commercedev. :-/
Comment #2
rszrama commentedAnd here's the patch.
Comment #3
Anonymous (not verified) commentedSubscribing.
As a note for any Drush users out there, until this issue is resolved, here are the two separate Drush commands I am using to work around this issue (after Drupal commerce and it's dependencies have been downloaded).
Also, here is ksenzee's thoughts on the drupal core bug that rszrama linked to http://drupalbin.com/15984
I'll test out the patch later today.
Comment #4
Anonymous (not verified) commentedTesting out the patch.
I just disabled all of the modules and then enabled them all (using Drush). And the same errors came back
Should I have uninstalled them as well?
Any idea how to trace this?
Comment #5
Anonymous (not verified) commentedSame FieldException error when I do it from the
Was this patch targeted at people who were installing Commerce for the first time?
Comment #6
Anonymous (not verified) commentedComment #7
rszrama commentedAhh, yeah, it was targeting first time installs, but it really should work for anything. You're actually getting different errors that I'm guessing should be in a separate issue... it's attempting to recreate a field that already exists.
Comment #8
Anonymous (not verified) commentedI just tried this on a clean database and got:
*shrug*
Maybe there are two different problems here. Ksenzee mentioned a workaround for the problems with hook_modules_enabled() (which line item does use).
Maybe we could try that workaround?
Comment #9
pieterdcUsing yesterday's version of all required code (Sept. 27th) and the commerce installation profile; my installation worked just fine.
But that's probably not what you're testing here?
Just saying cuz I'm trying to help.
Comment #10
rszrama commentedYeah, it's actually always worked w/ the installation profile - doesn't seem to like the normal module enabling process, though. I think the difference is the Batch API is used in the installer to install one module at a time on separate page requests... dunno if I researched that fully or not, though.
Comment #11
rszrama commentedFor what it's worth, #931190: Enabling modules via the UI breaks module dependencies might have solved this issue. We'll know once we update to the first D7 beta.
Comment #12
rszrama commentedOk, I can't reproduce the bugs we'd been having on D7-beta1, and I'm not seeing FieldException errors anywhere. I'm going to mark this fixed thanks to core, but we can reopen if necessary.
Comment #13
mertskeli commentedI'm keeping it as fixed although I had all the possible errors while installing today.
Honestly, I do not understand how this module is going to be used for any commercial site.
I have been installing DC for half a year already, and it never installs. Never. Maybe I'm stupid?
Drupal, Views, Entity, Rules, Address are fine - no errors.
Enabling all DC checkmarks at once - WSOD, finita la comedia.
Comment #14
rszrama commentedWSOD sounds like you need to up your PHP memory limit. As for how the modules will be used, I've never had a problem with the errors and the workarounds to core Drupal behavior are fully documented. Have you still not tried the installation profile, http://github.com/rszrama/commercedev?
Comment #15
mertskeli commentedMemory is sufficient. It's a local install anyway. Numerous errors followed by Drupal's death - no interfave, only error messages. Wsod was a wrong word.
No, I haven't tried the installation profile, and I do not expect everybody will :)
Comment #16
rszrama commentedCertainly, the modules stand on their own two feet, but I've never had a problem with the profile - I recommend it for alpha testing, as it avoids the common installation problems of Drupal itself. That said, I did test a Commerce install by using the Standard installation profile w/ D7-beta1 and then just checking boxes by the UI modules for Drupal Commerce. The dependencies were installed and everything was configured just fine with no errors. Without error messages, there's not much I can do to help... other than to say start using that profile. I've been recommending it for months. : P
Comment #17
mertskeli commentedOk, I'll try to use that profile...
rszrama, your increadible humanity keeps my belief in DC alive :)
Comment #18
rszrama commentedhehe Thanks for the vote of confidence - and sorry for being short in my comments above. If you do turn up error messages, though, please post an issue for them. I definitely want the stuff to be usable without an installation profile. ; )
Comment #20
stephthegeek commentedJust for anyone searching... I ran into this error but enabling modules just a couple at a time seemed to fix it.
Comment #21
gargsuchi commentedPlease refer to http://drupal.org/node/867118#comment-3400616
I had the same issue today - with the following install:
drupal-7.0.tar.gz
addressfield-7.x-1.0-alpha1.tar.gz
schema-6.x-1.7.tar.gz
commerce-7.x-1.0-alpha4.tar.gz
entity-7.x-1.0-beta6.tar.gz
views-7.x-3.0-alpha1.tar.gz
ctools-7.x-1.0-alpha2.tar.gz
rules-7.x-2.0-alpha4.tar.gz
But if i enable views/ rules/ ctools etc. BEFORE enabling commerce module and it's sub-modules, I was able to install without any errors.
Thx
Suchi Garg
Comment #22
blup commentedNew branch with working changes. https://github.com/blup/drupalcommerce/tree/906668
Comment #23
rszrama commentedComment #24
rszrama commentedReviewed by recidive, committed by me.