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

TiProxy infinitely reloads the config file #321

Closed
djshow832 opened this issue Jul 3, 2023 · 4 comments · Fixed by #322
Closed

TiProxy infinitely reloads the config file #321

djshow832 opened this issue Jul 3, 2023 · 4 comments · Fixed by #322
Assignees

Comments

@djshow832
Copy link
Collaborator

djshow832 commented Jul 3, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Use the config file in the working directory.

cp conf/proxy.toml .
./bin/tiproxy --config=proxy.toml > proxy.log

2. What did you expect to see? (Required)

The file size of proxy.log is small.

3. What did you see instead (Required)

The file size of proxy.log keeps increasing rapidly. The logs are all about reloading the config file.
The event of the config file is event="WRITE \"proxy.log\"", which means the log file is modified but the config file is not.

4. What is your version? (Required)

master

OS: macOS

@xhebox
Copy link
Collaborator

xhebox commented Jul 3, 2023

In fact, it is expected. Config file should be located at a separate directory.

@djshow832 djshow832 self-assigned this Jul 3, 2023
@djshow832
Copy link
Collaborator Author

In fact, it is expected. Config file should be located at a separate directory.

I don't think it's common sense for everyone. For example, in the tidb-test, the config file and log file are in the same directory. It just redirects the output to the current directory so that the log file is overwritten for every run and avoids removal.

@xhebox
Copy link
Collaborator

xhebox commented Jul 3, 2023

In fact, it is expected. Config file should be located at a separate directory.

I don't think it's common sense for everyone. For example, in the tidb-test, the config file and log file are in the same directory. It just redirects the output to the current directory so that the log file is overwritten for every run and avoids removal.

I understand. But, then, reloading conigs on k8s becomes difficult if you correct this behavior. I guess the only way to fix is filtering config file on the event again..

@djshow832
Copy link
Collaborator Author

In fact, it is expected. Config file should be located at a separate directory.

I don't think it's common sense for everyone. For example, in the tidb-test, the config file and log file are in the same directory. It just redirects the output to the current directory so that the log file is overwritten for every run and avoids removal.

I understand. But, then, reloading conigs on k8s becomes difficult if you correct this behavior. I guess the only way to fix is filtering config file on the event again..

2 methods:

  • Watch the remove, rename, and create events on the directory and write events on the file.
  • Filter the file name when the event is triggered. I choose this one because it's easier.

I'm filing the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants