Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-3063

Facter unable to get processor speed on macOS 11 arm64 which causes the resolver to blow up

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • FACT 4.2.2
    • FACT 4.2.4
    • None
    • Night's Watch
    • 2
    • NW - 2021-08-25
    • Manual Test
    • Bug Fix
    • Fix an issue where Facter running on macOS ARM64 would report invalid values for the processors fact due to `sysctl` providing inconsistent results compared to the 64-bit architecture.
    • Needs Assessment

    Description

      Facter queries the following items on macOS using sysctl:

              ITEMS = { logical_count: 'hw.logicalcpu_max',
                        physical_count: 'hw.physicalcpu_max',
                        brand: 'machdep.cpu.brand_string',
                        speed: 'hw.cpufrequency_max',
                        cores_per_socket: 'machdep.cpu.core_count',
                        threads_per_core: 'machdep.cpu.thread_count' }.freeze 

      The outputs get passed like this to build_fact_list:

                def build_fact_list(processors_data)
                  build_logical_count(processors_data[0])
                  build_physical_count(processors_data[1])
                  build_models(processors_data[2])
                  build_speed(processors_data[3])
                  build_cores_per_socket(processors_data[4])
                  build_threads_per_core(processors_data[5], processors_data[4])
                end
      

      The problem surfaces when processors_data is missing one of the outputs from ITEMS and methods end up being called with nil.

      In our case hw.cpufrequency_max is empty so the entire processors_data output is shifted and one element short.

      We need to ensure the resolver works even if not all sysctl queries resolve; and fix the processor speed fact (if possible).

      Resolver in question: https://github.com/puppetlabs/facter/blob/main/lib/facter/resolvers/macosx/processor.rb (nit: the filename should be processors not processor)

      Attachments

        Activity

          People

            dorin.pleava Dorin Pleava
            gabriel.nagy Gabriel Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support