pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
304 stars 444 forks source link

PHP errors post-upgrade from 3.1.2-1 to 3.2.0-3 #5816

Closed drboone closed 4 years ago

drboone commented 4 years ago

This setup was working fine at 3.1.2-1. Upgraded code, ran upgrade.php without error.

Opening Administration - Site Settings produces an empty Site Setup tab and:

From the submissions page, the "view your pending submissions" link leads to a 500 error and this in the logs:

From the list of journals, clicking "settings wizard" leads to an un-styled journal creation form, and one or more of these in the logs:

Several places have ##tokens## instead of link, field or tab titles, not sure if that's relevant here. E.g.

There are also some warnings, in case they're relevant:

System Information reports incorrect current version, and History does not include the 3.2.0-3 that is currently installed.

PHP v7.3.15.

asmecher commented 4 years ago

@drboone, I think something happened during upgrade. The SiteSettingsDAO is not referenced in the 3.2.0-3 codebase, so there must be something introduced there that isn't compatible with 3.2.0-3 -- an incompatible plugin, or some older code mixed in with the 3.2.0-3 code.

If the system does not report the current release of OJS, it means the upgrade process did not succeed. Restore from pre-upgrade backup and run the upgrade again, looking for an error message. If you don't get a message indicating that the upgrade succeeded, then something went wrong in the process and should be either logged or displayed as an error message.

drboone commented 4 years ago

Ok, I rebuilt the tree so that I could be sure no files other than config and public were carried over. I reverted to the pre-upgrade database and re-ran the upgrade script. Here's the output from that:

annie 13 $ php tools/upgrade.php upgrade

Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
[pre-install]
[load: upgrade.xml]
[version: 3.2.0.3]
[code: Installer Installer::checkPhpVersion]
[code: Installer Installer::migrateSubmissionCoverImages]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_email_templates.xml]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning_articleGalleySettings.xml (skipped)]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning.xml]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_last_activity.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/categories.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/genres.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: lib/pkp/xml/schema/navigationMenus.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]
[code: Installer Installer::installDefaultNavigationMenus]
[code: Installer Installer::migrateStaticPagesToNavigationMenuItems]
[code: Installer Installer::migrateUserAndAuthorNames (skipped)]
[data: dbscripts/xml/upgrade/3.2.0_stylesheet.xml]
[data: dbscripts/xml/upgrade/3.2.0_archiving_settings.xml]
[data: dbscripts/xml/upgrade/3.2.0_update.xml]
[data: dbscripts/xml/upgrade/3.2.0_navigation_menu_items_locale_change.xml]
[code: Installer Installer::migrateSiteLocales]
[code: Installer Installer::migrateSidebarBlocks]
[code: Installer Installer::migrateSiteStylesheet]
[code: Installer Installer::migrateMetadataSettings]
annie 14 $

"View your pending submissions" still produces a 500 and these errors:

#0 /usr/local/hnetojs/classes/services/SubmissionService.inc.php(134): PKPSubmission->getBestId()
#1 /usr/local/hnetojs/lib/pkp/classes/plugins/HookRegistry.inc.php(107): APP\Services\SubmissionService->modifyPropertyValues('Submission::get...', Array)
#2 /usr/local/hnetojs/lib/pkp/classes/services/PKPSubmissionService.inc.php(254): HookRegistry::call('Submission::get...', Array)
#3 /usr/local/hnetojs/lib/pkp/classes/services/PKPSubmissionService.inc.php(297): PKP\Services\PKPSubmissionService->getProperties(Object(Submission), Array, Array)
#4 /usr/local/hnetojs/lib/pkp/classes/components/listPanels/PKPSubmissionsListPanel.inc.php(186): PKP\Services\PKPSubmissionService->getBackendListProperties(Object(Submission), Array)
#5 /usr/local/hnetojs/lib/pkp/pages/dashboard/DashboardHandler.inc.php(76): PKP\components\listPanels\PKPSubmissionsListPanel->getItems(Object(R in /usr/local/hnetojs/lib/pkp/classes/submission/PKPSubmission.inc.php on line 54
PHP Fatal error:  Uncaught Error: Call to a member function getData() on null in /usr/local/hnetojs/lib/pkp/classes/submission/PKPSubmission.inc.php:54

Other things are better: the ##tokens## have gone. I think all the tabs have proper titles and content now.

asmecher commented 4 years ago

@drboone, the output of your upgrade process is still incomplete; you should see a confirmation at the end that the upgrade succeeded. I wonder if you don't have an execution time limit that's being encountered in your command-line PHP configuration. Your PHP error log may capture this.

drboone commented 4 years ago

Ah, I see there are errors from the upgrade in the log. Good of it to emit a console message about failure.

#0 /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError(Object(ADODB_postgres8), '\n\t\t\t\t\t\tINSERT I...')
#1 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(941): DAO->update('\n\t\t\t\t\t\tINSERT I...', Array)
#2 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(417): Installer->migrateMetadataSettings(Object(Upgrade), Array)
#3 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(263): Installer->executeAction(Array)
#4 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(186): Installer->executeInstaller()
#5 /usr/local/hnetojs/lib/pkp/classes/cliTool/UpgradeTool.inc in /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php on line 703
DETAIL:  Failing row contains (1, , keywords, request, null). Query:
PHP Fatal error:  Uncaught Exception: DB Error: ERROR:  null value in column "setting_type" violates not-null constraint

WARNING: The NavigationMenu (ContextId: 0, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
WARNING: The NavigationMenu (ContextId: 1, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
WARNING: The NavigationMenu (ContextId: 1, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
WARNING: The NavigationMenu (ContextId: 2, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
WARNING: The NavigationMenu (ContextId: 2, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
WARNING: The NavigationMenu (ContextId: 3, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
WARNING: The NavigationMenu (ContextId: 3, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
\x09\x09\x09\x09\x09\x09) VALUES (?, ?, ?, ?) in /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php:703 
\x09\x09\x09\x09\x09\x09INSERT INTO journal_settings (
\x09\x09\x09\x09\x09\x09\x09journal_id,
\x09\x09\x09\x09\x09\x09\x09locale,
\x09\x09\x09\x09\x09\x09\x09setting_name,
\x09\x09\x09\x09\x09\x09\x09setting_value
asmecher commented 4 years ago

@drboone, I think most servers have separate php.ini files for the command-line and web-based PHP environments, and the command-line one can be (and generally is) configured with display_errors turned on.

The messages starting with #0 are a stack trace, and the actual error message will be just above that; can you include that in the quote?

drboone commented 4 years ago

Ok, fiddled with php.ini, reloaded db, reran upgrade script. Stdout/stderr look the same. Here's the entire php log output:

[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 3, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 3, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 2, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 2, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 1, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 1, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] WARNING: The NavigationMenu (ContextId: 0, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[05-May-2020 14:42:47 US/Michigan] PHP Fatal error:  Uncaught Exception: DB Error: ERROR:  null value in column "setting_type" violates not-null constraint
DETAIL:  Failing row contains (1, , keywords, request, null). Query:
                        INSERT INTO journal_settings (
                            journal_id,
                            locale,
                            setting_name,
                            setting_value
                        ) VALUES (?, ?, ?, ?) in /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError(Object(ADODB_postgres8), '\n\t\t\t\t\t\tINSERT I...')
#1 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(941): DAO->update('\n\t\t\t\t\t\tINSERT I...', Array)
#2 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(417): Installer->migrateMetadataSettings(Object(Upgrade), Array)
#3 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(263): Installer->executeAction(Array)
#4 /usr/local/hnetojs/lib/pkp/classes/install/Installer.inc.php(186): Installer->executeInstaller()
#5 /usr/local/hnetojs/lib/pkp/classes/cliTool/UpgradeTool.inc in /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php on line 703
asmecher commented 4 years ago

The relevant message is this:

DB Error: ERROR:  null value in column "setting_type" violates not-null constraint
DETAIL:  Failing row contains (1, , keywords, request, null). Query:
                        INSERT INTO journal_settings (
                            journal_id,
                            locale,
                            setting_name,
                            setting_value
                        ) VALUES (?, ?, ?, ?) in /usr/local/hnetojs/lib/pkp/classes/db/DAO.inc.php:703

See https://forum.pkp.sfu.ca/t/error-when-updating-from-3-1-2-4-to-3-2-0-1-with-postgres/59661/2 for information on how to resolve the error.

drboone commented 4 years ago

Ok, that improved things a lot. We're still seeing:

We've not done any custom theming. Color and logo are customized through the web interface.

asmecher commented 4 years ago

@drboone, could you post these on the support forum (https://forum.pkp.sfu.ca), including as much detail as possible, e.g. screenshots where you think they would be helpful? The git issues tool is more for bug fixes than technical support. If you hit on a bug, we can re-open this if need be.