Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-8170

net.tcp.listen incorrect results on linux

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.0.11
    • Agent (G), Server (S)
    • None
    • Linux kernel 3.14.2

      After linux kernel upgrade to 3.14.2 net.tcp.listen returns 0 on some ports which are actually in listen state.
      strace tells that read from /proc/net/tcp returns only 4050 bytes for each call:

      open("/proc/net/tcp", O_RDONLY|O_LARGEFILE) = 3
      read(3, " sl local_address rem_address "..., 65536) = 4050
      read(3, " 26: 00000000:8BBE 00000000:000"..., 65536) = 4050
      read(3, " 53: 0100007F:2742 0100007F:D4F"..., 65536) = 4050
      read(3, " 80: 0100007F:D42D 0100007F:274"..., 65536) = 4050
      [...]

      and zabbix in proc_read_file() function (src/libs/zbxsysinfo/linux/net.c) assumes that if number of read bytes (read() retcode) less then buffer size then whole file was read. It's incorrect assumption for /proc.
      I think we should not aim to read /proc/net/tcp by one read() call.

      Patch is simple, I can provide it if needed.

            Unassigned Unassigned
            pgulchuk Pavel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: