-
Notifications
You must be signed in to change notification settings - Fork 26
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
msi: guard duplicated instance #622
Conversation
This is PoC |
a8a63a5
to
55c7a03
Compare
Basically it will work, but there is one concern. If user execute directly c:\opt\fluent\bin\fluentd, it can not be blocked. NOTE: search path is like this:
|
It should use findstr /I |
2813851
to
9a3369d
Compare
Verified when fluentdwinsvc is running, it will abort like this:
|
Hmm, it seems that fluentd.bat exit expectedly, but not capture $LASTEXITCODE correctly.
|
With locally built msi, it work as expected.
|
It's a problem of test code. |
Test code was fixed, waiting CI. |
All checks has passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix.
My first impression is that it should be a simpler change as a patch version update.
I have concerns about the following points.
- Specification change
- If this is to be included in v5.0.3, the specifications should not be changed as much as possible.
- This PR disables Fluentd from starting if certain conditions are met. This change looks to me too large for a patch version update.
- Maintainability
- I am concerned about the maintainability of parsing arguments on this startup script.
For example, what about the following directions?
- Add a confirmation step when the state of the service is
Running
.- In addition, add
force
option so that the service can be launched without confirmation even if the state isRunning
, as the current specification.
- In addition, add
I've forgot to eliminate |
if "%%p"=="--force" ( | ||
set /a FLUENT_FORCE_RUN=1 | ||
) else ( | ||
set "FLUENT_ARGS=!FLUENT_ARGS! %%p" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've forgot to eliminate --force from command line arguments.
It was fixed now.
I see...
I'm sorry for not considering this point.
Is this for the possibility of future option conflicts?
This looks like a very difficult issue to me...
Not passing the option to Fluentd does not solve the conflict completely.
(We can not use the option on the Fluentd side in the future.)
Once an argument is added, it is difficult to change it later, so we should be very careful about it.
We should consider this point carefully after releasing 5.0.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a possibility to conflict with fluentd side. (It is not planned yet)
When adding "dare to execute something" option, longer option name is better in conventionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--force-running-fluentd
or ...
What is the suitable name? 🤔
d54f6e9
to
7c90cde
Compare
Before: Even though fluentdwinsvc is running, you can execute duplicated Fluentd instance. It may cause inconsistency of buffer or pos file. After: Guard multiple Fluentd instance when fluendwinsvc service is running by default. Note that --force-running-multiple-instance option is specified, you can run additional Fluentd instance explicitly. (it is same as previous behavior) Signed-off-by: Kentaro Hayashi <[email protected]>
%FLUENT_PACKAGE_TOPDIR% contains trailing /, so it is redundant to add /. Signed-off-by: Kentaro Hayashi <[email protected]>
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If `--config` (`-c`) or `--dry-run` are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR fluent#622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, and I'm sorry for the delay.
I have made another version #648, based on this fix.
This PR adds an option to force execution for compatibility.
On the other hand, #648 checks -c
(--config
) option existence to decide whether to prevent launching for compatibility.
(There are other conditions, but they are not notable. dry-run
should be considered as well in this PR direction.)
I think both of these directions are possible.
This PR is more strictly preventing launching multiple instances.
#648 doesn't need a new option.
However, we can launch Fluentd with -c
(--config
).
So, a possibility of unintentional duplicate launching remains.
(I believe it is less important to consider such a case, though).
Let's consider how to solve #611 based on the information so far.
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If `--config` (`-c`) or `--dry-run` are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR fluent#622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If some options are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR fluent#622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If some options are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR fluent#622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
Thanks for considering. Note: strict check: https://github.com/fluent/fluent-package-builder/blob/f045a795e8f02c9731262f29a6832d95b40c85a1/fluent-package/msi/assets/fluentd.bat |
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If some options are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR fluent#622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If some options are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR fluent#622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
Before: We can launch Fluentd by fluentd.bat even though fluentdwinsvc is running. Launching multiple Fluentd with the same config may cause inconsistency of the buffers or the pos files. After: We can't launch Fluentd by fluent.bat with the default config path if fluentdwinsvc is running. If some options are specified, we can execute fluentd.bat as before. Inspired by @kenhys's PR #622. Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Kentaro Hayashi <[email protected]>
msi: guard multiple Fluentd instance
Before:
After: