I'm trying to debug a PHP script that runs various queries against the enwiki_p database on the new server (enwiki.analytics.db.svc.eqiad.wmflabs), and I've run into a wall. To simplify the question, I'm running three SQL queries in succession using mysqli_query. The first two queries return results as expected, but the third one doesn't. It just hangs the script indefinitely until the server times out. If I go into the MariaDB client while the script is running and try SHOW FULL PROCESSLIST, it shows the script's connection is sleeping.
Here's what has me stumped: if I comment out the first two queries and just submit the third, it runs fine and returns the data I am looking for. So I know it's not an error in my query string or in PHP syntax. Am I running up against some limit on successive queries? What should I be doing differently?
If it makes a difference, none of these are extremely slow queries. Each one separately completes in about 30-60 seconds depending on server load.
Sent from my iPhone
Maybe post your script so people can try to investigate?
On 6 October 2017 at 19:42, Russell Blau russblau@imapmail.org wrote:
I'm trying to debug a PHP script that runs various queries against the enwiki_p database on the new server (enwiki.analytics.db.svc.eqiad.wmflabs), and I've run into a wall. To simplify the question, I'm running three SQL queries in succession using mysqli_query. The first two queries return results as expected, but the third one doesn't. It just hangs the script indefinitely until the server times out. If I go into the MariaDB client while the script is running and try SHOW FULL PROCESSLIST, it shows the script's connection is sleeping.
Here's what has me stumped: if I comment out the first two queries and just submit the third, it runs fine and returns the data I am looking for. So I know it's not an error in my query string or in PHP syntax. Am I running up against some limit on successive queries? What should I be doing differently?
If it makes a difference, none of these are extremely slow queries. Each one separately completes in about 30-60 seconds depending on server load.
Sent from my iPhone
Cloud mailing list Cloud@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/cloud
Did you read all results from the second query?
It may be waiting for you to read received data before sending the new query.
What are you using, MYSQLI_USE_RESULT or MYSQLI_STORE_RESULT?
Regards
Thanks for the hint. It actually turned out not to be the issue, but it helped me narrow down the problem. In the end, it wasn't a database issue at all, but a very poorly documented bit of PHP code. (Tip to others -- never, ever use the array_key_exists() function unless you absolutely must, and then be sure to reset() the array before you do. Otherwise, the function call might never return!)
On Sat, Oct 7, 2017, at 02:56 PM, Platonides wrote:
Did you read all results from the second query?
It may be waiting for you to read received data before sending the new query.
What are you using, MYSQLI_USE_RESULT or MYSQLI_STORE_RESULT?
Regards
Cloud mailing list Cloud@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/cloud
On Sun, Oct 8, 2017 at 6:11 PM, Russell Blau russblau@imapmail.org wrote:
(Tip to others -- never, ever use the array_key_exists() function unless you absolutely must, and then be sure to reset() the array before you do. Otherwise, the function call might never return!)
That sounds like a bug in PHP (or HHVM, if that's what you're using). You should file it upstream with details on how exactly to reproduce it.
A very general advice- make sure you have up-to-date connectors, first for security reasons, second for compatibility. It is very, very unlikely it is a compatibility issue (MySQL wire protocol -not the SQL language- hasn't barely changed since 4.x, with the exception of prepared statements and a few other very specific things), but it is always nice to have the last version to make sure one doesn't fall into old bugs.
On Tue, Oct 10, 2017 at 4:22 PM, Brad Jorsch (Anomie) bjorsch@wikimedia.org wrote:
On Sun, Oct 8, 2017 at 6:11 PM, Russell Blau russblau@imapmail.org wrote:
(Tip to others -- never, ever use the array_key_exists() function unless you absolutely must, and then be sure to reset() the array before you do. Otherwise, the function call might never return!)
That sounds like a bug in PHP (or HHVM, if that's what you're using). You should file it upstream with details on how exactly to reproduce it.
-- Brad Jorsch (Anomie) Senior Software Engineer Wikimedia Foundation
Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud