Skip to content

[Improvement][UI] Infinite recursive queryLog request and unreasonable limit param cause both frontend and backend oom #17025

Open
@ChaoquanTao

Description

@ChaoquanTao

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

1. Unreasonable limit param in queryLog request

QueryLog request will be triggered when user clicks the View log button in task instance detail modal. The limit param is carried in the request to avoid response of queryLog too large, shown as:

queryLog({
          taskInstanceId: nodeVariables.logTaskId,
          limit: nodeVariables.limit,
          skipLineNum: nodeVariables.skipLineNum
        }).then((res: any) => {
          nodeVariables.logRef += res.message || ''
          if (res && res.message !== '') {
            nodeVariables.limit += 1000
            nodeVariables.skipLineNum += res.lineNum
            getLogs(logTimer)
          } else {
            nodeVariables.logLoadingRef = false
            if (logTimer !== 0) {
              if (typeof getLogsID === 'number') {
                clearTimeout(getLogsID)
              }
              getLogsID = setTimeout(() => {
                nodeVariables.limit += 1000
                nodeVariables.skipLineNum += 1000
                getLogs(logTimer)
              }, logTimer * 1000)
            }
          }
        })

The value of limit increases each time when queryLog fetches next page of log, which may cause param grows too fast and too much. A constant limit should be more reasonable.

2. Infinite recursive queryLog causes frontend and backend oom

When queryLog method gets to the end of the log file, the else branch will be executed. If logTimer !==0, a recursibe call will be invoked, and this won't be stopped, finally leads to the frontend resource exhausted. Together with above unreasonable limit param, it could cause a performance issue in backend (worker exactly), even oom if the log size is too large.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions