Powershell Defeat Due to Persistent Memory

I have a server running about 500 powershell processes. Each of these processes is designed to invoke WMI in our environment. I tried to verify that I did not use all available server memory or processor. When all 500 processes work for me, I use about 70% of the memory usage.

Just in case, someone wonders how individual processes are processed, they are performed using a worker. Basically a python shell script that calls powershell script ... times 500.

The problem I am facing is that some of my powershell processes crash after several hours.

Some of the errors I get are as follows:

A new guard page for the stack cannot be created

When I open the event viewer, I see these events when process crashes

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:

I suppose this has something to do with powershell ending with out of memory, but the server has not reached the top and not all processes are crashing, this is sporadic.

Any help would be greatly appreciated.

The following are the results of the crash, the names of the powershell crash modules differ from time to time:

  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
+4
source share
4 answers

Have you looked at the maximum memory allocation on the shell?

get-item WSMan:\localhost\Shell\MaxMemoryPerShellMB

and if its change is too small,

set-item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048
+1
source

No .Net has a memory limit ?

0
source

TaskManager , Process Explorer. .

0

, , powershell, . , , .

, Powershell 80% , .

56 , - . 600 PowerShell , .

0

Source: https://habr.com/ru/post/1609361/


All Articles