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

bugfix: 作业平台执行MySQL脚本时模板脚本匹配异常导致脚本失败的缺陷 #1158

Closed
Weiney opened this issue Aug 2, 2022 · 1 comment
Assignees
Labels
done 已上线到正式环境并验收通过 kind/bug 程序故障Bug,漏洞 stage/prod Production environment in tencent has been deploy stage/test Test environment in tencent has been deploy

Comments

@Weiney
Copy link

Weiney commented Aug 2, 2022

Version / Branch / tag

3.6.0.X

出了什么问题?(What Happened?)
在蓝鲸作业平台执行MySQL脚本的时候, 蓝鲸会通过内置的MySQL template脚本来执行用户上传的脚本。

脚本内有一个端口匹配的逻辑, 根据用户在作业平台传入的账号端口号去拼接MySQL的连接地址

跳转至问题代码

netstat -ntl | grep ${PORT} | awk '{print $4}'

因为grep为模糊匹配, 忽略了存在类似端口开启的可能, 例如MySQL的3306, 脚本还可以grep到33060,43306......, 导致最后拼接的MySQL连接地址异常, 从而导致脚本执行失败。

如何复现?(How to reproduce?)

执行环境: Ubuntu18.04、 MySQL 5.7
启动MySQL服务,端口3306, 启动影响端口 33060

在两端口同时启动时, Job平台无法正常执行SQL, 因为拼接的MySQL连接地址有误
如果只开启3306端口的话, 则无任何影响

预期结果(What you expect?)
端口匹配应为精确匹配, 无论是否开启类似端口, 作业平台都应正常工作

@Weiney Weiney added the kind/bug 程序故障Bug,漏洞 label Aug 2, 2022
@wangyu096 wangyu096 assigned wangyu096 and unassigned nekzhang Aug 3, 2022
@wangyu096
Copy link
Collaborator

已确认,确实是bug

wangyu096 added a commit that referenced this issue Aug 24, 2022
…-error

bugfix: 作业平台执行MySQL模板脚本地址匹配异常 #1158
@bkjob-bot bkjob-bot added the stage/prod Production environment in tencent has been deploy label Aug 26, 2022
@bkjob-bot bkjob-bot added the stage/test Test environment in tencent has been deploy label Aug 29, 2022
wangyu096 added a commit that referenced this issue Mar 3, 2023
bugfix: 作业平台执行MySQL模板脚本地址匹配异常 #1158
@bkjob-bot bkjob-bot added the done 已上线到正式环境并验收通过 label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done 已上线到正式环境并验收通过 kind/bug 程序故障Bug,漏洞 stage/prod Production environment in tencent has been deploy stage/test Test environment in tencent has been deploy
Projects
None yet
Development

No branches or pull requests

4 participants