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

[chrony] unix socket connection is broken #15549

Open
Frankkkkk opened this issue Jun 21, 2024 · 1 comment · May be fixed by #15552
Open

[chrony] unix socket connection is broken #15549

Frankkkkk opened this issue Jun 21, 2024 · 1 comment · May be fixed by #15552
Labels
bug unexpected problem or unintended behavior

Comments

@Frankkkkk
Copy link
Contributor

Frankkkkk commented Jun 21, 2024

Relevant telegraf.conf

[[inputs.chrony]]
    server = "unix:///var/run/chrony/chronyd.sock"
    metrics = ["activity", "tracking", "sources", "sourcestats"]

Logs from Telegraf

[pid 612402] write(9, "\6\1\0\0\0,\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 416 <unfinished ...>
[pid 612402] <... write resumed>)       = 416
[pid 612402] read(9,  <unfinished ...>
[pid 612402] <... read resumed>0xc003368400, 1024) = -1 EAGAIN (Resource temporarily unavailable)

System info

1.13 - 78cbf53

Docker

No response

Steps to reproduce

  1. Use the chrony plugin
  2. Set the server to be unix:///var/run/chrony/chronyd.sock
  3. Launch telegraf as root (or at least as a user that con use the unix socket)
  4. See it hang

Expected behavior

The chrony plugin should work

Actual behavior

The plugin hangs when using the unix socket when:

  • telegraf is launched as root
  • or the connection is manually specified to use the socket

The reasons are two fold:

  • Chrony uses datagram (unixgram) unix socket and not stream (unix) ones.
  • The socket should be duplicated in order not to hang other connections to it

Here is a working example by facebook

Additional info

I guess this is hard to reproduce, because the unix socket is rarely used as telegraf cannot talk to it (thus it instead connects via UDP to the chrony deamon).

The unix socket is however needed to access the serverstats metrics. Most of the other ones can be reached using the udp socket.

@Frankkkkk Frankkkkk added the bug unexpected problem or unintended behavior label Jun 21, 2024
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 21, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
@Frankkkkk Frankkkkk linked a pull request Jun 21, 2024 that will close this issue
1 task
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 21, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 23, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 24, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 24, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 24, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
@powersj
Copy link
Contributor

powersj commented Jun 25, 2024

Thanks for the various issues and PRs

next steps: review PR

Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 25, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 25, 2024
We must use the DGRAM type when connecting to the chrony socket. On top
of that, the socket must be duplicated in order to allow concurrent
calls to it.

Fixes influxdata#15549

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 26, 2024
Chrony ≥ 4.4 introduces a new ServerStats response with u64 numbers and
more fields.

Fixes influxdata#15553

NB: The plugin still doesn't work due to influxdata#15549. To test this commit,
please make sure you use influxdata#15552.

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk added a commit to Frankkkkk/telegraf that referenced this issue Jun 27, 2024
Chrony ≥ 4.4 introduces a new ServerStats response with u64 numbers and
more fields.

Fixes influxdata#15553

NB: The plugin still doesn't work due to influxdata#15549. To test this commit,
please make sure you use influxdata#15552.

Signed-off-by: Frank Villaro-Dixon <[email protected]>
Signed-off-by: Frank Villaro-Dixon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants