apache / apache/shenyu

[BUG] `this.doRefreshConfig()` method is not executed after restarting the plugin.

Open
#5,292 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

_No response_

### Expected Behavior

_No response_

### Steps To Reproduce

When I open the plugin for the first time, there is no deposit inside `Singleton.INST`, so the following code can be executed:

```java
this.doRefreshConfig(globalLogConfig);
logCollector().start();
```

![image-20231112144406521](https://raw.githubusercontent.com/YxYL6125/imgBad/main/img/image-20231112144406521.png)

![image-20231112144440081](https://raw.githubusercontent.com/YxYL6125/imgBad/main/img/image-20231112144440081.png)

And it is also possible to execute ``this.close0();`` the first time I close it.

![image-20231112144522677](https://raw.githubusercontent.com/YxYL6125/imgBad/main/img/image-20231112144522677.png)

But when I start the plugin again, the `doRefreshConfig()` method will not be executed since it was saved to `Singleton.INST` the previous time.

![image-20231112144625084](https://raw.githubusercontent.com/YxYL6125/imgBad/main/img/image-20231112144625084.png)

Also, when closing the plugin, since `isStarted` is not set to `true`, it will not be executed either. This ultimately causes the plugin to fail on subsequent startups and shutdowns.

![image-20231112144643719](https://raw.githubusercontent.com/YxYL6125/imgBad/main/img/image-20231112144643719.png)

### Environment

```markdown
ShenYu version(s):2.6.0
```

### Debug logs

_No response_

### Anything else?

My thinking was to `remove` the value inside the `Singleton.INST` when `closing` the plugin. The `doRefreshConfig` method is then executed when the plugin is restarted.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the plugin lifecycle code that uses Singleton.INST, doRefreshConfig(), close0(), and isStarted. Reproduce a plugin start, close, and restart with ShenYu 2.6.0, then verify that configuration refresh and shutdown behavior occur on each lifecycle cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.