Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arrubiu’s picture

Hi!
As asked here, the schema_version in system tabel is 7204

davisben’s picture

This sounds like the same problem knalstaaf was having in the other issue. Running update.php again seemed to fix it for him, but there is an underlying error causing this. Do you have a lot of nodes? It may be that weight_update_7205 is taking too long to run.

arrubiu’s picture

Yes, many nodes.. 12000 :(
The weight is active only in one content type

davisben’s picture

I'm going to convert that function to use Batch API, shouldn't take long.

davisben’s picture

Status: Active » Fixed

Fixed and committed. I found a couple other small bugs in the update functions, but everything should be working now.

artis’s picture

Status: Fixed » Needs work

I'm having this issue also and I have 2 nodes on the entire site.

Is RC1 the fixed release or dev?

davisben’s picture

Status: Needs work » Fixed

This fix is in rc1.

artis’s picture

I still had issues with this error when upgrading to RC1.

davisben’s picture

There was another similar error that was fixed after the rc1 release, it may be related to that. Could you post your error message?

artis’s picture

This is what I get. Just tried the update from beta3 to r1 on a different site and got the same thing:

Error message
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '515871_trfsd7.weight_weights' doesn't exist: SELECT weight FROM {weight_weights} WHERE entity_id=:id AND entity_type=:type; Array ( [:id] => 2 [:type] => node ) in _weight_get_weight() (line 381 of /sites/all/modules/weight/weight.module).
The website encountered an unexpected error. Please try again later.

davisben’s picture

Does the error occur while running update.php, or during use of the site?

artis’s picture

That's the error that shows up when I got to update.php. But the rest of the site is broken with this error:

Error
The website encountered an unexpected error. Please try again later.

davisben’s picture

Status: Fixed » Active

Could you check the schema_version field for Weight in your system table? The weight_weights table is created in 7205. #1515122: Update hangs at 7206 was recently fixed and will be in the next dev release. This could be related to that.

artis’s picture

Status: Active » Fixed

The schema_version is 7204.

davisben’s picture

I would wait until the next dev release is packaged, or grab it from git, and attempt to run update.php again. If that fails you could check your error log to see if that provides any helpful info as to what is causing the update to fail.

artis’s picture

Status: Fixed » Active

I just tried the latest dev and still receive the same error.

davisben’s picture

Could you take a look at your servers error logs to see if there is anything there that could help pinpoint the error?

artis’s picture

This is what the apache error log says:

[Mon Apr 02 09:45:09 2012] [warn] mod_fcgid: stderr: PHP Fatal error: Call to undefined function _weight_get_types() in /home/d7/public_html/sites/all/modules/weight/weight.install on line 199

davisben’s picture

Status: Active » Fixed

I removed all calls to the modules functions from the install file, which should fix this error and allow update.php to run.

artis’s picture

So, this change will be in the next dev release?

davisben’s picture

It will indeed, or you can grab it from git now.

artis’s picture

Status: Fixed » Active

I just tried to update from beta3 to rc2 and got the same error from comment #10

davisben’s picture

Are you still seeing errors in the Apache log like in #18?

torotil’s picture

I still see the error from #10 in rc2. - when upgrading from 7.x-1.0

davisben’s picture

Hi torotil,
Have you tried with the latest dev release?

artis’s picture

When updating from beta3 to the current dev release (as of 5 minutes ago) I still get this error on every page of the site and in the error logs:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbtest.weight_weights' doesn't exist: SELECT weight FROM {weight_weights} WHERE entity_id=:id AND entity_type=:type; Array ( [:id] => 2 [:type] => node ) in _weight_get_weight() (line 442 of /home/test/public_html/sites/all/modules/weight/weight.module).

I can still test this for you if you want, but I've moved my sites to using the Draggable Views module, so if you can't reproduce it and I'm the only one experiencing this error then you are welcome to close the issue.

Completely uninstalling beta3 and reinstalling the rc2 also works fine. It's just the upgrade path that is broken.

torotil’s picture

@10oclock : yes this is still reproducible with the current 7.x-2.x-dev

torotil’s picture

Seems that I've finally tracked that one down. Here is the a backtrace showing the exception (which happens during bootstrap):

WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'style.weight_weights' doesn't exist: SELECT weight FROM    [error]
{weight_weights} WHERE entity_id=:id AND entity_type=:type; Array
(
    [:id] => 2
    [:type] => node
)
 in _weight_get_weight() (line 443 of /var/www/drupal7/drupal/sites/all/modules/weight/weight.module).
#0  _weight_get_weight(stdClass Object (…)) called at [/var/www/drupal7/drupal/sites/all/modules/weight/weight.module:334]
#1  weight_node_load(…)
#2  call_user_func_array(weight_node_load, Array (…)) called at [/var/www/drupal7/drupal/includes/entity.inc:334]
#3  DrupalDefaultEntityController->attachLoad( … ) called at [/var/www/drupal7/drupal/modules/node/node.module:3945]
#4  NodeController->attachLoad( … ) called at [/var/www/drupal7/drupal/includes/entity.inc:204]
#5  DrupalDefaultEntityController->load(Array ([0] => 2), Array ()) called at [/var/www/drupal7/drupal/includes/common.inc:7623]
#6  entity_load(node, Array ([0] => 2)) called at [/var/www/drupal7/drupal/sites/all/modules/redirect/redirect.module:1045]
#7  redirect_load_entity_from_path(node/2) called at [/var/www/drupal7/drupal/sites/all/modules/redirect/redirect.module:217]
#8  redirect_url_inbound_alter(node/2, node/2, ) called at [/var/www/drupal7/drupal/includes/path.inc:272]
#9  drupal_get_normal_path(node/2) called at [/var/www/drupal7/drupal/includes/path.inc:21]
#10 drupal_path_initialize() called at [/var/www/drupal7/drupal/includes/common.inc:5031]
#11 _drupal_bootstrap_full() called at [/var/www/drupal7/drupal/includes/bootstrap.inc:2186]
#12 drupal_bootstrap(7) called at [/usr/share/drush/includes/environment.inc:977]
#13 _drush_bootstrap_drupal_full() called at [/usr/share/drush/includes/environment.inc:194]
#14 drush_bootstrap(5, 6) called at [/usr/share/drush/includes/environment.inc:310]
#15 drush_bootstrap_to_phase(6) called at [/usr/share/drush/drush.php:90]
#16 drush_main() called at [/usr/share/drush/drush.php:41]

As you can see the main point is entity_load being called by redirect's redirect_url_inbound_alter implementation which in turn calls hook_node_load.
Bootstrapping is done even on update.php or drush updb.

A simple workaround for this is to disable either weight and/or redirect during bootstrap. Disabling redirect worked for me.

Another problem seems that 7202 does something infeasible for my installation. (It breaks after 10mins because it hits the 1GByte memory_limit). But I'll open a separate report for that.

torotil’s picture

Status: Active » Needs review
FileSize
464 bytes

Ok there seems to be an error in the batch-handling that was implemented earlier in this bug-report. Here's a fix.

davisben’s picture

Thanks for your work on this! I'll have some time to review later tonight.

davisben’s picture

Status: Needs review » Active

I committed the patch from #29 to fix that issue.

For the larger issue, I was able to recreate it with Redirect enabled. I'm leaning towards won't fix for this since there is an easy workaround, and the number of affected sites is going to be pretty small. I'll leave this open a bit longer to collect other opinions though.

wipeout_dude’s picture

I just tried to upgrade version 1.0 to release version 2.0 from May 19th and got the following error.. Hopefully its useful..


Additional uncaught exception thrown while handling exception.
Original

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'jsm2djc_website.weight_weights' doesn't exist: SELECT weight FROM {weight_weights} WHERE entity_id=:id AND entity_type=:type; Array ( [:id] => 4 [:type] => node ) in _weight_get_weight() (line 442 of /home/jsm2djc/public_html/sites/all/modules/weight/weight.module).
Additional

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'jsm2djc_website.weight_weights' doesn't exist: SELECT weight FROM {weight_weights} WHERE entity_id=:id AND entity_type=:type; Array ( [:id] => 4 [:type] => node ) in _weight_get_weight() (line 442 of /home/jsm2djc/public_html/sites/all/modules/weight/weight.module).

davisben’s picture

Do you by chance have the Redirect module enabled?

wipeout_dude’s picture

Yes, this site does have redirect enabled and its needed for this particular site so disabling it isn't really an option..

Will Weight 2.0 and redirect simply not work together?

davisben’s picture

You just need to disable it while running update.php the first time. The issue is that Redirect loads nodes during the update, and the node weight is trying to be added to the node before that the weight_weights table is created. Once the table is created, update.php will run normally.

torotil’s picture

Note that it's enough to disable either weight or redirect. As long as non of them is uninstalled update hooks are run for both!

Perhaps you should put a notice about that somewhere prominent on the module page and the upgrade instructions in the README.txt. Redirect is a very common module (we use it for nearly all of our sites) so this is going to hit a lot of people.

For upgrading from 1.0 you actually could do something:
1. Release a new stable 1.1 version that already creates (but doesn't use) the table.
2. change the upgrade hooks so that they don't fail if the table was already created.

For the future: Maybe you shouldn't mark a stable 1.0 release as unsupported as long as there is no stable 2.0 release. This was forcing people to upgrade to 2.0 pre-releases too early.

davisben’s picture

Status: Active » Closed (won't fix)
torotil’s picture

FileSize
635 bytes
950 bytes

I had to upgrade several sites which currently run 7.x-1.0 to 7.x-2.1 without interruptions. For that I've written two patches:

  • The first applies to 7.x-1.0 and creates the weight_weights table when drush updb is called.
  • The second applies to 7.x-2.1 and makes weight_update_7200() work when weight_weights is already created

So the upgrade-path is:

  1. patch the current 7.x-1.0 with the first patch
  2. drush updb
  3. upgrade the code to 7.x-2.1+patch
  4. drush updb

You can forget about those patches as soon as the sites are upgraded to 2.1.

Marshall_Kennard’s picture

Marshall_Kennard’s picture

Issue summary: View changes

Added additional reference.