Skip to content

Conversation

@iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Jan 17, 2018

PR Summary

Related #4268.

  1. Set local pipeline thread stack size to 10MB by default.
  2. Read the PipelineMaxStackSizeMB configuration value from config.

Thread stack OS system default size is:

  • on Windows - 1MB
  • on MacOs - 0.5MB
  • on Linux - 8MB

We should use the same stack size for all platforms to get predictable behavior.
This value should match the Windows PowerShell value for backward compatibility (I expect that .Net Core and Windows PowerShell consume the stack as well as .Net Framework and Windows PowerShell).
Perhaps default 10MB may be too large if we use many local pipelines for paralleling. We can reconsider this later.

PR Checklist

Note: Please mark anything not applicable to this PR NA.

@iSazonov iSazonov force-pushed the set-localpipeline-stack-size branch from 5096276 to 35a3378 Compare January 17, 2018 14:27
public ProtectedEventLogging ProtectedEventLogging { get; set; }
public Transcription Transcription { get; set; }
public UpdatableHelp UpdatableHelp { get; set; }
public UpdatableHelp PipelineMaxStackSizeMB { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PipelineMaxStackSizeMB setting is not a policy in windows powershell, and thus it shouldn't be added to PowerShellPolicies. It should be a setting like psmodulepath, or executionpolicy or ConsolePrompting.

THe PipelineMaxStackSizeMB was stored at SOFTWARE\Microsoft\PowerShell\1\ShellIds in windows powershell, not at SOFTWARE\Policies\...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe previously we agreed that PowerShell Core is a separate product and it should have its policies and not use policies and configs of Windows PowerShell.
Why don't we have consistency between the settings in the file and the registry if we the consistency by default on Unix? I wouldn't be surprised if MSFT decides to port Registry API to make it easier to port applications. (I would take this into account).
Also if the settings are in different places, it is difficult to find it and makes it very difficult to configure.
Another thought is that we must put (later?) config options and GPO policies in different registry keys.

I think we should develop this my comment about priority - maybe open new tracking Issue?
Also we could open new tracking Issue (?) to enumerate config options and to solve where put different options - in policy key or/and in config key.

Today I suggest:

  1. Have PipelineMaxStackSizeMB (and most other options) in registry and file.
  2. Put PipelineMaxStackSizeMB in "Software\Policies\Microsoft\PowerShellCore". Later we can move/duplicate it in "Software\Microsoft\PowerShellCore" - today we haven't code to process the registry branches in priority.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean PipelineMaxStackSizeMB should be put in Registry on Windows. I think this setting should be in the config file only on both Windows and Unix.

As far as I understand, only the GPO related settings will live in Registry and powershell.config.json on Windows for PowerShell Core (registry setting takes precedence). Non-GPO settings that used to be stored in Registry in Windows PowerShell now should live in the config file only in PowerShell Core, such as executionpolicy, ConsolePrompting and many others. You can take a look at PSConfiguration.cs to find more of them.

The type PowerShellPolicies only represents the GPO settings. PipelineMaxStackSizeMB is not a policy setting but a normal powershell setting, so it shouldn't be put in PowerShellPolicies.

Copy link
Collaborator Author

@iSazonov iSazonov Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daxian-dbw I wanted to create an Issue to discuss but the text was too big and I made a document #5947

return i * 1000000;
}
}
internal static int StackSize => GetPipelineMaxStackSizeOption(10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't cache the stack size, then this static property seems not necessary as it only adds one more redirection to call GetPipelineMaxStackSizeOption.

@daxian-dbw
Copy link
Member

daxian-dbw commented Jan 22, 2018

@iSazonov PipelineMaxStackSizeMB is a regular powershell setting in Windows PowerShell. You are treating it as a policy setting instead of a regular setting in powershell core. I disagree with that. I think it should be a regular setting just like executionpolicy or ConsolePrompting.

@iSazonov
Copy link
Collaborator Author

@daxian-dbw What is "policy" in the context?

Software\Policies\Microsoft\PowerShellCore - I believe it is "policy"?

Software\Microsoft\PowerShell\1\ShellIds or
Software\PowerShellCore - I believe it is "regular settings"? Do you say that we shouldn't use Registry for this settings and keep its only in a config file?

@daxian-dbw
Copy link
Member

daxian-dbw commented Jan 23, 2018

What is "policy" in the context?

It's short for "Group Policy Settings". Those are the settings that are originally under "Software\Policies". Each of the settings has a corresponding GPO in "Local Group Policy Editor" in Control Panel. The new PowerShell Core ones will also be available in the editor. We will publish a .admx file for them.

The settings that are not originally under "Software\Policies" are regular powershell settings. As far as I understand, we don't use Registry for those settings but only refer to the config file.

@iSazonov
Copy link
Collaborator Author

Thanks for clarify!

As far as I understand, we don't use Registry for those settings but only refer to the config file.

Is this PowerShell MSFT team solution? And why?

Registry is common place for Windows applications to store settings:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724871(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/ms973902.aspx

This is critical for enterprises. By using GPO/GPP, they can centrally manage (distribute polices and settings too) applications on workstations and server farms.
For example, if they receive feedback from employees that their scripts fail because of a stack overflow, the enterprise administrator can easily propagate the parameter value as a default that does not overlap local settings at the application or user level.

@SteveL-MSFT
Copy link
Member

For PSCore6, we want to have configuration not in the registry. This makes it easier to deploy via zip, for example, as well as support side-by-side more simply. I do agree that for an enterprise, we should support GPO. In which case, there is no issue with having both configuration and policy.

@iSazonov
Copy link
Collaborator Author

This makes it easier to deploy via zip, for example, as well as support side-by-side more simply.

The ability to have settings in the registry does not conflict with zip and side-by-side. (We could even enhance our API to support applications by type and name)

@SteveL-MSFT What your conclusion about #5947? - I'd move it in RFC repo but it's frozen. I would have moved RFC repo here with label like RFC-* - so we get more feedback.

@iSazonov
Copy link
Collaborator Author

I created PowerShell/PowerShell-RFC#111.

Should we wait the RFC?

@SteveL-MSFT SteveL-MSFT added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Feb 21, 2018
@SteveL-MSFT
Copy link
Member

@PowerShell/powershell-committee reviewed this and don't believe that the stack size should even be a configurable setting until there is a clear need to make it settable. Recommendation is to not even have it settable despite what Windows PowerShell did.

@SteveL-MSFT SteveL-MSFT added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Feb 21, 2018
@iSazonov
Copy link
Collaborator Author

iSazonov commented Feb 22, 2018

@SteveL-MSFT Stack size default is different on different platforms - should we set the same default internally to get predictable behavior on all platforms? I think it make sense - see the original Issue.

@SteveL-MSFT
Copy link
Member

@iSazonov yes, @PowerShell/powershell-committee agrees to changing the default on all systems. We thought the only point that needed discussion from the committee was configuration.

@iSazonov iSazonov mentioned this pull request Feb 23, 2018
9 tasks
@daxian-dbw
Copy link
Member

A new PR was submitted based on the committee's review: #6224
I will close this PR.

@daxian-dbw daxian-dbw closed this Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants