Page MenuHomePhabricator

relatedchanges.php MySQL errors
Closed, ResolvedPublic

Description

Reported by Discanto: https://tools.wmflabs.org/erwin85/relatedchanges.php?lang=it&family=wikipedia&category=Alchimisti+italiani&d=1&ignore=&submit=Submit fails immediately with

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:22:07 +0000. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:22:07 +0000. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:22:07 +0000. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:22:07 +0000. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:22:07 +0000. It is possible that this tool won't work right now. If this error message persists please file a bug.

The DB exists at least on some hosts:

MariaDB [itwiki_p]> SHOW TABLES FROM s51362__erwin85;
+---------------------------+
| Tables_in_s51362__erwin85 |
+---------------------------+
| sc_Idwiki_p               |
| sc_commonswiki_p          |
| sc_cswiki_p               |
| sc_dewiki_p               |
| sc_enwikiquote_p          |
| sc_enwiktionary_p         |
| sc_fiwiki_p               |
| sc_itwiki_p               |
| sc_nlwiki_p               |
| sc_plwiki_p               |
| sc_ptwiki_p               |
| sc_svwiki_p               |
| sc_trwiki_p               |
| sc_zhwiki_p               |
+---------------------------+
14 rows in set (0.00 sec)

Would be useful to know the exact queries the tool ends up running and the output thereof.

Event Timeline

Nemo_bis raised the priority of this task from to Needs Triage.
Nemo_bis updated the task description. (Show Details)
Nemo_bis added a project: Tool-Erwin's-tools.
Nemo_bis subscribed.
Warning: There were MySQL errors at Fri, 31 Jul 2015 20:53:27 +00002mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)/data/project/erwin85/public_html/inc/database.class.php467Array. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:53:27 +00002mysql_num_rows() expects parameter 1 to be resource, boolean given/data/project/erwin85/public_html/relatedchanges.php145Array. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:53:27 +00002mysql_num_rows() expects parameter 1 to be resource, boolean given/data/project/erwin85/public_html/inc/database.class.php327Array. It is possible that this tool won't work right now. If this error message persists please file a bug.

Warning: There were MySQL errors at Fri, 31 Jul 2015 20:53:27 +00002mysql_affected_rows() expects parameter 1 to be resource, boolean given/data/project/erwin85/public_html/inc/database.class.php357Array. It is possible that this tool won't work right now. If this error message persists please file a bug.
[...]_connect(): Can't connect to local MySQL server [...]

That can never work, given how labs is structured (there are no local mysql servers on the execution nodes). It would appear that the tool is (erroneously) not specifiying a specific database to connect to and defaulting to the non-existing local one.

Nemo_bis claimed this task.

Ok. The origin of the bug is very silly: TSDatabase::getDatabase() and TSDatabase::getCluster() had a line: $sql = "SELECT dbname FROM meta_p.wiki WHERE url = 'http://" . $domain . "'";.

meta_p at some point was converted to https (perhaps as byproduct of T106897?); switching that to $sql = "SELECT dbname FROM meta_p.wiki WHERE url LIKE '%" . $domain . "'"; fixed the issue.