-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(systemd socket activation): fix log collection for systemd sockets #24308
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
base: master
Are you sure you want to change the base?
Conversation
See issue vectordotdev#24300. Systemd sockets are passed in blocking mode, but tokio expects them to be in non-blocking mode, see https://docs.rs/tokio/latest/tokio/net/struct.TcpListener.html#notes.
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Please, let me know if I should make a changelog entry for this fix. |
Added a changelog entry. |
thomasqueirozb
left a comment
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.
Hi, thanks for your contribution. While this may fix systemd sockets I worry it may break other system sockets that are configured differently. Have you tested this with all possible SystemFd sockets?
- TCP blocking socket
- TCP non-blocking socket
- UDP blocking socket
- UDP non-blocking socket
Maybe we could have this behavior be configured by a flag
|
Hi Thomas, thank you for your remarks. I tested it once again in all four configurations (without systemd) with a python script opening the sockets and then start-with-socket.py Regarding the question whether to make it configurable: Blocking sockets are unsupported starting from tokio v1.44.0. Therefore, I think a flag to configure this is unnecessary and might have the danger of potential panics. See: |
Summary
Systemd sockets are passed in blocking mode, but tokio expects them to be in non-blocking mode, see https://docs.rs/tokio/latest/tokio/net/struct.TcpListener.html#notes.
Therefore, always set sockets from systemd to non-blocking.
Vector configuration
How did you test this PR?
Start vector with systemd socket activation (udp socket, but tcp socket is the same), send logs and stop vector, see #24300 for more details.
Note: Unfortunately, I don't know how to add tests for this case. Unit tests seem impossible, because opening a socket and then using the corresponding file descriptor for listening violates io_safety. For integration tests, I don't know how to pass the file descriptor to the tests.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References