Jira (PUP-9405) Remove Future Feature flag for @prefetch_failed_providers in transaction.rb

11 views
Skip to first unread message

Kris Bosland (JIRA)

unread,
Jan 8, 2019, 8:12:04 PM1/8/19
to puppe...@googlegroups.com
Kris Bosland created an issue
 
Puppet / New Feature PUP-9405
Remove Future Feature flag for @prefetch_failed_providers in transaction.rb
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2019/01/08 5:11 PM
Priority: Normal Normal
Reporter: Kris Bosland

Remove Future Feature flag for @prefetch_failed_providers in transaction.rb

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Kris Bosland (JIRA)

unread,
Jan 10, 2019, 5:00:09 PM1/10/19
to puppe...@googlegroups.com
Kris Bosland commented on New Feature PUP-9405
 
Re: Remove Future Feature flag for @prefetch_failed_providers in transaction.rb

Josh Cooper commented in https://github.com/puppetlabs/puppet/pull/7328:

In Puppet 7, I think we should drop the future_features logic, and collapse the clauses. I think it would also be good to rescue ScriptError instead of just LoadError, because a provider could try to load arbitrary ruby code resulting in SyntaxError or call a ruby method that results in NotImplementedError:
rescue ScriptError, StandardError => e Puppet.log_exception(...) @prefetch_failed_providers[type_name][provider_class.name] = true end
We really don't want to rescue Exception, because it could be SystemExitInterruptNoMemoryError, etc. and that can interfere with Ruby itself, e.g. Ctrl-C processing.

Josh Cooper (JIRA)

unread,
Jan 22, 2019, 5:53:03 PM1/22/19
to puppe...@googlegroups.com
Josh Cooper commented on New Feature PUP-9405

Moving this into the backlog, since we don't have a branch for this to land in. We'll take it back up when puppet 7 work starts.

Josh Cooper (JIRA)

unread,
Jan 22, 2019, 5:53:03 PM1/22/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jan 24, 2020, 11:43:03 AM1/24/20
to puppe...@googlegroups.com

Melissa Stone (Jira)

unread,
Apr 29, 2020, 5:04:04 PM4/29/20
to puppe...@googlegroups.com
Melissa Stone commented on New Feature PUP-9405
 
Re: Remove Future Feature flag for @prefetch_failed_providers in transaction.rb

Based on Charlie's comment in https://tickets.puppetlabs.com/browse/PUP-8962?focusedCommentId=600721&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-600721, we want the output if `:future_features` is true.

To make this happen, we should remove the `unless ...` on line 387: https://github.com/puppetlabs/puppet/blob/12ac708d12e12aa0513348872ea0cec36701b5f8/lib/puppet/transaction.rb#L387

In addition, when we rescue `LoadError, Puppet::MissingCommand`, we also want to add the failed provider class to `@prefetch_failed_providers`, which is what is being referred to when we talk about collapsing the clauses.

The other thing, instead of catching LoadError, we should be catching ScriptError, which is the parent of LoadError

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Aug 18, 2020, 9:23:04 PM8/18/20
to puppe...@googlegroups.com
Josh Cooper commented on New Feature PUP-9405

There's a lot of history with this issue. I think the desired behavior is:

  • It should be possible to install a dependency needed by a provider that implements prefetch in a single agent run.
  • If prefetch fails:
    • the overall report status should be marked as failed.
    • the error message should indicate which resource type and provider failed.
    • all resources associated with the provider should be marked as failed.
    • any resources that depend on the failed resource(s) should be marked as skipped due to the failure.
    • unrelated resources should continue to be applied.

Here are my notes about how we got here:

Redmine-6907 prefetch was called on all providers before their dependencies (commands, etc) were installed, so you couldn't install a dependency needed by a provider implementing prefetch in the same run. Puppet was changed to lazily prefetch, but in doing so swallowed all StandardErrors. This caused puppet to think no resources were present, and it would try to create them, even though they might already exist. This was common for REST providers managing remote resources.

PUP-3656 prefetch was modified to only rescue LoadError and MissingCommand. The thinking was there must be something wrong with the provider if it raises an error other than LoadError or MissingCommand. If a provider raised a different exception, then the entire transaction was aborted. However, none of the resources associated with the provider were marked as failed, and neither was the overall report status. This caused puppet to report success even though there were prefetch errors (eg packages).

PUP-7630 All exceptions were rescued. Exceptions other than LoadError and MissingCommand caused the resource to be marked as failed. But failed resources for other reasons were not logged or marked as failed.

PUP-8962 Modified to only rescue StandardError not Exception. Always log the failed provider before re-raising. future_features flag was added but not enabled prior to Puppet 6.0.

PUP-8288 Due to PUP-7630, puppet could rescue provider exceptions (other than MissingCommand and LoadError) and never mark the resource as failed. So the overall report status was "success". This ticket changed puppet so it assumed the transaction failed, and only marked success if the transaction finished

For this ticket, I think we should rescue LoadError and StandardError, log the error with resource type and provider, record that prefetch failed, mark all directly affected resources as failed, etc.

Josh Cooper (Jira)

unread,
Aug 18, 2020, 9:40:02 PM8/18/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Aug 18, 2020, 9:40:03 PM8/18/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Bug Fix
Release Notes Summary: If a providers' prefetch method raises a LoadError or StandardError, the resources associated with the provider will be marked as failed, but unrelated resources will be applied. Previously this behavior was controlled by the future_features flag, and was disabled by default.

Josh Cooper (Jira)

unread,
Aug 18, 2020, 9:41:03 PM8/18/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Aug 27, 2020, 11:45:05 AM8/27/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Aug 28, 2020, 2:38:03 PM8/28/20
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Nov 10, 2020, 5:04:04 AM11/10/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages