fix(systemd socket activation): fix log collection for systemd sockets#24308
fix(systemd socket activation): fix log collection for systemd sockets#24308j-c-fuchs wants to merge 4 commits intovectordotdev:masterfrom
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.
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: |
|
Hi @thomasqueirozb , have you any further questions? Can you follow my argumentation? |
|
Is there something that blocks this PR? Can we do something to move forward? |
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