Skip to content

inputs.tail can't read from named pipe #2089

@phemmer

Description

@phemmer

Bug report

Relevant telegraf.conf:

[[inputs.tail]]
  files = ["/var/tmp/foo.fifo"]
  from_beginning = true
  data_format = "influx"

System info:

telegraf-1.0.1_7_g00637b3-0
CentOS/7

Steps to reproduce:

  1. mkfifo /var/tmp/foo.fifo
  2. Launch telegraf with above config

Expected behavior:

To tail the pipe

Actual behavior:

Doesn't tail the pipe

Additional info:

No error output is generated at all. Telegraf silently closes the file descriptor and does nothing.

[pid 27416] openat(AT_FDCWD, "/var/tmp/foo.fifo", O_RDONLY|O_CLOEXEC) = 4
[pid 27416] futex(0xc8200d9108, FUTEX_WAKE, 1) = 1
[pid 27420] <... futex resumed> )       = 0
[pid 27414] <... select resumed> )      = 0 (Timeout)
[pid 27416] futex(0x204db78, FUTEX_WAKE, 1 <unfinished ...>
[pid 27414] select(0, NULL, NULL, NULL, {0, 20} <unfinished ...>
[pid 27416] <... futex resumed> )       = 1
[pid 27420] futex(0xc8200f6108, FUTEX_WAKE, 1 <unfinished ...>
[pid 27418] <... futex resumed> )       = 0
[pid 27416] write(2, "2016/11/26 14:38:31 Input [tail] gathered metrics, (1m0s interval) in 28.988\302\265s\n", 80 <unfinished ...>
2016/11/26 14:38:31 Input [tail] gathered metrics, (1m0s interval) in 28.988µs
[pid 27414] <... select resumed> )      = 0 (Timeout)
[pid 27416] <... write resumed> )       = 80
[pid 27414] select(0, NULL, NULL, NULL, {0, 20} <unfinished ...>
[pid 27416] lseek(4, 0, SEEK_SET)       = -1 ESPIPE (Illegal seek)
[pid 27420] <... futex resumed> )       = 1
[pid 27419] <... futex resumed> )       = 0
[pid 27418] futex(0xc8200d8d08, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 27419] futex(0xc8200d8d08, FUTEX_WAKE, 1 <unfinished ...>
[pid 27420] futex(0xc8200d9108, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 27418] <... futex resumed> )       = -1 EAGAIN (Resource temporarily unavailable)
[pid 27419] <... futex resumed> )       = 0
[pid 27419] futex(0x204db78, FUTEX_WAIT, 0, {0, 199933916} <unfinished ...>
[pid 27418] futex(0xc8200d8d08, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 27416] write(2, "2016/11/26 14:38:31 Seeked /var/tmp/foo.fifo - &{Offset:0 Whence:0}\n", 81 <unfinished ...>
[pid 27414] <... select resumed> )      = 0 (Timeout)
2016/11/26 14:38:31 Seeked /var/tmp/foo.fifo - &{Offset:0 Whence:0}
[pid 27414] select(0, NULL, NULL, NULL, {0, 20} <unfinished ...>
[pid 27416] <... write resumed> )       = 81
[pid 27416] futex(0xc8200d8d08, FUTEX_WAKE, 1) = 0
[pid 27416] close(4)                    = 0

I suspect this can be fixed by not attempting to perform a seek if from_beginning = true.
It seems we also have an issue where the error is silently discarded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions