【发布时间】:2015-10-19 20:05:45
【问题描述】:
我有一台运行大约 500 个 powershell 进程的服务器。这些过程中的每一个都旨在在我们的环境中进行 WMI 调用。我一直小心地确认我没有用完服务器的所有可用内存或 CPU。当我运行所有 500 个进程时,我的内存使用率约为 70%。
以防万一有人想知道如何处理各个进程,它们是使用齿轮工作人员执行的。基本上是一个调用powershell脚本的shell python脚本……500倍。
我遇到的问题是我的一些 powershell 进程在运行几个小时后崩溃了。
我遇到的一些错误是:
A new guard page for the stack cannot be created
当我打开事件查看器时,我会在进程崩溃时看到这些事件
Fault bucket , type 0
Event Name: PowerShell
Response: Not available
Cab Id: 0
Problem signature:
P1: powershell.exe
P2: 6.3.9600.16394
P3: System.OutOfMemoryException
P4: System.OutOfMemoryException
P5: oft.PowerShell.ConsoleHost.ReportExceptionFallback
P6: lization.EncodingTable.nativeCreateOpenFileMapping
P7: Consol.. main thread
P8:
P9:
P10:
Attached files:
These files may be available here:
C:\path
Analysis symbol:
Rechecking for solution: 0
Report Id: ID
Report Status: 2048
Hashed bucket:
我猜这与powershell内存不足有关,但是服务器没有达到峰值,并且并非所有进程都崩溃,它是零星的。
任何帮助将不胜感激。
这里有更多crash结果,powershell故障模块名称时不时有不同:
Problem Event Name: APPCRASH
Application Name: powershell.exe
Application Version: 6.3.9600.16384
Application Timestamp: 52158733
Fault Module Name: ntdll.dll
Fault Module Version: 6.3.9600.16408
Fault Module Timestamp: 523d45fa
Exception Code: c00000fd
Exception Offset: 00069abb
OS Version: 6.3.9600.2.0.0.272.7
Locale ID: 1033
Additional Information 1: 624b
Additional Information 2: 624b484d3cf74536f98239c741379147
Additional Information 3: a901
Additional Information 4: a901f876e92d1eb79eb3a513defef0c6
Problem signature:
Problem Event Name: APPCRASH
Application Name: powershell.exe
Application Version: 6.3.9600.16384
Application Timestamp: 52158733
Fault Module Name: combase.dll
Fault Module Version: 6.3.9600.16408
Fault Module Timestamp: 523d3001
Exception Code: c00000fd
Exception Offset: 0001a360
OS Version: 6.3.9600.2.0.0.272.7
Locale ID: 1033
Additional Information 1: 81ca
Additional Information 2: 81cae32566783b059420874b47802c3e
Additional Information 3: b637
Additional Information 4: b6375e6f6a866fc9d00393d4649231b8
【问题讨论】:
-
我不确定您正在使用的上下文(不熟悉 gearman 工作人员),但您可以使用本机 PowerShell 利用作业轻松发出 WMI 调用。不知道可能会帮助您的脚本。查看 Get-WmiObject cmdlet 或 Start-Job cmdlet 上的 -AsJob 参数。
-
作业工作者是在使用 32 位还是 64 位的 PowerShell?如 OutOfMemoryException 所示,失败的进程肯定会耗尽托管内存。 :-)
-
@KeithHill 我相信这些进程是作为 32 位 powershell 作业启动的。有没有办法可以确认,是否需要调用不同的路径来执行 64 位 powershell 进程?
-
@KeithHill 我正在从 cmd 提示窗口调用 powershell.exe。我刚刚验证了我正在运行的版本是 64 位 powershell。
-
所有的脚本进程都一样吗(可能参数不同)?为每个脚本启动一个 powershell.exe 进程可能不是最好的选择。查看 Workflows 甚至使用 RunspacePools。
标签: powershell