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 connection running loop panic error #46791

Closed
imhun opened this issue Sep 8, 2023 · 5 comments · May be fixed by #46811
Closed

tidb connection running loop panic error #46791

imhun opened this issue Sep 8, 2023 · 5 comments · May be fixed by #46811
Assignees
Labels
affects-7.1 affects-7.5 priority/release-blocker This issue blocks a release. Please solve it ASAP. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug. type/regression

Comments

@imhun
Copy link

imhun commented Sep 8, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

A random error occurs when the application executes specific services,for details about the sql, see logs

6.5 is ok, 7.1 to 7.3 have problems

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

no error

3. What did you see instead (Required)

error occur

4. What is your TiDB version? (Required)

Release Version: v7.3.0
Edition: Community
Git Commit Hash: 40b72e7
Git Branch: heads/refs/tags/v7.3.0
UTC Build Time: 2023-08-08 09:37:02
GoVersion: go1.20.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv

2023-09-08T16:30:58.509517428+08:00 [2023/09/08 16:30:58.509 +08:00] [ERROR] [conn.go:962] ["connection running loop panic"] [conn=2791351548] [lastSQL="SELECT id, folder_id, form_code, form_name, release_status, sort, tenant_id, version_id, created_date, created_by, last_updated_date, last_updated_by, version_number FROM bg_auto_form WHERE (id = ?) AND ((bg_auto_form.created_by = 1503947622444519426 OR EXISTS (SELECT 1 FROM sys_perm_document_rule perm, sys_data_rule_table permt WHERE perm.document_type_id = permt.document_type_id AND ((perm.table_type = 1000 AND permt.c_table_name = 'bg_auto_form' AND perm.permission != 0) OR (perm.table_type = permt.table_type AND perm.document_id = bg_auto_form.id AND perm.cc_table_name = 'bg_auto_form' AND perm.permission != 0)) AND (perm.user_id = 1503947622444519426 OR perm.user_group_id IN (1632586065893220353, 1574937513391800322, 1590653737747836930)) AND perm.tenant_id = 1476472055858286593))) AND bg_auto_form.tenant_id = 1476472055858286593 [arguments: 1699702136627441666]"]
[err="runtime error: invalid memory address or nil pointer dereference"]
[stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:965\nruntime.gopanic\n\t
/usr/local/go/src/runtime/panic.go:884\nruntime.panicmem\n\t
/usr/local/go/src/runtime/panic.go:260\nruntime.sigpanic\n\t
/usr/local/go/src/runtime/signal_unix.go:841\ngithub.com/pingcap/tidb/planner/core.getJoinHints\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/hints.go:111\n
github.com/pingcap/tidb/planner/core.genHintsFromSingle\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/hints.go:264\n
github.com/pingcap/tidb/planner/core.GenHintsFromFlatPlan\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/planner/core/hints.go:44\ngithub.com/pingcap/tidb/executor.getEncodedPlan\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1778\ngithub.com/pingcap/tidb/executor.(*ExecStmt).SummaryStmt.func1\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1835\ngithub.com/pingcap/tidb/util/stmtsummary.newStmtSummaryByDigestElement\n\t
/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:635\ngithub.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigest).add.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:590\ngithub.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigest).add\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:601\ngithub.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigestMap).AddStatement\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:344\ngithub.com/pingcap/tidb/util/stmtsummary/v2.Add\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/stmtsummary/v2/stmtsummary.go:537\ngithub.com/pingcap/tidb/executor.(*ExecStmt).SummaryStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1933\ngithub.com/pingcap/tidb/executor.(*ExecStmt).FinishExecuteStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1375\ngithub.com/pingcap/tidb/executor.(*ExecStmt).CloseRecordSet\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1457\ngithub.com/pingcap/tidb/executor.(*recordSet).Close\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:185\ngithub.com/pingcap/tidb/session.(*execStmtResult).Close\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:2490\ngithub.com/pingcap/tidb/server/internal/resultset.(*tidbResultSet).Close\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/internal/resultset/resultset.go:69\ngithub.com/pingcap/tidb/parser/terror.Call\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:315\ngithub.com/pingcap/tidb/server.(*clientConn).executePreparedStmtAndWriteResult\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn_stmt.go:423\ngithub.com/pingcap/tidb/server.(*clientConn).executePlanCacheStmt\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn_stmt.go:233\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmtExecute\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn_stmt.go:225\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1298\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1050\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:662"]

@imhun imhun added the type/bug The issue is confirmed as a bug. label Sep 8, 2023
@ti-chi-bot ti-chi-bot bot added 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.1 may-affects-6.5 may-affects-7.1 labels Sep 11, 2023
@winoros
Copy link
Member

winoros commented Sep 11, 2023

@imhun Can you provide the table schema to help us reproduce the issue?

@imhun
Copy link
Author

imhun commented Oct 19, 2023

@imhun Can you provide the table schema to help us reproduce the issue?

Do you still need the table schema?

CREATE TABLE `bg_auto_form` (

id bigint(20) NOT NULL,
folder_id bigint(20) NOT NULL COMMENT '文件夹id',
form_code varchar(255) NOT NULL COMMENT '表单编码',
form_name varchar(255) DEFAULT NULL COMMENT '表单名称',
release_status varchar(20) DEFAULT NULL,
sort bigint(20) DEFAULT NULL COMMENT '排序号',
version_id varchar(255) DEFAULT NULL COMMENT '版本号id',
tenant_id bigint(20) DEFAULT NULL COMMENT '租户id',
created_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
last_updated_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后修改日期',
created_by bigint(20) NOT NULL COMMENT '创建人',
last_updated_by bigint(20) NOT NULL COMMENT '最后修改人',
version_number int(11) NOT NULL COMMENT '版本',
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ;

CREATE TABLE sys_perm_document_rule (
id bigint(20) NOT NULL,
tenant_id bigint(20) NOT NULL COMMENT '租户id',
user_group_id bigint(20) DEFAULT NULL COMMENT '用户组ID',
user_id bigint(20) DEFAULT NULL COMMENT '用户ID',
document_type_id bigint(20) NOT NULL COMMENT '单据类型ID',
table_type int(11) NOT NULL COMMENT '表类型',
document_id bigint(20) NOT NULL COMMENT '单据ID',
parent_id bigint(20) DEFAULT NULL COMMENT '父节点ID',
permission int(11) DEFAULT NULL ,
version_number int(11) NOT NULL COMMENT '版本号',
created_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
created_by bigint(20) NOT NULL COMMENT '创建用户ID',
last_updated_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新日期',
last_updated_by bigint(20) NOT NULL COMMENT '最后更新用户ID',
shareable_flag tinyint(4) DEFAULT NULL COMMENT '可分享标识',
preservable_flag tinyint(4) DEFAULT NULL COMMENT '可另存标识',
cc_table_name varchar(100) DEFAULT NULL,
inherit_flag tinyint(4) DEFAULT NULL COMMENT '可继承标识',
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */,
KEY idx1_sys_perm_document_rule (tenant_id,document_id),
KEY idx2_sys_perm_document_rule (tenant_id,user_group_id,document_type_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ;

CREATE TABLE sys_data_rule_table (
id bigint(20) NOT NULL,
tenant_id bigint(20) NOT NULL COMMENT '租户id',
document_type_id bigint(20) DEFAULT NULL COMMENT '单据类型ID',
table_type int(11) DEFAULT NULL COMMENT '表类型',
c_table_name varchar(100) NOT NULL COMMENT '表名',
remarks varchar(100) NOT NULL COMMENT '中文名',
description varchar(255) DEFAULT NULL COMMENT '描述',
version_number int(11) NOT NULL DEFAULT '1' COMMENT '版本号',
last_updated_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新日期',
last_updated_by bigint(20) NOT NULL COMMENT '最后更新用户id',
created_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
created_by bigint(20) NOT NULL COMMENT '创建用户id',
icon_code varchar(30) DEFAULT NULL COMMENT '图标',
primary_key varchar(50) DEFAULT NULL COMMENT '主键ID',
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */,
KEY idx1_sys_data_rule_table (tenant_id),
KEY idx2_sys_data_rule_table (tenant_id,c_table_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ;

@fixdb
Copy link
Contributor

fixdb commented Oct 28, 2023

/assign @time-and-fate

@qw4990 qw4990 added affects-7.1 priority/release-blocker This issue blocks a release. Please solve it ASAP. and removed 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.1 may-affects-6.5 may-affects-7.1 labels Nov 16, 2023
@time-and-fate
Copy link
Member

Closing this issue according to @qw4990 as explained in #48640.

@kennedy8312
Copy link

/type regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 affects-7.5 priority/release-blocker This issue blocks a release. Please solve it ASAP. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug. type/regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants