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

开启慢日志的审核任务在sqle界面上删除之后,对应的scanner程序出现panic信息 #273

Closed
Marcus9530 opened this issue Jan 26, 2022 · 4 comments
Assignees
Labels
bug Something isn't working verified the issue all pr is verified
Milestone

Comments

@Marcus9530
Copy link
Collaborator

SQLe Version
UI Version: release-1.2201.x 0ad3134
Server Version: release-1.2201.x-ee 658ec45d5a

To Reproduce
Steps to reproduce the behavior:
1.创建一个慢日志功能的审核任务,启动对应的scanner程序
2.在对应的mysql数据源上,造出来一些慢语句
3.在sqle对应的审核任务中查看到对应的慢语句之后,删除该审核任务
4.对应的scanner运行结束,且出现panic信息

panic: runtime error: slice bounds out of range [:18446744073709551615] with length 0

goroutine 51 [running]:
github.com/percona/pmm-agent/agents/mysql/slowlog/parser.(*SlowLogParser).Run(0xc00060e000)
/universe/vendor/github.com/percona/pmm-agent/agents/mysql/slowlog/parser/parser.go:151 +0x507
created by github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/slowquery.(*SlowQuery).Run
/universe/sqle/cmd/scannerd/scanners/slowquery/slowquery_ee.go:51 +0x28

@Marcus9530 Marcus9530 added the bug Something isn't working label Jan 26, 2022
@Marcus9530 Marcus9530 added this to the v1.2201.1 milestone Jan 26, 2022
@sjjian
Copy link
Member

sjjian commented Jan 26, 2022

MySQL版本多少 @Marcus9530

@Marcus9530
Copy link
Collaborator Author

mysql版本:5.7.25 @sjjian

@HuangWeiCen
Copy link
Contributor

HuangWeiCen commented Feb 22, 2022

解决方案

将ContinuousFileReader修改为可以自定义是否跳过空行, 并在初始化ContinuousFileReader对象时设置为跳过, 下图中的p.r.NextLine()将不会再取出空行, 从而使得line[0:lineLen-1]不会再出现 0-1 的情况

问题分析

  1. panic信息中的18446744073709551615是uint64的最大值, 所以猜测应该是SlowLogParser.Run()对一个长度为零的数组进行了[:len-1]的取值
  2. 查看SlowLogParser.Run()代码, 发现确实存在这个操作

对应代码截图

image

@sjjian sjjian closed this as completed Feb 22, 2022
@Marcus9530
Copy link
Collaborator Author

验证版本
UI Version: main 1651c64
Server Version: main-ee 8066a53

验证步骤:
Steps to reproduce the behavior:
1.创建一个慢日志功能的审核任务,启动对应的scanner程序
2.在对应的mysql数据源上,造出来一些慢语句
3.在sqle对应的审核任务中查看到对应的慢语句之后,删除该审核任务
4.对应的scanner正常结束运行,且没有出现panic信息

image
image
image
image

@Marcus9530 Marcus9530 added the verified the issue all pr is verified label Feb 24, 2022
taolx0 pushed a commit that referenced this issue Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified the issue all pr is verified
Projects
None yet
Development

No branches or pull requests

3 participants