Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-2570

builtin function readtcp didn't cached negative result

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: 3.10.0b1
    • Fix Version/s: None
    • Component/s: Built-in functions
    • Labels:
      None
    • Environment:
      any

      Description

      Although since cfengine 3.8 we have nice function url_get, old function readtcp still usefull for check plain tcp. Accordingly readtcp doc:
      "The return value is cached."

      But if tcp port unavailable, this negative result did not cached.

      • ftpd on port 21
      • nothing on port 666
      1. cf-agent -K -f unit_test_readtcp.cf
        R: unit_test_readtcp : class server_21_ok detected
        R: unit_test_readtcp : port_21: 220 ProFTPD
        R: unit_test_readtcp : class server_666_wrong detected
        R: unit_test_readtcp : port_666: not available

      Positive result is cached as expected:

      1. cf-agent -K -f unit_test_readtcp.cf -v | grep "Connecting to host localhost, port 21 as address 127.0.0.1" | wc -l
        1

      Negative result did not cached:

      1. cf-agent -K -f unit_test_readtcp.cf -v | grep "Connecting to host localhost, port 666 as address 127.0.0.1" | wc -l
        14

      In case of a huge number of checked ports/servers we have a very large number of tries.

        Attachments

          Activity

            People

            • Assignee:
              a10003 Eystein Maloy Stenberg
              Reporter:
              igorg Igor Goncharenko
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel