Jira (PUP-7141) Refactor required string dup in 3x runtime converter

2 views
Skip to first unread message

Henrik Lindberg (JIRA)

unread,
Jan 27, 2017, 11:37:02 AM1/27/17
to puppe...@googlegroups.com
Henrik Lindberg created an issue
 
Puppet / Improvement PUP-7141
Refactor required string dup in 3x runtime converter
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2017/01/27 8:36 AM
Priority: Normal Normal
Reporter: Henrik Lindberg

The 3x runtime converter must dup all frozen strings as there is user code that mutates (!!!) string parameters. That wastes performance.

It is not known how much problems it would cause if frozen values were handed to the 3.x resource parameters.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 9:25:02 AM5/16/17
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Component/s: Language
Component/s: Compiler

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 9:25:02 AM5/16/17
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
May 16, 2017, 9:26:01 AM5/16/17
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-7141
 
Re: Refactor required string dup in 3x runtime converter

The case to look at is for parameter values being used when performing an apply. This problem does not occur when the compilation is remote (due to serialization of catalog in between compile and apply).

Branan Riley (JIRA)

unread,
May 16, 2017, 5:48:02 PM5/16/17
to puppe...@googlegroups.com
Branan Riley updated an issue
 
Change By: Branan Riley
Team: Puppet Developer Experience Agent

Branan Riley (JIRA)

unread,
May 16, 2017, 5:48:02 PM5/16/17
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
May 18, 2018, 8:42:03 AM5/18/18
to puppe...@googlegroups.com
 
Re: Refactor required string dup in 3x runtime converter

Josh Cooper Can we stop doing this in Puppet 6.0.0? It means that functions and type & providers that mutate frozen string arguments will hit a hard error when using puppet apply. It will also make 3.x functions that do this error when compiling (If attempting to mutate arguments in a 4.x function it will already error if argument is frozen).

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

Henrik Lindberg (JIRA)

unread,
May 18, 2018, 9:53:02 AM5/18/18
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
 
Change By: Henrik Lindberg
Fix Version/s: PUP 5.y
Fix Version/s: PUP 6.0.0

Henrik Lindberg (JIRA)

unread,
May 18, 2018, 9:53:02 AM5/18/18
to puppe...@googlegroups.com
 
Re: Refactor required string dup in 3x runtime converter

I have put up a PR with the changes needed in puppet core.

Henrik Lindberg (JIRA)

unread,
May 21, 2018, 12:21:03 PM5/21/18
to puppe...@googlegroups.com

Maggie Dreyer (JIRA)

unread,
Jun 19, 2018, 12:39:03 PM6/19/18
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
Sep 4, 2018, 4:23:04 PM9/4/18
to puppe...@googlegroups.com
 
Re: Refactor required string dup in 3x runtime converter

As per the discussion in the PR a decision was made to stop duplicating frozen strings both on master side and agent. This affects some modules - and ticket PUP-9098 was logged for the modules in puppet that has affected logic. I also reached out to one forge module that has the same problem: https://github.com/thecodeteam/puppet-vnx/issues/10.

This now again ready to be merged for Puppet 6.0.0.

Henrik Lindberg (JIRA)

unread,
Sep 4, 2018, 4:27:02 PM9/4/18
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
 
Change By: Henrik Lindberg
Release Notes Summary: Types and Provider implementations must not mutate the parameter values of a resource. In Puppet 6.0.0 it is more likely that the parameters of a resource will have frozen (i.e. immutable) string values and any type or provider that directly mutates a resource parameter may fail. Before Puppet 6.0.0 every resource attribute was copied to not make application break even if they did mutate. Look for use of {{gsub!}} in your modules and replace logic with non mutating version, or operate on a copy of the value. (All modules authors of modules on the forge having this problem have been notified).
Release Notes: Deprecation

Henrik Lindberg (JIRA)

unread,
Sep 5, 2018, 5:53:03 AM9/5/18
to puppe...@googlegroups.com
Henrik Lindberg assigned an issue to Unassigned
Change By: Henrik Lindberg
Assignee: Josh Cooper

Jacob Helwig (JIRA)

unread,
Sep 11, 2018, 2:39:02 PM9/11/18
to puppe...@googlegroups.com
Jacob Helwig commented on Improvement PUP-7141
 
Re: Refactor required string dup in 3x runtime converter

This was partially reverted in 779cfb55d0 on master.

Henrik Lindberg (JIRA)

unread,
Sep 11, 2018, 6:38:35 PM9/11/18
to puppe...@googlegroups.com

New PR is up with a removal of the dup when in master mode (i.e. what I originally had). That works because only core resource types are used on the master side (applying the settings catalog) and those in Puppet core that did mutate have been fixed already. If we find code in our code base that mutates and runs into problems with that because of this then that code should be fixed - it is really bad to mutate.

Josh Cooper (Jira)

unread,
Jun 8, 2020, 5:54:02 PM6/8/20
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-7141

A follow-up PR was merged in bd870bf21bac6979b8adc550c85d446f1e8c8aff

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages