Race condition exception when accessing $Host.UI.psobject.Properties inside a runspace
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- powershell
- Lĩnh vực
- backend
Hướng nghiên cứu
Start with the $Host.UI.psobject.Properties access in the supplied reproduction and the related Pester reproduction, then inspect the ThreadJob runspace and -StreamingHost handling. Run the reproduction on the stated PowerShell and Windows versions, repeating it in fresh sessions because the failure is sporadic. Done means neither reproduction produces the null-array exception.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce (thanks to @SeeminglyScience)
Environment:
- PowerShell 7.3.6 or higher on up-to-date Windows 10 22H2 x64
- ThreadJob 2.0.3 and Microsoft.PowerShell.ThreadJob 2.1.0
Sporadic race condition exception when accessing $Host.UI.psobject.Properties inside a runspace started with Start-ThreadJob:
-
Start new session:
pwsh -nop -
Paste following:
$event = [System.Threading.ManualResetEvent]::new($false)
$jobs = 1..500 | % {
Start-ThreadJob {
$event = $using:event
$null = $event.WaitOne()
$supportsVT = $Host.UI.psobject.Properties['SupportsVirtualTerminal'].Value
} -StreamingHost $Host
}
Start-Sleep -Milliseconds 500
$null = $event.Set()
$jobs | Receive-Job -AutoRemoveJob -Wait
- If you couldn't repro first time, start new PowerShell session, do not try in the same session.
Steps to reproduce with Pester 5.5.0:
Environment:
- PowerShell 7.3.6 or higher on up-to-date Windows 10 22H2 x64
- Pester 5.5.0
- ThreadJob 2.0.3 and Microsoft.PowerShell.ThreadJob 2.1.0
Sporadic race condition exception when accessing $Host.UI.psobject.Properties inside a runspace started with Start-ThreadJob:
-
Start new session:
pwsh -nop -
Paste following:
1..500 | ForEach-Object {
Start-ThreadJob {
1 | Should -BeExactly 1
$supportsVT = $Host.UI.psobject.Properties['SupportsVirtualTerminal'].Value
} -StreamingHost $Host
} | Wait-Job | Receive-Job | Remove-Job -Force
- If you couldn't repro first time, start new PowerShell session, do not try in the same session.
Expected behavior
There should be no exception.
Actual behavior
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
Error details
PS C:\> Get-Error
Exception :
Type : System.Management.Automation.RuntimeException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Cannot index into a null array.
HResult : -2146233087
CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : NullArray
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 26
HistoryId : -1
Line : 1 | Should -BeExactly 1; $supportsVT = $Host.UI.psobject.Properties['SupportsVirtualTerminal'].Value
PositionMessage : At line:1 char:26
+ … eExactly 1; $supportsVT = $Host.UI.psobject.Properties['SupportsVirtu …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
TargetSite : System.Object CallSite.Target(System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite, System.Object, System.String)
Message : Cannot index into a null array.
Data : System.Collections.ListDictionaryInternal
Source : Anonymously Hosted DynamicMethods Assembly
HResult : -2146233087
StackTrace :
at CallSite.Target(Closure, CallSite, Object, String)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
CategoryInfo : InvalidOperation: (:) [], RuntimeException
FullyQualifiedErrorId : NullArray
InvocationInfo :
ScriptLineNumber : 1
OffsetInLine : 26
HistoryId : -1
Line : 1 | Should -BeExactly 1; $supportsVT = $Host.UI.psobject.Properties['SupportsVirtualTerminal'].Value
PositionMessage : At line:1 char:26
+ … eExactly 1; $supportsVT = $Host.UI.psobject.Properties['SupportsVirtu …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Environment data
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
ThreadJob 2.0.3 and Microsoft.PowerShell.ThreadJob 2.1.0
Visuals
- Ngôn ngữ chính
- PowerShell
- Star
- 37
- Fork
- 22
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PowerShell/ThreadJob
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PowerShell/ThreadJob#59 · 1 reaction ·
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
PowerShell/ThreadJob#56 · 1 reaction ·
-
Set alias for ThreadJob command(s)Có thể đã có người làm @kilasuit đã nhận 85 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
PowerShell/ThreadJob#45 · 1 bình luận ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 48/100
PowerShell/ThreadJob#44 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
PowerShell/ThreadJob#43 ·
Tất cả issue của PowerShell/ThreadJob
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
vllm-project/vllm#64845 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
formatSearchQuery drops the :present modifier, so `email:present=true` is sent as `email=true`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
status: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spring-projects/spring-framework#37614 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sutantyo/flight-watch#17 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add `openai_safety_identifier`, the replacement for the `user` field that `openai_user` sendsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
pydantic/pydantic-ai#12091 ·
Maintainer thường phản hồi trong vòng 1 ngày