Moodle

On upgrade from Moodle 1.8.4 to 1.9+ get "Found more than one record in fetch() !" error when Setting up module tables

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 2.0
  • Component/s: Gradebook, Installation
  • Labels:
    None
  • Environment:
    Server: MacPro, MacOS 10.4.11, Moodle 1.8.4 to 1.9 Upgrade (downloaded from CVS on 1st April, 2008), Apache 1.3.33, php 5.2.1, MySQL 5.0.24a
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

On trying to upgrade from Moodle 1.8.4 to 1.9 I get the following error:

Found more than one record in fetch() !

Screen shot attached.

Clicking on [Continue] just returns me to the same page, with the same error.

Note: I did a practice upgrade from an empty Moodle 1.8.4 system to 1.9 and got no errors. The difference is that now I am attempting to upgrade a Moodle system that has many courses.

Activity

Hide
Eric Villard added a comment -

Hi, i've got the same issue but on the upgrade of the assignment module

Show
Eric Villard added a comment - Hi, i've got the same issue but on the upgrade of the assignment module
Hide
Peter Ruthven-Stuart added a comment -

I think I have a "solution" - or at least an explanation of the 'error' that I experienced above.

Early on in the upgrade process, there is the possibility of changing new settings. On clicking on the [save] button at the bottom of this settings page, I waited for almost 2 minutes and then got a "server timed out" error message. I then clicked on the [save] button again and got the following message:

Upgrade already running in this session, please wait!
Click on the exclamation marks to ignore this warning (!!!).
( Continue )

I clicked on the 'continue' link and then got the error message described above, i.e.: "Found more than one record in fetch() !"

Later on, I reverted back to my original 1.8.4 system, and again attempted the upgrade to 1.9. I again got the "server timed out" message, and again clicked on the [save] button at the bottom of the settings page. And again, I got the "Upgrade already running" message. However, this time, I did nothing, and noticed that although the page was not reloading, the status bar at the bottom of the browser page indicated that changes were being made to the server. After about 5 minutes, a new page appeared indicating the successful installation of some tables, and the upgrade continued without problem. The new system appears to be working as expected.

So, the 'solution' is NOT to click on either the 'exclamation marks' nor the 'Continue' links, but just wait.

Show
Peter Ruthven-Stuart added a comment - I think I have a "solution" - or at least an explanation of the 'error' that I experienced above. Early on in the upgrade process, there is the possibility of changing new settings. On clicking on the [save] button at the bottom of this settings page, I waited for almost 2 minutes and then got a "server timed out" error message. I then clicked on the [save] button again and got the following message: Upgrade already running in this session, please wait! Click on the exclamation marks to ignore this warning (!!!). ( Continue ) I clicked on the 'continue' link and then got the error message described above, i.e.: "Found more than one record in fetch() !" Later on, I reverted back to my original 1.8.4 system, and again attempted the upgrade to 1.9. I again got the "server timed out" message, and again clicked on the [save] button at the bottom of the settings page. And again, I got the "Upgrade already running" message. However, this time, I did nothing, and noticed that although the page was not reloading, the status bar at the bottom of the browser page indicated that changes were being made to the server. After about 5 minutes, a new page appeared indicating the successful installation of some tables, and the upgrade continued without problem. The new system appears to be working as expected. So, the 'solution' is NOT to click on either the 'exclamation marks' nor the 'Continue' links, but just wait.
Hide
Eloy Lafuente (stronk7) added a comment -

Adding some people here. This seems to be related to the gradebook upgrade... if I'm not wrong.

IMO we should try to fix those problems (or provide a way to do so), instead of failing, but it's far from my knowledge to say if that's possible or no.

Please watchers, comment and feel free to assign this to you. TIA!

Show
Eloy Lafuente (stronk7) added a comment - Adding some people here. This seems to be related to the gradebook upgrade... if I'm not wrong. IMO we should try to fix those problems (or provide a way to do so), instead of failing, but it's far from my knowledge to say if that's possible or no. Please watchers, comment and feel free to assign this to you. TIA!
Hide
Peter Ruthven-Stuart added a comment -

Since reporting on my apparent 'solution' to the above mentioned problem (Found more than one record in fetch() !), I have since discovered that teachers and students are unable to edit their profiles. And, bizarrely, teachers are able to turn editing on in their courses, but the add resource and activity menus are not visible.

Perhaps these issues may be related?

The details are explained here:
MDL-14159
and here
http://moodle.org/mod/forum/discuss.php?d=93977

Show
Peter Ruthven-Stuart added a comment - Since reporting on my apparent 'solution' to the above mentioned problem (Found more than one record in fetch() !), I have since discovered that teachers and students are unable to edit their profiles. And, bizarrely, teachers are able to turn editing on in their courses, but the add resource and activity menus are not visible. Perhaps these issues may be related? The details are explained here: MDL-14159 and here http://moodle.org/mod/forum/discuss.php?d=93977
Hide
Peter Ruthven-Stuart added a comment -

I have since reverted back to 1.8.4, and then done a new upgrade, which I report here:

MDL-14159

the above mentioned error (Found more than one record in fetch() !) did not appear, but the browser did hang. Teachers are now able to add resources and activities to their courses, but users are NOT able to edit their profiles or change their passwords.

Show
Peter Ruthven-Stuart added a comment - I have since reverted back to 1.8.4, and then done a new upgrade, which I report here: MDL-14159 the above mentioned error (Found more than one record in fetch() !) did not appear, but the browser did hang. Teachers are now able to add resources and activities to their courses, but users are NOT able to edit their profiles or change their passwords.
Hide
Oleg Sychev added a comment -

To enable editing profiles and passwords in 1.9. you must set $CFG->defaultuserroleid in Authenticated User (See MDL-14183), as well as allow corresponding capabilities for Authentificated user role. Capabilities allowed by default, but default role during upgrade is Guest, not Authenticated User.

Show
Oleg Sychev added a comment - To enable editing profiles and passwords in 1.9. you must set $CFG->defaultuserroleid in Authenticated User (See MDL-14183), as well as allow corresponding capabilities for Authentificated user role. Capabilities allowed by default, but default role during upgrade is Guest, not Authenticated User.
Hide
Martin Dougiamas added a comment -

This reported bug seems difficult to reproduce.

Show
Martin Dougiamas added a comment - This reported bug seems difficult to reproduce.
Hide
Paul Nijbakker added a comment -

We encountered this bug today, while trying to upgrade from 1.8.3+ to 1.9.2+. We had tested the upgrade in a test serve that is a copy of the production server and the problem did not occur there, so we were unpleasantly surprised when the loop occured while upgrading the assignment module.

On posting a message in the Installation problems forum I discovered that this issue has existed at least since April. With the school year starting in a month, this is a rather urgent issue to us, but we have no idea as to the exact cause of the problem and therefore do not know what to do about it. I hope the new gradebook is not too complex for its own good.

Show
Paul Nijbakker added a comment - We encountered this bug today, while trying to upgrade from 1.8.3+ to 1.9.2+. We had tested the upgrade in a test serve that is a copy of the production server and the problem did not occur there, so we were unpleasantly surprised when the loop occured while upgrading the assignment module. On posting a message in the Installation problems forum I discovered that this issue has existed at least since April. With the school year starting in a month, this is a rather urgent issue to us, but we have no idea as to the exact cause of the problem and therefore do not know what to do about it. I hope the new gradebook is not too complex for its own good.
Hide
Martin Dougiamas added a comment -

Nick, can you analyse this closely?

The error is thrown in fetch_helper() in http://cvs.moodle.org/moodle/lib/grade/grade_object.php

Where the comment says: "we should not tolerate any errors here - problems might appear later"

It seems people do have some duplicates for some reason, so we need to find a way to recover and fix the problem, even if we only keep one $instance of the data (say).

Show
Martin Dougiamas added a comment - Nick, can you analyse this closely? The error is thrown in fetch_helper() in http://cvs.moodle.org/moodle/lib/grade/grade_object.php Where the comment says: "we should not tolerate any errors here - problems might appear later" It seems people do have some duplicates for some reason, so we need to find a way to recover and fix the problem, even if we only keep one $instance of the data (say).
Hide
Paul Nijbakker added a comment -

Hi all,

I am relieved to say that we finally managed to overcome the problem with the "Found more than one record in fetch() !" error. It was a result of 9 duplicate rows in the mdl_grade_items table and 1 duplicate row in the mdl_grade_categories table. We found these by:

A: adding $CFG->debug=1; to the middle of the config.php file (this showed us where the duplicates in the grade items were in combination with the setting below)

B: setting debug to true in the mod/assignment/db/upgrade.php

We could then track down the duplicate rows in the moodle MySql database and delete the offending rows.

After that the upgrade was a breeze. So the solution to the problem would be some kind of command that removes these duplicate rows before the upgrade.

Show
Paul Nijbakker added a comment - Hi all, I am relieved to say that we finally managed to overcome the problem with the "Found more than one record in fetch() !" error. It was a result of 9 duplicate rows in the mdl_grade_items table and 1 duplicate row in the mdl_grade_categories table. We found these by: A: adding $CFG->debug=1; to the middle of the config.php file (this showed us where the duplicates in the grade items were in combination with the setting below) B: setting debug to true in the mod/assignment/db/upgrade.php We could then track down the duplicate rows in the moodle MySql database and delete the offending rows. After that the upgrade was a breeze. So the solution to the problem would be some kind of command that removes these duplicate rows before the upgrade.
Hide
Nicolas Connault added a comment -

Thanks for the info Paul.

What I don't understand though, is that the tables you mention, grade_items and grade_categories, do not exist in 1.8. There is grade_item and grade_category though (notice the singular form). Are these the tables in which you found duplicates?

Show
Nicolas Connault added a comment - Thanks for the info Paul. What I don't understand though, is that the tables you mention, grade_items and grade_categories, do not exist in 1.8. There is grade_item and grade_category though (notice the singular form). Are these the tables in which you found duplicates?
Hide
Paul Nijbakker added a comment -

Hi Nicolas,

The error came to light after the database had been upgraded, so I found the duplicates in the mdl_grade_items table and the mdl_grade_categories table. I was not aware of the duplicates existing already in the 1.8 database, but they may have (as a result of a botched course restore for example). However, I would not know in which tables they would have occurred in that case.

Show
Paul Nijbakker added a comment - Hi Nicolas, The error came to light after the database had been upgraded, so I found the duplicates in the mdl_grade_items table and the mdl_grade_categories table. I was not aware of the duplicates existing already in the 1.8 database, but they may have (as a result of a botched course restore for example). However, I would not know in which tables they would have occurred in that case.
Hide
Nicolas Connault added a comment -

I finally managed to reproduce this error. This happens when an upgrade is running on the server and a new browser window is opened to attempt the upgrade at the same time (or a similar condition). There is no actual bug in the gradebook code in this case. We are working on a way to prevent concurrent upgrade processes.

Show
Nicolas Connault added a comment - I finally managed to reproduce this error. This happens when an upgrade is running on the server and a new browser window is opened to attempt the upgrade at the same time (or a similar condition). There is no actual bug in the gradebook code in this case. We are working on a way to prevent concurrent upgrade processes.
Hide
David Mudrak added a comment -

I can second Nicolas findings. The same error was thrown for me in the similar situation - another browser opened the upgrade process. I forgot to put the server into the maintenance mode. Maybe this would help?

Show
David Mudrak added a comment - I can second Nicolas findings. The same error was thrown for me in the similar situation - another browser opened the upgrade process. I forgot to put the server into the maintenance mode. Maybe this would help?
Hide
David Mudrak added a comment -

> We are working on a way to prevent concurrent upgrade processes.

Can I help with this somehow? Has this been discussed somewhere online?

Show
David Mudrak added a comment - > We are working on a way to prevent concurrent upgrade processes. Can I help with this somehow? Has this been discussed somewhere online?
Hide
Martin Dougiamas added a comment -

Nicolas/Petr, what was the last word on this? I thought I saw some code to prevent concurrent upgrades but I could be mistaken....

Show
Martin Dougiamas added a comment - Nicolas/Petr, what was the last word on this? I thought I saw some code to prevent concurrent upgrades but I could be mistaken....
Hide
Petr Škoda (skodak) added a comment - - edited

the full concurrent prevention is in HEAD only (and there still might be some pending problems there),

in 1.9.x we have only concurrent protection in current session - which means if somebody ignores the warning and closes browser and open it again the data gets corrupted; the easies solution for affected sites is to restore from db dump and rerun upgrade and let it finish even if the page/UI times out

Show
Petr Škoda (skodak) added a comment - - edited the full concurrent prevention is in HEAD only (and there still might be some pending problems there), in 1.9.x we have only concurrent protection in current session - which means if somebody ignores the warning and closes browser and open it again the data gets corrupted; the easies solution for affected sites is to restore from db dump and rerun upgrade and let it finish even if the page/UI times out
Hide
Petr Škoda (skodak) added a comment -

There is a new code in HEAD that will prevent similar problems in the future, unfortunately the changes required were too big for 1.9.x, sorry

thanks for the report and cooperation

Show
Petr Škoda (skodak) added a comment - There is a new code in HEAD that will prevent similar problems in the future, unfortunately the changes required were too big for 1.9.x, sorry thanks for the report and cooperation
Hide
Ric Parodi added a comment -

I can confirm that this issue occurs when more than one browser is open and users logged in after the initial upgrade but before the final.

Show
Ric Parodi added a comment - I can confirm that this issue occurs when more than one browser is open and users logged in after the initial upgrade but before the final.

Dates

  • Created:
    Updated:
    Resolved: