René's URL Explorer Experiment


Title: PowerShell class instance methods cannot run concurrently · Issue #3651 · PowerShell/PowerShell · GitHub

Open Graph Title: PowerShell class instance methods cannot run concurrently · Issue #3651 · PowerShell/PowerShell

X Title: PowerShell class instance methods cannot run concurrently · Issue #3651 · PowerShell/PowerShell

Description: This behavior changed between PowerShell versions 5.0 and 5.1. The change was to make PowerShell class method script blocks bound to the runspace in which they were created. If a class instance method is run from within a different runsp...

Open Graph Description: This behavior changed between PowerShell versions 5.0 and 5.1. The change was to make PowerShell class method script blocks bound to the runspace in which they were created. If a class instance met...

X Description: This behavior changed between PowerShell versions 5.0 and 5.1. The change was to make PowerShell class method script blocks bound to the runspace in which they were created. If a class instance met...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3651

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PowerShell class instance methods cannot run concurrently","articleBody":"This behavior changed between PowerShell versions 5.0 and 5.1.  The change was to make PowerShell class method script blocks bound to the runspace in which they were created.  If a class instance method is run from within a different runspace then it gets \"marshaled\" back to the original runspace (via engine events).  The result is that if a single class instance is shared among multiple runspaces (e.g., a runspace pool) with the intention to execute instance methods concurrently, the methods run serially instead.\r\n\r\nI don't know why this changed between 5.0 and 5.1 but it looks to be by design.  @vors  can you please comment?\r\n\r\nRepro steps:\r\n```powershell\r\nPS \u003e (measure-command { .\\RunspaceInstanceTest.ps1 }).TotalSeconds\r\n\r\nRunspaceInstanceTest.ps1 file script:\r\nclass Writer\r\n{\r\n    static WriteLineS([string] $Msg)\r\n    {\r\n        for ($i=0; $i -lt 10; $i++)\r\n        {\r\n            [Console]::WriteLine(\"Static: Loop $i - $Msg\")\r\n            Start-Sleep -MilliSeconds 100\r\n        }\r\n    }\r\n\r\n    WriteLineI([string] $msg)\r\n    {\r\n        for ($i=0; $i -lt 10; $i++)\r\n        {\r\n            [Console]::WriteLine(\"Instance: Loop $i - $Msg\")\r\n            Start-Sleep -MilliSeconds 100\r\n        }\r\n    }\r\n}\r\n\r\n$script = @'\r\n    param ([object] $writerInstance, [string] $Title)\r\n\r\n    class Writer\r\n    {\r\n        static WriteLineS([string] $Msg)\r\n        {\r\n            for ($i=0; $i -lt 10; $i++)\r\n            {\r\n                [Console]::WriteLine(\"Static: Loop $i - $Msg\")\r\n                Start-Sleep -MilliSeconds 100\r\n            }\r\n        }\r\n\r\n        WriteLineI([string] $msg)\r\n        {\r\n            for ($i=0; $i -lt 10; $i++)\r\n            {\r\n                [Console]::WriteLine(\"Instance: Loop $i - $Msg\")\r\n                Start-Sleep -MilliSeconds 100\r\n            }\r\n        }\r\n    }\r\n\r\n    # Create new instance\r\n    #$writerInstance = [Writer]::new()\r\n\r\n    # Instance write\r\n    $writerInstance.WriteLineI(\"$Title\")\r\n\r\n    # Static write\r\n    #[Writer]::WriteLineS(\"$Title\")\r\n'@\r\n\r\n$writer = [Writer]::new()\r\n\r\n$rsp = [runspacefactory]::CreateRunspacePool(1, 10, $host)\r\n$rsp.Open()\r\n\r\nclass Task\r\n{\r\n    [powershell] $powershell\r\n    [System.IAsyncResult] $Async\r\n}\r\n\r\n$tasks = @()\r\n\r\n1..5 | foreach {\r\n\r\n    $task = [Task]::new()\r\n    $tasks += $task\r\n\r\n    $task.powershell = [powershell]::Create()\r\n    $task.powershell.RunspacePool = $rsp\r\n    $task.Async = $task.powershell.AddScript($script).AddArgument($writer).AddArgument(\"Task $_\").BeginInvoke()\r\n}\r\n\r\nforeach ($task in $tasks)\r\n{\r\n    $task.powershell.EndInvoke($task.Async)\r\n    $task.powershell.Dispose()\r\n}\r\n\r\n$rsp.Dispose()\r\n\r\n```\r\nExpected:\r\n5 concurrently running 1 second loops (with sleep) should take about 1 second to run.\r\n\r\nActual Result:\r\nIt takes about 5 seconds to run indicating that the concurrent scripts are running serially.","author":{"url":"https://github.com/PaulHigin","@type":"Person","name":"PaulHigin"},"datePublished":"2017-04-26T16:11:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/3651/PowerShell/issues/3651"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c3ffc1d7-4164-6c18-5fcf-daec16664c6e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCFE8:1CEF06:1B15CF4:258F193:6A5F36E1
html-safe-nonce85e6dda3af5ee9b66ab098bfca5e877d1aa509f80fd8b7a4c8018cd60765e866
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkU4OjFDRUYwNjoxQjE1Q0Y0OjI1OEYxOTM6NkE1RjM2RTEiLCJ2aXNpdG9yX2lkIjoiMzQ2ODk0MzUwNjQ5MjMwNzE2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0cbf2320464ad62ddc20601f8e169e8674e0f6e0443d461280eb98619d7ceae1
hovercard-subject-tagissue:224522300
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/3651/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3db4d1497bded9bd526aa0f22ec3ba99d688f067632c51ed699e48259980f887/PowerShell/PowerShell/issues/3651
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3db4d1497bded9bd526aa0f22ec3ba99d688f067632c51ed699e48259980f887/PowerShell/PowerShell/issues/3651
og:image:altThis behavior changed between PowerShell versions 5.0 and 5.1. The change was to make PowerShell class method script blocks bound to the runspace in which they were created. If a class instance met...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamePaulHigin
hostnamegithub.com
expected-hostnamegithub.com
Noneab2497d9345a59709926b385d88458fa5932c82ec066288448eb68b34cbcbbda
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseba0ac57287507693938b0a2de45402a22cda0785
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/3651#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F3651
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F3651
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/3651
Reloadhttps://github.com/PowerShell/PowerShell/issues/3651
Reloadhttps://github.com/PowerShell/PowerShell/issues/3651
Please reload this pagehttps://github.com/PowerShell/PowerShell/issues/3651
PowerShell https://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Notifications https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Fork 8.4k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Star 54.5k https://github.com/login?return_to=%2FPowerShell%2FPowerShell
Code https://github.com/PowerShell/PowerShell
Issues 1.3k https://github.com/PowerShell/PowerShell/issues
Pull requests 286 https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality 3 https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
Code https://github.com/PowerShell/PowerShell
Issues https://github.com/PowerShell/PowerShell/issues
Pull requests https://github.com/PowerShell/PowerShell/pulls
Discussions https://github.com/PowerShell/PowerShell/discussions
Actions https://github.com/PowerShell/PowerShell/actions
Projects https://github.com/PowerShell/PowerShell/projects
Security and quality https://github.com/PowerShell/PowerShell/security
Insights https://github.com/PowerShell/PowerShell/pulse
PowerShell class instance methods cannot run concurrentlyhttps://github.com/PowerShell/PowerShell/issues/3651#top
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
Resolution-FixedThe issue is fixed.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Fixed%22
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
6.1.0-Considerhttps://github.com/PowerShell/PowerShell/milestone/26
https://github.com/PaulHigin
PaulHiginhttps://github.com/PaulHigin
on Apr 26, 2017https://github.com/PowerShell/PowerShell/issues/3651#issue-224522300
@vorshttps://github.com/vors
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
Resolution-FixedThe issue is fixed.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Fixed%22
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
6.1.0-Considerhttps://github.com/PowerShell/PowerShell/milestone/26
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.