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: 打开历史作业的执行详情页面,报"内部服务器异常" #1229

Closed
wangyu096 opened this issue Aug 29, 2022 · 1 comment
Closed
Assignees
Labels
kind/bug 程序故障Bug,漏洞 stage/prod Production environment in tencent has been deploy stage/test Test environment in tencent has been deploy
Milestone

Comments

@wangyu096
Copy link
Collaborator

Version / Branch / tag

3.6.0

出了什么问题?(What Happened?)

打开历史作业的执行详情页面,报"内部服务器异常"

如何复现?(How to reproduce?)

复现条件:3.6.0版本升级之前的作业打开有问题

预期结果(What you expect?)

打开历史作业的执行详情页面,没有报错且显示正常

@wangyu096 wangyu096 added the kind/bug 程序故障Bug,漏洞 label Aug 29, 2022
@wangyu096 wangyu096 self-assigned this Aug 29, 2022
@wangyu096 wangyu096 added this to the V3.6.0 milestone Aug 29, 2022
@wangyu096
Copy link
Collaborator Author

  • 报错
[2022-08-29 12:25:42.139] ERROR [job-execute,82395772497191ade38f869c6e3ffb84,f3211c9273e220e3] 1052 --- [http-nio-10502-exec-195] b.j.c.w.e.h.WebExceptionControllerAdvice : Handle Exception, uri: /web/execution/scope/biz/1045/step-execution-result/log-content/2549000000/0/0:127.0.0.1

java.lang.NullPointerException: null
        at com.tencent.bk.job.execute.service.impl.ScriptAgentTaskServiceImpl.getAgentTaskByHost(ScriptAgentTaskServiceImpl.java:100)
        at com.tencent.bk.job.execute.service.impl.LogServiceImpl.getScriptHostLogContent(LogServiceImpl.java:148)
        at com.tencent.bk.job.execute.api.web.impl.WebTaskExecutionResultResourceImpl.getScriptLogContentByIp(WebTaskExecutionResultResourceImpl.java:615)
  • 缺陷原因
    @Override
    public AgentTaskDTO getAgentTaskByHost(StepInstanceBaseDTO stepInstance,
                                           Integer executeCount,
                                           Integer batch,
                                           HostDTO host) {
        AgentTaskDTO agentTask = null;
        Long hostId = host.getHostId();
        if (hostId != null) {
            // 根据hostId查询
            agentTask = scriptAgentTaskDAO.getAgentTaskByHostId(stepInstance.getId(), executeCount, batch, hostId);
        } else if (StringUtils.isNotEmpty(host.toCloudIp())) {
            // 根据ip查询的模式,有两种情况,数据可能在gse_script_agent_task/gse_task_ip_log表中,优先查询gse_script_agent_task
            HostDTO queryHost = getStepHostByIp(stepInstance, host.toCloudIp());
            if (queryHost != null) {
                agentTask = scriptAgentTaskDAO.getAgentTaskByHostId(stepInstance.getId(), executeCount, batch,
                    queryHost.getHostId());
            } else {
                // 根据ip查询gse_task_ip_log表中的数据
                agentTask = gseTaskIpLogDAO.getAgentTaskByIp(stepInstance.getId(), executeCount, host.toCloudIp());
            }
        }
        return agentTask;
    }

queryHost.getHostId可能为null

wangyu096 added a commit that referenced this issue Aug 29, 2022
bugfix: 打开历史作业的执行详情页面,报"内部服务器异常" #1229
@bkjob-bot bkjob-bot added the stage/test Test environment in tencent has been deploy label Aug 30, 2022
@bkjob-bot bkjob-bot added the stage/prod Production environment in tencent has been deploy label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants