apache / apache/linkis

[Bug] the method of `log` in Entrance can be lost log info

Open
#3,742 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
3.4k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

### Search before asking

- [X] I searched the [issues](https://github.com/apache/incubator-linkis/issues) and found no similar issues.

### Linkis Component

linkis-computation-governance

### Steps to reproduce

If the script is executed for more than 5 minutes, and the log is actively added, the previous log will be lost.

### Expected behavior

Call the `log` method, we can get the log normally

### Your environment

- Linkis version used: 1.1.1

### Anything else

More than 5 minutes, the `cachedLogs` will write to hdfs . And execute `fakeClear` method that it set all element to null, but not reset the Attributes of `flag`, `tail`, `realSize`, so when realLog, it still read log from `cachedLogs`, but it empty.
(默认超过5分钟,增加新日志会执行清除缓存并刷hdfs,但是清除缓存不会重置cachedLogs的`flag`, `tail`, `realSize`,所以当获取日志时,!sharedCache.cachedLogs.nonEmpty 不会为空,也就是不会从hdfs读取,还是从内存读取)

![image](https://user-images.githubusercontent.com/29919212/198913085-147ab10c-3a03-4424-a2de-c878931a05c8.png)

![image](https://user-images.githubusercontent.com/29919212/198913860-482f0e31-0ed9-4ac5-ba76-caf86ffd2290.png)

### Are you willing to submit a PR?

- [ ] Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.