Hi
I´m getting issues during updates due to the modules classes living in the .module files (see #1187074: Document that extending/implementing classes can not be safely placed in .module files )

To solved a patch was created to move them into .inc files referenced in the .info file

Best regards

Files: 
CommentFileSizeAuthor
#59 entitycache_fix_upgrade_path-2441965-59.patch784 bytesmarie.pinet
#52 entitycache_fix_upgrade_path-2441965-52.patch696 bytesizus
#42 entitycache_fix_upgrade_path-2441965-42.patch1.1 KBЕлин Й.
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
#40 entitycache_fix_upgrade_path-2441965-40.patch1.07 KBЕлин Й.
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
#39 entitycache_fix_upgrade_path-2441965-39.patch1.04 KBЕлин Й.
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
#36 entitycache_fix_upgrade_path-2441965-36.patch762 bytesЕлин Й.
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
#18 entitycache_fix_upgrade_path-2441965-18.patch397 bytesDuaelFr
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
#15 interdiff.txt511 bytesjoelpittet
#15 broken_updates_due_to-2441965-15.patch26.59 KBjoelpittet
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
#13 broken_updates_due_to-2441965-13.patch26.57 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: run-tests.sh reported no tests were found. See review log for details.. View
#11 entitycache-2441965-11.patch19.7 KBvijaycs85
FAILED: [[SimpleTest]]: [MySQL] 2,377 pass(es), 1,175 fail(s), and 442 exception(s). View
#4 broken_updates_due_to-2441965-4.patch18.63 KBlord_of_freaks
PASSED: [[SimpleTest]]: [MySQL] 5,839 pass(es). View
#2 broken_updates_due_to-2441965-2.patch18.63 KBlord_of_freaks
PASSED: [[SimpleTest]]: [MySQL] 5,839 pass(es). View
#1 broken_updates_due_to-2441965-1.patch18.56 KBlord_of_freaks
PASSED: [[SimpleTest]]: [MySQL] 5,839 pass(es). View

Comments

lord_of_freaks’s picture

FileSize
18.56 KB
PASSED: [[SimpleTest]]: [MySQL] 5,839 pass(es). View

Adding patch

lord_of_freaks’s picture

Status: Active » Needs review
FileSize
18.63 KB
PASSED: [[SimpleTest]]: [MySQL] 5,839 pass(es). View

Sorry the patch was wrong and assumes that EntityCacheControllerHelper is moved incorrectly

malcomio’s picture

+++ b/entitycache.file.inc
@@ -0,0 +1,19 @@
+ * file entity controller with persistent cache.

Does this really relate to file entities?

+++ b/entitycache.defaultentitycontroller.inc
@@ -0,0 +1,19 @@
+ * file entity controller with persistent cache.

I think the confusing part is talking about "file entity controller" in the @file comment - surely that should just be "Entity controller"

lord_of_freaks’s picture

FileSize
18.63 KB
PASSED: [[SimpleTest]]: [MySQL] 5,839 pass(es). View

@malcomio you are right!!!
Re-rolling the patch by the comments of #3

tsphethean’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, and works for me.

tsphethean’s picture

Status: Reviewed & tested by the community » Needs work
tsphethean’s picture

Status: Needs work » Reviewed & tested by the community
Jaesin’s picture

+1 for best practice.

If you apply this patch to a site, you should use Registry Rebuild to rebuild your cache.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs re-roll

Needs a re-roll.

catch’s picture

Priority: Normal » Critical
vijaycs85’s picture

Status: Needs work » Needs review
Issue tags: -Needs re-roll
FileSize
19.7 KB
FAILED: [[SimpleTest]]: [MySQL] 2,377 pass(es), 1,175 fail(s), and 442 exception(s). View

Rerolling

Status: Needs review » Needs work

The last submitted patch, 11: entitycache-2441965-11.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
26.57 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: run-tests.sh reported no tests were found. See review log for details.. View

entitycache_flush_caches() somehow snuck out of the *.module file. So I moved it back.

Also I moved things into an includes/ folder and remove unnessasary file[]'s in the info.

Let's do another re-roll here.

Status: Needs review » Needs work

The last submitted patch, 13: broken_updates_due_to-2441965-13.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
26.59 KB
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View
511 bytes

Whoops, shouldn't have removed *.test from info I guess.

  • catch committed c61cecf on 7.x-1.x authored by joelpittet
    Issue #2441965 by lord_of_freaks, joelpittet, vijaycs85: Broken updates...
catch’s picture

Status: Needs review » Fixed

Committed/pushed to 7.x-1.x, thanks!

DuaelFr’s picture

Status: Fixed » Needs review
FileSize
397 bytes
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View

That fix breaks the upgrade path because Drupal does not find the cache classes anymore.
We need to implement a hook_update_N to rebuild the registry. See the attached patch.

$ drush upc entitycache
Update information last refreshed: Tue, 27/10/2015 - 00:04
 Name                        Installed Version  Proposed version  Message          
 Entity cache (entitycache)  7.x-1.2            7.x-1.4           Update available 


Code updates will be made to the following projects: Entity cache [entitycache-7.x-1.4]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n): y
Project entitycache was updated successfully. Installed version is now 7.x-1.4.
Backups were saved into the directory                                                                      [ok]
./drush-backups/terraludis_shop/20151026230521/modules/entitycache.
PHP Fatal error:  Class 'EntityCacheUserController' not found in /includes/common.inc on line 7998
Drush command terminated abnormally due to an unrecoverable error.                                         [error]
Error: Class 'EntityCacheUserController' not found in
/includes/common.inc, line 7998
Drush was not able to start (bootstrap) Drupal.                                                            [error]
Hint: This error can only occur once the database connection has already been successfully initiated,
therefore this error generally points to a site configuration issue, and not a problem connecting to the
database.
joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

That seems like a reasonable hook to put in for this, thanks @DuaelFr

catch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed/pushed to 7.x-1.x.

  • catch committed 4b64943 on 7.x-1.x authored by DuaelFr
    Issue #2441965 by lord_of_freaks, joelpittet, vijaycs85, DuaelFr: Broken...
MustangGB’s picture

Status: Fixed » Needs work

I just ran a drush update from 7.x-1.2 to 7.x-1.5 and hit the same error as #18.

Frank.dev’s picture

same

catch’s picture

That might not be fixable in hook_update_N().

What happens if you try a drush rr -y && drush updb -y?

MustangGB’s picture

@catch No change, it still hits a php fatal for each drush command and when visiting the site in a browser.

EDIT: Actually my drush install doesn't have a registry rebuild command, investigating.

DuaelFr’s picture

With the above patch I had to do:
$ drush dl entitycache -y
$ drush updb -y

The first one could throw an error if you already tried to upgrade. If it's your case you'll have to manually downgrade entitycache code to 1.2.

catch’s picture

Status: Needs work » Fixed

Added a note to release notes, I'm not sure if there's anything else can be done for this. Better to break once now than on-and-off forever.

MustangGB’s picture

@DuaelFr Still didn't work unfortunately.

@catch Okay so drush rr did work, just needed to install it.

joelpittet’s picture

I wonder if something like APC/Opcache or something like that is holding on to the location in PHP. But it sounds just that the registry didn't want to let go of the old one.

catch’s picture

It could be something in hook_init() or similar trying to load a user, so could also be more or less broken depending on contrib/custom modules.

kevster’s picture

I just ran drush rr and then updatedb and it did run the updates ok - jumping from 7.1.1 to 7.1.5 ...

TechnoTim2010’s picture

Related issues: +#2599174: Entity Cache Error

I just tried to update from 7.1.2 to 7.1.5 and got lots of errors
initially
PHP Fatal error: Class 'EntityCacheNodeController' not found in /var/www/includ es/common.inc on line 7998
PHP Stack trace:
PHP 1. {main}() /usr/share/php/drush/drush.php:0
PHP 2. drush_main() /usr/share/php/drush/drush.php:16
PHP 3. _drush_bootstrap_and_dispatch() /usr/share/php/drush/drush.
PHP 4. drush_bootstrap_to_phase() /usr/share/php/drush/drush.php:8
PHP 5. drush_bootstrap_max() /usr/share/php/drush/includes/bootstr
PHP 6. drush_bootstrap() /usr/share/php/drush/includes/bootstrap.i
PHP 7. _drush_bootstrap_drupal_full() /usr/share/php/drush/include inc:185
PHP 8. drupal_bootstrap() /usr/share/php/drush/includes/bootstrap.
PHP 9. _drupal_bootstrap_full() /var/www/includes/bootstrap.inc:22
PHP 10. drupal_path_initialize() /var/www/includes/common.inc:5246
PHP 11. drupal_get_normal_path() /var/www/includes/path.inc:21
PHP 12. subpathauto_url_inbound_alter() /var/www/includes/path.inc:
PHP 13. menu_get_item() /var/www/sites/all/modules/subpathauto/subp le:25
PHP 14. _menu_translate() /var/www/includes/menu.inc:482
PHP 15. _menu_load_objects() /var/www/includes/menu.inc:771
PHP 16. node_load() /var/www/includes/menu.inc:603
PHP 17. node_load_multiple() /var/www/modules/node/node.module:966
PHP 18. entity_load() /var/www/modules/node/node.module:947
PHP 19. entity_get_controller() /var/www/includes/common.inc:7962
Drush command terminated abnormally due to an unrecoverable error.
Error: Class 'EntityCacheNodeController' not found in
/var/www/includes/common.inc, line 7998

then when reverted back to 7.1.2 still get when running drush cc all
WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.sort_order' in 'field list': [error]
SELECT base.discount_id AS discount_id, base.name AS name, base.label AS label, base.type AS type, base.status AS
status, base.export_status AS export_status, base.module AS module, base.component_title AS component_title,
base.sort_order AS sort_order
FROM
{commerce_discount} base
WHERE (base.export_status IN (:db_condition_placeholder_0, :db_condition_placeholder_1,
:db_condition_placeholder_2)) ; Array
(
[:db_condition_placeholder_0] => 3
[:db_condition_placeholder_1] => 2
[:db_condition_placeholder_2] => 6
)
in EntityAPIController->query() (line 187 of /var/www/sites/all/modules/entity/includes/entity.controller.inc).
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.sort_order' in 'field list': SELECT base.discount_id AS discount_id, base.name AS name, base.label AS label, base.type AS type, base.status AS status, base.export_status AS export_status, base.module AS module, base.component_title AS component_title, base.sort_order AS sort_order
FROM
{commerce_discount} base
WHERE (base.export_status IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array
(
[:db_condition_placeholder_0] => 3
[:db_condition_placeholder_1] => 2
[:db_condition_placeholder_2] => 6
)
in EntityAPIController->query() (line 187 of /var/www/sites/all/modules/entity/includes/entity.controller.inc).
Drush command terminated abnormally due to an unrecoverable error.

joelpittet’s picture

@TechnoTim2010 the second message is related to a commerce_discount update not this. And as the others reported above, please try drush rr with registry_rebuild

Drupal doesn't like files moving or databases changing much.

TechnoTim2010’s picture

I did a registry rebuild and indeed the errors disappeared.

So do I have this right, if I update from 7.1.2 to 7.1.5 then run drush rr and drush updb it shouldnt cause the fatal error and resultant WSOD on the site?

MustangGB’s picture

@TechnoTim2010
Correct, it's worked for me.

Елин Й.’s picture

Assigned: Unassigned » Елин Й.
Status: Fixed » Needs review
FileSize
762 bytes
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View

This commit effectively breaks existing projects making them unusable. It is impossible to update from 7.x-1.2 to newer versions. You cannot suppose that every user has drush and registry rebuild module installed on every environment(!) for every project.

The right way for such updates is to increase the major version number, not the minor one, since an upgrade from older versions is not possible. So the module version should have to be 7.x-2.0.

However, I've fixed this update with a simple workaround, making this update backwards compatible, so it is safe to name the versions furthermore 7.x-1.x

Please review my patch and commit it as soon as possible if it is ok, so that no more sites will be broken.

catch’s picture

Status: Needs review » Needs work

Please add a comment explaining the need for the workaround to the patch.

I don't love having to workaround what is actually a core bug, but given no registry rebuild in core yet, seems reasonable to add this.

Frankly if you don't have command line access to your site, you probably shouldn't be using this module - it's a pure-performance module that's only really effective when using memcache as a cache backend, and says as much on the project page.

I think the best option here would be to commit the workaround, then open a 7.x-2.x branch with the workaround removed, and a note that people should update to the latest 7.x-1.x before moving to 2.x - but let's add comments to explain what's happening.

Елин Й.’s picture

@catch

Thanks for the review. I'll create new patch with some comments explaining the need for this workaround.

I do have command line access to my site on all environments, but one of my clients doesn't. It is not uncommon that developers deliver the code base and the clients or their site admins just run the update.php to get the new code base updated, which is the case on one of our projects.

They cannot simply tell them to install Drush and Registry Rebuild, since they're not Drupal-savvy nor they are comfortable with command line.

The updated patch follows in a few minutes.

Елин Й.’s picture

Status: Needs work » Needs review
FileSize
1.04 KB
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View

Here is the updated patch with a comment explaining why this workaround was necessary. Please check for the grammatically correctness as well, since English is not my first language.

Елин Й.’s picture

FileSize
1.07 KB
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View

I've found an internal drupal function to check if a class is available to the autoloader drupal_autoload_class(). I think it makes more sense to use this one, instead of class_exists().

I've atteched an updated patch. Please review.

catch’s picture

Status: Needs review » Needs work

No class_exists() is better.

Should use require_once() + __DIR__ for the actual include to save lstat calls.

Елин Й.’s picture

Status: Needs work » Needs review
FileSize
1.1 KB
PASSED: [[SimpleTest]]: [MySQL] 6,403 pass(es). View

Updated patch. Used require_once instead of include(), and added __DIR__.

johnv’s picture

Please consider testing for PHP 5.2 , which is still alive.
See #2619270: Parse error: syntax error, unexpected T_STATIC

  • catch committed b9b9865 on 7.x-1.x authored by pc-wurm
    Issue #2441965 by pc-wurm, lord_of_freaks, joelpittet, DuaelFr,...
catch’s picture

Status: Needs review » Reviewed & tested by the community

Committed/pushed to 7.x-1.x.

I'll leave this, and https://www.drupal.org/node/2619270 in dev for a week or so, then tag 7.x-1.6 with those two change.

Then if that's OK, tag 7.x-2.0 with this workaround removed.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hockey2112’s picture

The latest patch fixed the issue for me. Thanks!

RunePhilosof’s picture

Even with this patch, I couldn't get drush rr to complete.
I needed to disable the module, upgrade the files, then enable the module again.

Insasse’s picture

#49 -> did the trick for me

Insasse’s picture

Update to 7.x-1.5 throws PHP Fatal error: Class 'EntityCacheUserController' not found in /includes/common.inc on line 7998 -> patch #42 solved it

Upgrade to dev solved it also , so i use dev now.

izus’s picture

Assigned: Елин Й. » Unassigned
Status: Closed (fixed) » Needs review
FileSize
696 bytes

Hi,
the patch merged in #42 is very helpful. i found that 3 cases were not handled yet : EntityCacheTaxonomyTermController, EntityCacheTaxonomyVocabularyController and EntityCacheCommentController

Here is a patch for that

Thanks

Status: Needs review » Needs work

The last submitted patch, 52: entitycache_fix_upgrade_path-2441965-52.patch, failed testing.

The last submitted patch, 52: entitycache_fix_upgrade_path-2441965-52.patch, failed testing.

rpsu’s picture

I suggest a warning in README.txt and in module's page as this change will break some automated updates due to classes living now in a different place.

This namely happens with Barracuda & Octopus -environment. One must uninstall module, do the upgrade (move site to another platform) and then re-enable the module again.

ytsurk’s picture

thanks. patch #42 solved the issue for me having a WSOD during update.

arsn’s picture

Hello,

Thank you everyone for patching this issue. If I ignore the taxonomy issues applying only patch 42, caches are flushing all right but I get a fatal error whenever I try to update a taxonomy entity.

Fatal error: Class 'EntityCacheTaxonomyTermController' not found in www/includes/common.inc on line 8026

If I add Izus' patch (52) after Елин Й.'s (42) as it seems designed, I get a drush fatal error when flushing caches, which is necessary in our process, and I just cannot 'make' my drupal app:

include_once(): Failed opening                                                        [warning]
'www/sites/all/modules/contrib/entitycache/entitycache.comment.inc'
for inclusion (include_path='.:/usr/share/php:/usr/share/pear') bootstrap.inc:3479
PHP Fatal error:  Class 'CommentController' not found in www/sites/all/modules/contrib/entitycache/includes/entitycache.comment.inc on line 11
Drush command terminated abnormally due to an unrecoverable error.                    [error]

The patches are properly applied with a drush make command.

I am surprised to get this error since the patch 42 is supposed to workaround the issue and indeed has not thrown any error when flushing cache while the only one applied.

I am wondering why Izus 52's patch does not include Елин Й. 42's patch code, which may have let it pass the tests by the way.

Rerolling both patch together could help? Any other hint?

Thank you

MustangGB’s picture

I am wondering why Izus 52's patch does not include Елин Й. 42's patch code, which may have let it pass the tests by the way.

Because patches are rolled against dev and #42 has already been committed.

Of course there hasn't been a stable release with this in yet, which is probably what you're noticing.

marie.pinet’s picture

Status: Needs work » Needs review
FileSize
784 bytes

Hi,

I have a problem on my website with the patch from comment #52, because, on my website, the comment module is disabled.
I have added module_exists for comment and taxonomy modules.

Thanks for the review.