ERROR: Upgrade failed: DB: MySQL server has gone away

Hi guys,
I having an issue when I am finishing the upgrade 2.4.8 to 3.0.1.

At one of the last steps running the upgrade script via cli I get always this error and upgrade crashes:

ERROR: Upgrade failed: DB: MySQL server has gone away

I have done a my.conf file to try to increase the wait_timeout and max_allowed_packet:

[mysqld]
max_allowed_packet = 128M
wait_timeout = 5000

But it seems have no effect. This is a shared server, so I can not restart mysql server.

Any ideas?

Thank you :slight_smile:

Daniel
Icono14

Hi @celuloide,

What step is running when this happens?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
It seemed to be almost finishing. It past about five minutes before fail, and last processes was called something like “post-upgrade…” or similar. The fail occurs four or five steps after upgrading the files folder. I have to run the upgrade again to know exactly what step was running. I do it and I tell you.

Thanks,
Daniel
Icono14

@celuloide, you should also use the most recent version i.e. 3.0.2 – a lot of bugs were fixed there…

Yes @bozana , sorry, I wanted to mean 3.0.2.

Here is all the process. It takes about 15 min to get to the fail:

(uiserver):xxxxxx:~/ojsd/ojs_302$ /usr/bin/php5.5-cli tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 3.0.2.0]

[code: Installer Installer::syncSeriesAssocType]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics2.xml]
[data: dbscripts/xml/upgrade/3.0.0_preupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptTimedViews.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_adaptReferrals.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptBooksForReview.xml]
[data: dbscripts/xml/upgrade/remove_timed_views_bots.xml (skipped)]

[code: Installer Installer::migrateCounterPluginUsageStatistics (skipped)]

[code: Installer Installer::migrateTimedViewsUsageStatistics (skipped)]

[code: Installer Installer::migrateDefaultUsageStatistics (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration2.xml]
[data: dbscripts/xml/upgrade/2.4.0_postCounterMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postTimedViewsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_preupdate_commentsToEditor.xml]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/log.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/submissionFiles.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/genres.xml]
[schema: lib/pkp/xml/schema/gifts.xml]
[schema: lib/pkp/xml/schema/mutex.xml]
[schema: lib/pkp/xml/schema/tombstone.xml]
[schema: lib/pkp/xml/schema/rolesAndUserGroups.xml]
[schema: lib/pkp/xml/schema/metrics.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/libraryFiles.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type.xml]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type_metrics.xml]
[data: dbscripts/xml/upgrade/3.0.0_settings.xml]

[code: Installer Installer::migrateArticleMetadata]
[data: dbscripts/xml/upgrade/3.0.0_update.xml]

[code: Installer Installer::clearDataCache]

[code: Installer Installer::migrateUserRoles]

[code: Installer Installer::installDefaultGenres]

[code: Installer Installer::fixReviewForms]

[code: Installer Installer::htmlifyEmailTemplates]
[note: docs/release-notes/README-BEACON]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]
[data: dbscripts/xml/upgrade/3.0.0_scheduledTasks.xml]

[code: Installer Installer::localizeCustomBlockSettings]

[code: Installer Installer::convertEditorDecisionNotes]

[code: Installer Installer::convertQueries]

[code: Installer Installer::migrateFiles]
WARNING: Unable to find a match for “46-398-1-CE.doc” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/46/”. Skipping this file.
WARNING: Unable to find a match for “46-404-1-CE.doc” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/46/”. Skipping this file.
WARNING: Unable to find a match for “46-405-1-CE.doc” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/46/”. Skipping this file.
WARNING: Unable to find a match for “71-328-1-SP.doc” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/71/”. Skipping this file.
WARNING: Unable to find a match for “104-483-1-SP.doc” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/104/”. Skipping this file.
WARNING: Unable to find a match for “104-494-1-SP.pdf” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/104/”. Skipping this file.
WARNING: Unable to find a match for “196-2147-2-ED.doc” in “/kunden/homepages/46/xxxxx/htdocs/ojsdfiles/journals/1//articles/196/”. Skipping this file.

[code: Installer Installer::convertSupplementaryFiles]

[code: Installer Installer::setFileUploader]

[code: Installer Installer::setFileName]
[data: dbscripts/xml/upgrade/3.0.0_postupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_pubId_settings.xml]
[data: dbscripts/xml/upgrade/3.0.0_postupgrade_galley_files.xml]
[data: dbscripts/xml/upgrade/3.0.0_postupgrade_metrics.xml]
ERROR: Upgrade failed: DB: MySQL server has gone away

Can anybody help me?

Thanks!

Daniel Becerra
ICONO14

Hi @celuloide

Does it always fails at that place?
@asmecher, any idea why?

@celuloide: you also have a few other errors – some files could not be found and correctly migrated. You would need to take a look in your old installation, what is wrong with the files, why are they not there…

Best,
Bozana

Yes @bozana always fails at the same point.

About the warnings, yes, I will check it out later, apparently the upgrade skips them and continues. Do you think it could be the reason of failure?

Regards
Daniel Becerra
ICONO14

Hello,
I tried the upgrade also via http with the link on the installing screen, but after a few moments I get the following error:

The page you are looking for is temporarily unavailable.
Please try again later.
4d9d839b88837bfb31883c0237d93a6e 7bb07c47ef6c0d361adb72cd9bc838b1 f0939350a5731f1897c1bcaf5e7c69ea

Am I doing something wrong?

Regards,
Daniel
ICONO14

Hi @celuloide

Hmmm… strange…
Would it be possible to you to do some testing?
You could maybe try to comment out that last script from here ojs/upgrade.xml at ojs-3_0_2-0 · pkp/ojs · GitHub, so that it is not executed, to see if the upgrade finishes then.
Else, maybe also to try to execute the queries from that script (ojs/3.0.0_postupgrade_metrics.xml at ojs-3_0_2-0 · pkp/ojs · GitHub) manually, one by one, on the DB state after the DB crash, and to see if they are the problem i.e. which one.

Else, you could maybe take a look here: MySQL :: MySQL 5.7 Reference Manual :: B.3.2.7 MySQL server has gone away. Maybe you can find some useful information on that page – what you could take a look at, to figure out what is going on. E.g. to start the mysql server with better logging so that you can take a look into the mysql error logs for more information? I found this sentence there:

You can get more information about the lost connections by starting mysqld with the log_error_verbosity system variable set to 3. This logs some of the disconnection messages in the hostname.err file. See Section 5.4.2, “The Error Log”.

Hmmm… I am not sure what that message for the http update means – I’ll take a look/think about it…

Best,
Bozana

Hi @bozana
Thank you for your help. I have commented the line you told me and upgrade finished fine then, but after upgrade finish, I execute the queries I commented on the database and I get the same timeout error with the third query:

UPDATE metrics m, submission_file_settings sfs SET m.assoc_id = sfs.file_id WHERE m.assoc_type = 515 AND sfs.setting_name = 'old-supp-id' AND sfs.setting_value = m.assoc_id

Our hosting provider confirmed us there was a timeout error, but as it is a shared hosting, it is no possible to increase this configuration.

Best,
Daniel
ICONO14

I just ran into this same error when upgrading a large OJS DB. I’ve upgraded about 50 smaller database and they worked fine but this large one gave me problems. My solution was to run the php/mysql server on a VM and copy the database over to the production server. It took a long time to run the upgrade but it did work.