Page MenuHomePhabricator

extensions/PageAssessments/maintenance/purgeUnusedProjects.php is causing fatals on Beta
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Command: /srv/mediawiki/multiversion/MWScript.php extensions/PageAssessments/maintenance/purgeUnusedProjects.php --wiki=enwikivoyage
Request URL: n/a (cron job)
Request ID: ddc0bb1c594cd3d41d5d2972

message
[ddc0bb1c594cd3d41d5d2972] [no req]   Wikimedia\Rdbms\DBQueryError from line 1585 of /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: DELETE FROM `page_assessments_projects` WHERE (pap_project_id NOT IN ())
Function: PurgeUnusedProjects::execute
Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '))' at line 1 (172.16.5.170:3306)
trace
#0 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(1554): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(1272): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /srv/mediawiki/php-master/includes/libs/rdbms/database/Database.php(3028): Wikimedia\Rdbms\Database->query(string, string)
#3 /srv/mediawiki/php-master/extensions/PageAssessments/maintenance/purgeUnusedProjects.php(59): Wikimedia\Rdbms\Database->delete(string, string, string)
#4 /srv/mediawiki/php-master/maintenance/doMaintenance.php(96): PurgeUnusedProjects->execute()
#5 /srv/mediawiki/php-master/extensions/PageAssessments/maintenance/purgeUnusedProjects.php(71): include(string)
#6 /srv/mediawiki/multiversion/MWScript.php(100): include(string)
#7 {main}

Impact

N/A

Notes

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
MarcoAurelio renamed this task from xtensions/PageAssessments/maintenance/purgeUnusedProjects.php is causing fatals on Beta to extensions/PageAssessments/maintenance/purgeUnusedProjects.php is causing fatals on Beta.Apr 2 2019, 9:22 PM

https://phabricator.wikimedia.org/diffusion/EPAS/browse/master/maintenance/purgeUnusedProjects.php$58

$conds = [ 'pap_project_id NOT IN (' . $dbr->makeList( $usedProjectIds ) . ')' ];

should be, perhaps?

$conds = [ 'pap_project_id NOT IN '(' . $dbr->makeList( $usedProjectIds ) . ')' ];

I see traces of this error going back up to one year as of today in logstash-beta. I'm guessing PageAssessments isn't successfuly deleting unused projects since, at least, some months.

@MarcoAurelio I don't think this is the same problem as T208231: Issues with purgeUnusedProjects.php cron job on mwmaint1002 (Fri Oct 26, 2018).

Can we disable the cron job on beta?

I think beta now uses the same file production uses to run their jobs. I'm not sure if it is possible to deactivate this cron job for Beta only; but if it is a syntax error it should be fixed.

https://phabricator.wikimedia.org/diffusion/EPAS/browse/master/maintenance/purgeUnusedProjects.php$58

$conds = [ 'pap_project_id NOT IN (' . $dbr->makeList( $usedProjectIds ) . ')' ];

I think this syntax is correct. I think the issue is that the $usedProjectIds is empty so there's nothing in the SQL clause for the NOT IN () to filter by.

This code was added in this commit: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/PageAssessments/+/c3fcf6926f4c53fb4eb3e1f980f04a3292cf354e%5E%21/maintenance/purgeUnusedProjects.php

I'm taking a look now to see why that array might be empty.

@aezell Possibly because beta doesn't have any wikiprojects. The code should be able to handle this but I think we never ran into this before on other projects.
Not sure why we are only just now seeing this on beta.

@kaldari SOS.

Change 500850 had a related patch set uploaded (by Aezell; owner: Aezell):
[mediawiki/extensions/PageAssessments@master] Protect against empty array causing sql syntax error

https://gerrit.wikimedia.org/r/500850

Change 500850 merged by jenkins-bot:
[mediawiki/extensions/PageAssessments@master] Protect against empty array causing sql syntax error

https://gerrit.wikimedia.org/r/500850

Mentioned in SAL (#wikimedia-releng) [2019-04-02T22:24:24Z] <hauskatze> maurelio@deployment-deploy01:~$ mwscript extensions/PageAssessments/maintenance/purgeUnusedProjects.php --wiki=enwikivoyage | T219935

MarcoAurelio assigned this task to aezell.
maurelio@deployment-deploy01:~$ mwscript extensions/PageAssessments/maintenance/purgeUnusedProjects.php --wiki=enwikivoyage
Projects before purge: 0
No projects found.
Done.

Looks good! Thanks!

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM