Bug #26460 queries stays in status NULL for a long time
Submitted: 17 Feb 2007 9:30 Modified: 20 Feb 2007 10:52
Reporter: Sergey Shvets Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S5 (Performance)
Version:5.0.27 OS:Linux (SuSe Linux kernel 2.6.16.13-4)
Assigned to: CPU Architecture:Any

[17 Feb 2007 9:30] Sergey Shvets
Description:
Time after time mysql seems to hang for a bit and don't process any of queries. Thing "hang" period can last from 2-3 secs till 30-60 seconds, and even simplest queries are not processed, e.g. 

select unix_timestamp();

Here is a processlist output, I just catched it. Few processes are in sending data status, but these queries are normally don't consume so much of time.

Example: 

| 193093 | gcc  | 62.250.11.174:22786 | gccdb | Query   |    5 | Sending data | select updated from product_xmlproduct_feature_cache where product_feature_id=13186084  |

but normally:

mysql> select updated from product_xmlproduct_feature_cache where product_feature_id=13186084;
+------------+
| updated    |
+------------+
| 1170892173 |
+------------+
1 row in set (0.01 sec)

mysql> explain select updated from product_xmlproduct_feature_cache where product_feature_id=13186084;
+----+-------------+----------------------------------+-------+--------------------+--------------------+---------+-------+------+-------+
| id | select_type | table                            | type  | possible_keys      | key                | key_len | ref   | rows | Extra |
+----+-------------+----------------------------------+-------+--------------------+--------------------+---------+-------+------+-------+
|  1 | SIMPLE      | product_xmlproduct_feature_cache | const | product_feature_id | product_feature_id | 5       | const |    1 |       |
+----+-------------+----------------------------------+-------+--------------------+--------------------+---------+-------+------+-------+

And show processlist output:

mysql> show processlist;
+--------+------+---------------------+-------+---------+------+--------------+------------------------------------------------------------------------------------------------------+
| Id     | User | Host                | db    | Command | Time | State        | Info                                                                                                 |
+--------+------+---------------------+-------+---------+------+--------------+------------------------------------------------------------------------------------------------------+
|   1650 | gcc  | 62.250.11.174:11739 | gccdb | Query   |    7 | NULL         | select count(id) from process_queue where process_status_id > 1 and process_status_id < 30 and proce |
| 158269 | gcc  | 62.250.11.174:5768  | gccdb | Query   |    7 | Sending data | select id from process_queue where process_status_id <> 30 and command = '/home/gcc/bin/update_produ |
| 165935 | gcc  | 62.250.11.174:16900 | gccdb | Query   |    7 | NULL         | select restricted_values, type from feature where feature_id = '2200'                                |
| 187885 | gcc  | 62.250.11.174:2651  | gccdb | Sleep   |  310 |              | NULL                                                                                                 |
| 188042 | gcc  | 62.250.11.174:2988  | gccdb | Query   |    6 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 188043 | gcc  | 62.250.11.174:2989  | gccdb | Query   |    6 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 188044 | gcc  | 62.250.11.174:2991  | gccdb | Query   |    3 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 188335 | root | localhost           | gccdb | Query   |    0 | NULL         | show processlist                                                                                     |
| 188727 | gcc  | 62.250.11.174:4221  | gccdb | Query   |    6 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 188786 | gcc  | 62.250.11.174:4316  | gccdb | Query   |    4 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189288 | gcc  | 62.250.11.174:5166  | gccdb | Query   |    4 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189400 | gcc  | 62.250.11.174:9356  | gccdb | Query   |    7 | NULL         | select v.value, v.record_id, v.langid from
        product_family as pf, vocabulary as v, product as p wher |
| 189401 | gcc  | 62.250.11.174:9357  | gccdb | Query   |    7 | Sending data | select name from product_name where product_id = 124890 and langid = 2                               |
| 189402 | gcc  | 62.250.11.174:9358  | gccdb | Query   |    7 | NULL         | select updated from product_xmlproduct_feature_cache where product_feature_id=9426826                |
| 189409 | gcc  | 62.250.11.174:9367  | gccdb | Query   |    7 | Sending data | select product_feature_local_id, cf.feature_id,
                         pfl.value, f.measure_id, m.sign, (cf.searchable |
| 189410 | gcc  | 62.250.11.174:9368  | gccdb | Query   |    7 | end          | UPDATE process_queue SET finished_date = unix_timestamp(), process_status_id = 30 WHERE  id = '71507 |
| 189413 | gcc  | 62.250.11.174:9376  | gccdb | Query   |    7 | NULL         | select product_feature_id, cf.feature_id,
                         pf.value, f.measure_id, m.sign, (cf.searchable *
                         |
| 189414 | gcc  | 62.250.11.174:9377  | gccdb | Query   |    7 | end          | UPDATE product_xmlproduct_feature_cache SET updated = unix_timestamp(), xmlproduct_feature_chunk = ' |
| 189421 | gcc  | 62.250.11.174:9393  | gccdb | Query   |    6 | NULL         | SELECT password, length(password) FROM users WHERE login='xxx' AND subscription_level=4 and  |
| 189422 | gcc  | 62.250.11.174:9396  | gccdb | Query   |    5 | NULL         | SELECT password, length(password) FROM users WHERE login='xxx' AND subscription_level=4 and |
| 189423 | gcc  | 62.250.11.174:9398  | gccdb | Query   |    4 | NULL         | SELECT password, length(password) FROM users WHERE login='xxx' AND subscription_level=4 and  |
| 189424 | gcc  | 62.250.11.174:9405  | gccdb | Query   |    2 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189425 | gcc  | 62.250.11.174:9407  | gccdb | Query   |    2 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189426 | gcc  | 62.250.11.174:9408  | gccdb | Query   |    2 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189427 | gcc  | 62.250.11.174:9411  | gccdb | Query   |    2 | NULL         | select unix_timestamp()                                                                              |
| 189428 | gcc  | 62.250.11.174:9412  | gccdb | Query   |    1 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189429 | gcc  | 62.250.11.174:9414  | gccdb | Query   |    0 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
| 189430 | gcc  | 62.250.11.174:9416  | gccdb | Query   |    0 | NULL         | select user_id, user_group, access_restriction, access_restriction_ip, subscription_level  from user |
+--------+------+---------------------+-------+---------+------+--------------+------------------------------------------------------------------------------------------------------+

Storage engine used is MyISAM.

How to repeat:
Sorry, no idea :-(

Suggested fix:
No workaround known.
[17 Feb 2007 10:42] Sergey Shvets
I don't know how far this is connected, but probably this occures when one or two processes are reading / updating TEXT
[18 Feb 2007 13:41] Martin Friebe
check Bug #21074, and see if the query cache could be involved?
[19 Feb 2007 13:20] Valeriy Kravchuk
Please, send your my.cnf/SHOW VARIABLES results to check if query cache is involved.
[19 Feb 2007 15:56] Sergey Shvets
Yes, that was indeed the case.

I dropped the query cache and the problem went away.
Query cache was configured to 500MB.

Problem could be noticed even after 10-15 minutes since server restart (less then 200k of queries).

It's not quite clear is it acknoledged as a bug or as a misconfiguration of a server. Please let me know if I could provide any additional input to you.

thanx!
[20 Feb 2007 7:32] Valeriy Kravchuk
This is a duplicate of bug #21074 then. Bug #21074 is verified and well-known to developers. I hope it will be fixed eventually. In the meantime you should not configure a big query cache if there are many different SQL statements used. This is the only workaround.
[20 Feb 2007 10:52] Sergey Shvets
Oke, thanx a bunch!
[4 Apr 2007 19:07] Valeriy Kravchuk
The problem of misleading "NULL" status is also reportered as verified bug #27628 already.