When I try to upgrade to version 5.2 (from CVS) the installation does not complete. Apparently it enters an infinite loop because after breaking off the upgrade I get hundreds of copies of the message "All date module fields were updated to allow empty (NULL) values".

Comments

gustav’s picture

In case this is relevant: the version I was trying to update from was version 5.x-1.8. I am using PHP 5.2.3 and MySQL 5.0.45

karens’s picture

There is actually an update process running that may take quite a while to complete, depending on how many fields and nodes you have. So it may not have been an infinite loop, just a very slow process. When I ran it on my own site with lots of data, it appeared to be stalled because it progressed slowly, but eventually finished.

You should not get hundreds of copies of the message, though.

gustav’s picture

Below I copy the information I get when visiting update.php?op=error. The last section gets repeated many times. The line about "Total to be checked" was added by me for debug purposes, it prints $_SESSION[$update_name]['count_total'] and shows the reason why the update script enters the infinite loop: It never checks more than 17 nodes even though it feels that 19 should be checked.

The following queries were executed
date module
Update #5200
UPDATE {system} SET weight = 1 WHERE name = 'date'
Update #5201
Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 5
Total to be checked: 19
Updated nodes:
Unchanged nodes: 14, 126, 161, 162, 163
Date Computations:
14 > Value: set to NULL
126 > Value: set to NULL
161 > Value: 2007-12-12T19:00:00 > Value2: 2007-12-13T16:30:00
162 > Value: 2007-11-12T14:15:00 > Value2: 2007-11-12T15:15:00
163 > Value: 2008-04-14T00:00:00 > Value2: 2008-04-15T00:00:00
Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 10
Total to be checked: 19
Updated nodes:
Unchanged nodes: 164, 174, 194, 203, 212
Date Computations:
164 > Value: 2007-11-23T11:15:00 > Value2: 2007-11-23T11:30:00
174 > Value: 2007-11-30T11:15:00 > Value2: 2007-11-30T12:15:00
194 > Value: 2007-12-18T16:00:00 > Value2: 2007-12-18T18:00:00
203 > Value: 2007-11-30T16:45:00 > Value2: 2007-11-30T17:05:00
212 > Value: 2007-12-07T11:15:00 > Value2: 2007-12-07T12:15:00
Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 15
Total to be checked: 19
Updated nodes:
Unchanged nodes: 217, 217, 230, 236, 238
Date Computations:
217 > Value: 2007-12-17T15:00:00 > Value2: 2007-12-17T16:00:00
217 > Value: 2007-12-17T15:00:00 > Value2: 2007-12-17T16:00:00
230 > Value: 2008-04-15T08:00:00 > Value2: 2008-04-15T15:00:00
236 > Value: 2008-01-14T12:00:00 > Value2: 2008-01-14T13:00:00
238 > Value: 2008-01-14T12:00:00 > Value2: 2008-01-14T13:00:00
Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 17
Total to be checked: 19
Updated nodes:
Unchanged nodes: 269, 295
Date Computations:
269 > Value: 2008-01-18T12:15:00 > Value2: 2008-01-18T13:15:00
295 > Value: 2008-01-25T11:45:00 > Value2: 2008-01-25T12:15:00
Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 17
Total to be checked: 19
Updated nodes:
Unchanged nodes:
Date Computations:

Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 17
Total to be checked: 19
Updated nodes:
Unchanged nodes:
Date Computations:

Date database integrity check for field field_time.
Date data integrity check. Total nodes checked: 17
Total to be checked: 19
Updated nodes:
Unchanged nodes:
Date Computations:

gustav’s picture

Title: Infinite loop during upgrade: "All date module fields were updated to allow empty (NULL) values" » Date update fails when events have revisions

I have investigated further and discovered that if I delete all old revisions of all nodes with date fields then the upgrade works. So the date update #5201 appears not to work correctly with revisions.

karens’s picture

OK, I can see where this might be an issue. The code in question is in the data_integrity function and the search is done only for nid. I'm trying to figure out how to have it update all the revisions instead of just the nids.

alexic’s picture

I have investigated furher and i discoverd maybe a bug.

Around line 585 i changed the install file in this way:

  if ($needs_fix) {
        node_submit($node);
        node_save($node);
      }
      // reset nid
      $_SESSION[$update_name][$table]['nid'] = $node->nid;
      // add to count total
      $_SESSION[$update_name]['counted']++;
      // reduce the number of items in this table left to count
      $_SESSION[$update_name][$table]['to_count']--;

The increment and the decrement are putted out of the if. In the old way, the counter where updated only if the script was modyfing a node. When it see a node that is ok, it doesn't do any increment!

What do you think?

karens’s picture

Yes, good catch. That is not the only problem, but I missed that one. Thanks!

Still working on this, not fixed yet.

nicholas_w’s picture

I'm having a similar problem, not being able to update to 5.2. I'm using Drupal 5.7 with PHP 5.2.3.

When I look at op=error, here's what I see hundreds of:

Date data integrity check. Total nodes checked: 2425
Updated nodes:
Unchanged nodes:
Date Computations:

About half-way through it changes to 2426 nodes checked.

I hope this is helpful.

karens’s picture

Status: Active » Fixed

This turned out to be more complicated than I thought it would be. I finally ended up completely re-working the update code. I think it will work right now.

alexic’s picture

Do we have to download the HEAD version, the development snapshot or the Release candidate? :)

karens’s picture

HEAD is now the Drupal 6 version, so don't use that. The 5.2 development snapshot and the Release candidate are the same file, and they won't pick up today's changes until tonight. The changes are available right now in cvs.

So you can either get the changes now from the 5.2 branch in cvs or wait until tomorrow and get the 5.2 tarball.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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