Guard launching duplicated fluentd instance with same configuration
Guard launching duplicated fluentd instance with same configuration
Concept;
Inject blocking code to /opt/fluent/bin/fluentd.
Before:
If you launch multiple Fluentd instance with same configuration file, it causes a disaster with inconsistent processed buffer or pos file.
After:
Detect fluentd service's main process and fetch FLUENT_CONF. if configuration is same as spawned process, abort it.
It can block the following conditions are met:
-
fluentd is launched as a systemd service. configuration file is specified via FLUENT_CONF in fluentd.service.
-
manually try to launch fluentd with same configuration file like this:
sudo /usr/sbin/fluentd -c /etc/fluent/fluentd.conf sudo /usr/sbin/fluentd sudo /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf
Note that following case doen't resolved.
- sudo /opt/fluent/bin/fluentd because default configuration path is /etc/fluent/fluent.conf.
- /usr/sbin/fluentd -c /etc/fluent/fluentd.conf
- /usr/sbin/fluentd
- /opt/fluent/bin/fluentd -c /etc/fluent/fluentd.conf
- /opt/fluent/bin/fluentd
This is because there is no appropriate privilege to retrieve command line parameters.
NOTE: Windows is out of scope in this PR.
NOTE: /opt/fluent/bin/fluentd is auto-generated file, so it should be patched.
Observed service restarting in short times. Need to investigating further more.
Update comment in this PR.
Unexpectedly, download-artifact fails.
actions/download-artifact@master
Downloading single artifact
Preparing to download the following artifacts:
- packages-rockylinux-8 (ID: 1274111102, Size: 108455247)
Redirecting to blob download url: https://productionresultssa8.blob.core.windows.net/actions-results/b9412b87-4106-46a2-8fb0-86c757be7f85/workflow-job-run-ff7a8386-1a15-5f2b-97b2-c907b43b2f17/artifacts/6d0d09c616a6cee6f67320471aa47616aa04bd135f06b78e56dad6b651114b8f.zip
Starting download of artifact to: /home/runner/work/fluent-package-builder/fluent-package-builder
(node:1729) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Unable to download artifact(s): Unable to download and extract artifact: Artifact download failed after 5 retries.
It seems that there is no need to stick to download-artifact@master, created PR to use stable download-artifact@v4. https://github.com/fluent/fluent-package-builder/pull/624
NOTE: download warning itself is not related to whether using download-artifact@master.
[bug] Node incompatibility: [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues https://github.com/actions/download-artifact/issues/283
got it, it may be missing runtime package dependency.
checking with timeout.
As v5.0.3 is not released yet, test case in fresh install v5, lts should be skipped.
With debug commit, it has passed on bookworm
https://github.com/fluent/fluent-package-builder/actions/runs/8077515347/job/22068761536?pr=617
On Rocky
https://github.com/fluent/fluent-package-builder/actions/runs/8077515348/job/22068663355
It should pass CI. waiting results.
CI has passed except windows.
Failing on windows, but not related with this PR.
https://github.com/fluent/fluent-package-builder/actions/runs/8077907378/job/22069129797?pr=617 something wrong with ffi gem dependency.
It should be fixed in another PR.
https://github.com/fluent/fluent-package-builder/actions/runs/8077907378/job/22069129797?pr=617 something wrong with ffi gem dependency.
It may be not accurate.
https://github.com/fluent/fluent-package-builder/actions/runs/8076317129/job/22064585573 The version of ffi related gems are same as before.
Failing on windows, but not related with this PR.
It is a bit strange, but it is not reproducible now...
All checks has passed now!
Now considering appropriate solution to make it simple.
A) guard /usr/sbin/fluentd and /opt/fluent/bin/fluentd
- need to inject specific code to block duplicated instance. This means that implementation becomes complicated one (e.g. previous PoC )
B) guard only /usr/sbin/fluentd
- it may be simpler, but can't block via /opt/fluent/bin/fluentd.
waiting CI to pass...