{"record":{"id":"8a4bc4c2e25a1abb","repo":"puppetlabs/puppet","slug":"timed-out-waiting-for-resource-name-to-trans","errorCode":null,"errorMessage":"Timed out waiting for #{@resource[:name]} to transition states","messagePattern":"Timed out waiting for #(.+?) to transition states","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/service/smf.rb","lineNumber":178,"sourceCode":"      :next => next_state == \"-\" ? nil : next_state\n    }\n  end\n\n  # Wait for the service to transition into the specified state before returning.\n  # This is necessary due to the asynchronous nature of SMF services.\n  # desired_states should include only online, offline, disabled, or uninitialized.\n  # See PUP-5474 for long-term solution to this issue.\n  def wait(*desired_states)\n    Timeout.timeout(60) do\n      loop do\n        states = service_states\n        break if desired_states.include?(states[:current]) && states[:next].nil?\n\n        Kernel.sleep(1)\n      end\n    end\n  rescue Timeout::Error\n    raise Puppet::Error, \"Timed out waiting for #{@resource[:name]} to transition states\"\n  end\n\n  def start\n    @properties_to_sync[:ensure] = :running\n  end\n\n  def stop\n    @properties_to_sync[:ensure] = :stopped\n  end\n\n  def restart\n    # Wait for the service to actually start before returning.\n    super\n    wait('online')\n  end\n\n  def status\n    return super if @resource[:status]","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/service/smf.rb#L160-L196","documentation":"The SMF provider is asynchronous-aware: after start/stop/restart it polls service_states once per second inside Timeout.timeout(60) until the current state reaches a desired state and no next-state transition is pending. Timeout::Error is converted to Puppet::Error, meaning SMF acknowledged the request but the service did not settle within 60 seconds (see PUP-5474 for the long-term design).","triggerScenarios":"start/stop/restart on a Solaris service stuck transitioning: dependencies offline (state online*next-state never clears), a service entering maintenance mid-transition, restarter hung, or slow SMF repositories — any case where states[:next] stays non-nil or current never equals the desired state for 60s.","commonSituations":"Services with unmet dependencies (svcs -x shows offline reasons); services dropping to maintenance after svcadm clear cycles; overloaded zones or slow SMF milestone resolution; NFS-backed repositories stalling state reads.","solutions":["Diagnose immediately: svcs -x <fmri> and svcs -l <fmri> to see current, next, and reasons","Clear maintenance: svcadm clear <fmri>, fix the dependency it names, then re-run puppet","If the transition is legitimately slow, split the wait: disable the service, run, or manage the dependency service first","Re-run the agent once root causes are fixed — the timeout itself needs no code change"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# pre-check: service must not be blocked before puppet touches it\nsvcs -H -o state \"${fmri}\"\nsvcs -x \"${fmri}\" 2>/dev/null | grep -q . && echo \"service has unresolved dependencies — clear before run\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare SMF dependency services as puppet resources so ordering resolves before the dependent starts","Alert on maintenance/offline states (svcs -x non-empty) as a pre-run gate","After svcadm clear, re-run the agent rather than editing the 60s timeout in the provider"],"tags":["puppet","solaris","smf","timeout","state-transition"],"backgroundTag":"service-state-transition-timeout","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}