Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb oom because of infinite loop #36876

Closed
ChenPeng2013 opened this issue Aug 4, 2022 · 3 comments · Fixed by #36883
Closed

tidb oom because of infinite loop #36876

ChenPeng2013 opened this issue Aug 4, 2022 · 3 comments · Fixed by #36883
Labels
affects-6.2 severity/major type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

pk_snpre10114 only have 103 rows, but TableRangeScan operator actRows is 16002212
image
image

MySQL [coms]> select count(*) from pk_snpre10114;
+----------+
| count(*) |
+----------+
|      103 |
+----------+
1 row in set (0.00 sec)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

MySQL [coms]> explain for connection 2281598777821235421;
+------------------------------+---------+----------+-----------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
| id                           | estRows | actRows  | task      | access object       | execution info                                                                                                                                                                                                                                                                                                              | operator info                                                                                                                                                                                                                                                                                       | memory | disk |
+------------------------------+---------+----------+-----------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
| Projection_4                 | 0.00    | 0        | root      |                     | time:0s, loops:0                                                                                                                                                                                                                                                                                                            | coms.pk_snpre10114.col2                                                                                                                                                                                                                                                                             | N/A    | N/A  |
| └─Selection_8                | 0.00    | 0        | root      |                     | time:0s, loops:0                                                                                                                                                                                                                                                                                                            | in(coms.pk_snpre10114.col1, "0x61219f79c90d3541f70e", 5501707547099269248, "0xec43efd30131dea2cb8b"), or(isnull(coms.pk_snpre10114.col2), in(coms.pk_snpre10114.col2, "呣丼蒢咿卻鹻铴础湜僂頃dž縍套衞陀碵碼幓9", "鹹楞睕堚尛鉌翡佾搁紟精廬姆燵藝潐楻翇慸嵊"))                                        | N/A    | N/A  |
|   └─TableReader_7            | 0.00    | 0        | root      |                     | time:0s, loops:0, cop_task: {num: 7990466, max: 223.8ms, min: 168.2µs, avg: 793.6µs, p95: 2.47ms, max_proc_keys: 2, p95_proc_keys: 0, tot_proc: 27.3s, tot_wait: 3m57.8s, rpc_num: 7992372, rpc_time: 1h43m57.7s, copr_cache_hit_ratio: 0.96, distsql_concurrency: 15}, backoff{regionMiss: 1.01s, regionScheduling: 6ms}   | data:Selection_6                                                                                                                                                                                                                                                                                    | N/A    | N/A  |
|     └─Selection_6            | 0.00    | 0        | cop[tikv] |                     | tikv_task:{proc max:4ms, min:0s, avg: 2.62ms, p80:3ms, p95:4ms, iters:7997090, tasks:7997090}, scan_detail: {total_process_keys: 661848, total_process_keys_size: 90673176, total_keys: 1654620, get_snapshot_time: 1m3.5s, rocksdb: {key_skipped_count: 661848, block: {cache_hit_count: 1985544}}}                        | or(isnull(coms.pk_snpre10114.col2), in(coms.pk_snpre10114.col2, "呣丼蒢咿卻鹻铴础湜僂頃dž縍套衞陀碵碼幓9", "鹹楞睕堚尛鉌翡佾搁紟精廬姆燵藝潐楻翇慸嵊"))                                                                                                                                              | N/A    | N/A  |
|       └─TableRangeScan_5     | 2.00    | 16002212 | cop[tikv] | table:PK_SNPRE10114 | tikv_task:{proc max:4ms, min:0s, avg: 2.62ms, p80:3ms, p95:4ms, iters:7998953, tasks:7998953}                                                                                                                                                                                                                               | range:[0x61219F79C90D3541F70E,0x61219F79C90D3541F70E], [0xEC43EFD30131DEA2CB8B,0xEC43EFD30131DEA2CB8B], [0x35353031373037353437303939323639323438,0x35353031373037353437303939323639323438], keep order:false, stats:pseudo                                                                         | N/A    | N/A  |
+------------------------------+---------+----------+-----------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
5 rows in set (5.55 sec)

4. What is your TiDB version? (Required)

| Release Version: v6.2.0
Edition: Community
Git Commit Hash: a399181d861e21a1dbfc3ed00228866a1acd02c9
Git Branch: heads/refs/tags/v6.2.0
UTC Build Time: 2022-07-30 10:09:58
GoVersion: go1.18.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv |
@ChenPeng2013 ChenPeng2013 added the type/bug The issue is confirmed as a bug. label Aug 4, 2022
@tiancaiamao
Copy link
Contributor

Could you find the SQL that trigger this? @ChenPeng2013

@ChenPeng2013
Copy link
Contributor Author

reproduce step

use test;
source [test.txt](https://github.com/pingcap/tidb/files/9256389/test.txt);
prepare stmt from 'SELECT * FROM PK_SNPRE10114 WHERE col1 IN (?, ?, ?) AND (col2 IS NULL OR col2 IN (?, ?)) AND (col3 IS NULL OR col4 IS NULL);';
set @a=0x0D5BDAEB79074756F203, @b=NULL, @c=0x6A911AAAC728F1ED3B4F, @d="鏖秿垙麜濇凗辯Ũ卮伄幖轒ƀ漭蝏雓轊恿磔徵", @e="訇廵纹髺釖寒近槩靏詗膦潳陒錃粓悧闒摔)乀";
execute stmt using @a,@b,@c,@d,@e;
set @a=7775448739068993371, @b=5641728652098016210, @c=6774432238941172824, @d="HqpP5rN", @e="8Fy";
execute stmt using @a,@b,@c,@d,@e;
set @a=0x61219F79C90D3541F70E, @b=5501707547099269248, @c=0xEC43EFD30131DEA2CB8B, @d="呣丼蒢咿卻鹻铴础湜僂頃dž縍套衞陀碵碼幓9", @e="鹹楞睕堚尛鉌翡佾搁紟精廬姆燵藝潐楻翇慸嵊";
execute stmt using @a,@b,@c,@d,@e;
| Release Version: v6.2.0-alpha-607-g5ef1898
Edition: Community
Git Commit Hash: 5ef18981ccc2173120c5e85d3c57abc17f255d2f
Git Branch: master
UTC Build Time: 2022-08-04 03:13:05
GoVersion: go1.18.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |

@tiancaiamao tiancaiamao added feature/developing the related feature is in development severity/major labels Aug 4, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 labels Aug 4, 2022
@tiancaiamao tiancaiamao removed the feature/developing the related feature is in development label Aug 4, 2022
@XuHuaiyu XuHuaiyu removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.0 may-affects-6.1 labels Aug 4, 2022
@zhaoxinyu
Copy link

Maybe the dead loop in title should be replaced with infinite loop. @ChenPeng2013

@ChenPeng2013 ChenPeng2013 changed the title tidb oom because of dead loop tidb oom because of infinite loop Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.2 severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants