Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ForEach-Object -Parallel situationally drops pipeline input #12801

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Note: I can only reproduce this reliably on macOS 10.15.4.
I see it occasionally on Ubuntu 18.04, and can never reproduce it on Windows.

It may be connected to using Start-Sleep inside the script block; not sure if the fact that a custom class is used across thread boundaries is relevant [update: it is]

Steps to reproduce

class Foo { static [object] Echo($val) { return $val } }
$cls = [Foo]
while ($true) { 
  $res = 1..10 | ForEach-Object -Parallel {
    Start-Sleep -ms 100; ($using:cls)::echo($_) 
  }  |  Sort-Object
  Compare-Object $res (1..10) | Should -BeNullOrEmpty
  Write-Host -NoNewline . 
}

Expected behavior

The loop should run indefinitely, because the test should alway succeed.

Actual behavior

The loop eventually - after a varying number of iterations - breaks due to intermittent test failures, stemming from a missing output; e.g.:

Expected $null or empty, but got @(@{InputObject=5; SideIndicator==>})

That is, not all input objects were echoed.

Environment data

PowerShell Core 7.1.0-preview.3  on macOS 10.15.4
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.