CreateProcessA ERROR_NOT_ENOUGH_QUOTA

Hi,

? ?I have an application that calls CreateProcess 80 times. Under a protected environment, the application has several parent processes. In that case, CreateProcess fails with?ERROR_NOT_ENOUGH_QUOTA. The computer has plenty of memory and disk space.

? The error does not appear if the application is launched from the Explorer. I would like to find out which of the parents are influencing the application quota.

? Thanks for your time.

? Calin

You might try to open your process in process explorer on tab Job, and see
if there are any limits applied to it (from parent process)


Best regards,
Krystian Bigaj
On Jan 5, 2012 11:06 AM, “Calin Iaru” wrote:

> Hi,
>
> I have an application that calls CreateProcess 80 times. Under a
> protected environment, the application has several parent processes. In
> that case, CreateProcess fails with ERROR_NOT_ENOUGH_QUOTA. The computer
> has plenty of memory and disk space.
>
> The error does not appear if the application is launched from the
> Explorer. I would like to find out which of the parents are influencing the
> application quota.
>
> Thanks for your time.
>
> Calin
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Hi Krystian,

? there’s nothing wrong there. Neither in Task Manager.

Calin


From: Krystian Bigaj
To: Windows System Software Devs Interest List
Sent: Thursday, January 5, 2012 12:46 PM
Subject: Re: [ntdev] CreateProcessA ERROR_NOT_ENOUGH_QUOTA

You might try to open your process in process explorer on tab Job, and see if there are any limits applied to it (from parent process)

Best regards,
Krystian Bigaj
On Jan 5, 2012 11:06 AM, “Calin Iaru” wrote:

Hi,
>
>
>? ?I have an application that calls CreateProcess 80 times. Under a protected environment, the application has several parent processes. In that case, CreateProcess fails with?ERROR_NOT_ENOUGH_QUOTA. The computer has plenty of memory and disk space.
>
>
>? The error does not appear if the application is launched from the Explorer. I would like to find out which of the parents are influencing the application quota.
>
>
>
>? Thanks for your time.
>
>
>? Calin
>—
>NTDEV is sponsored by OSR
>
>For our schedule of WDF, WDM, debugging and other seminars visit:
>http://www.osr.com/seminars
>
>To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I am not sure how a process can have “several” parent processes, since
this would imply that it has been started by more than one process, which
doesn’t make sense. I even find it hard to imagine a process even having
ONE “parent”, particularly because Windows doesn’t really have the concept
of a process parent unless you create a process group, and that takes a
special effort. It is also meaningless to say you are using CreateProcess
without showing us the exact call plus the deinitions and values of all
variables involved, because it is impossible to tell, from the vague
handwave, whether or not yoy have actually crated a process group. The
concept of “parent” is most frequently one that exists solely in the mind
of the programmer.

Whenever you get a message about quota, this suggests that there is some
administrative limit in place, which has nothing to do with either memory
or disk space. You should probably investigate the administrative limits.
I do not know where these are set.

A more serious question is why you would want to create 80 prccesses; this
sounds like a port of a bad Unix design (unix programmers, of which I was
once one, just LOVE to create processes)

Since the concept of “parent” is largely irrelevant, you should first
investigate what administrative limits are in place. Note that with the
concept of process group, the quota policy of the first process in the
group (loosele, the “parent”) is applied to all processes that it creates.
joe

Hi,

I have an application that calls CreateProcess 80 times. Under a
protected environment, the application has several parent processes. In
that case, CreateProcess fails with ERROR_NOT_ENOUGH_QUOTA. The computer
has plenty of memory and disk space.

The error does not appear if the application is launched from the
Explorer. I would like to find out which of the parents are influencing
the application quota.

Thanks for your time.

Calin

NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Hi Joe,

? The application is an unit test to stress some APIs. The only point to create several processes is to see how the APIs react across processes.

? The parent process is sh.exe which for whatever reason launches itself several times. By several parent processes, I mean a chain of processes.

? It’s not a showstopper. I am interested in the cause. If it’s easy to fix …

Regards,
? Calin


From: “xxxxx@flounder.com
To: Windows System Software Devs Interest List
Sent: Thursday, January 5, 2012 5:40 PM
Subject: Re: [ntdev] CreateProcessA ERROR_NOT_ENOUGH_QUOTA

I am not sure how a process can have “several” parent processes, since
this would imply that it has been started by more than one process, which
doesn’t make sense.? I even find it hard to imagine a process even having
ONE “parent”, particularly because Windows doesn’t really have the concept
of a process parent unless you create a process group, and that takes a
special effort.? It is also meaningless to say you are using CreateProcess
without showing us the exact call plus the deinitions and values of all
variables involved, because it is impossible to tell, from the vague
handwave, whether or not yoy have actually crated a process group.? The
concept of “parent” is most frequently one that exists solely in the mind
of the programmer.

Whenever you get a message about quota, this suggests that there is some
administrative limit in place, which has nothing to do with either memory
or disk space.? You should probably investigate the administrative limits.
I do not know where these are set.

A more serious question is why you would want to create 80 prccesses; this
sounds like a port of a bad Unix design (unix programmers, of which I was
once one, just LOVE to create processes)

Since the concept of “parent” is largely irrelevant, you should first
investigate what administrative limits are in place.? Note that with the
concept of process group, the quota policy of the first process in the
group (loosele, the “parent”) is applied to all processes that it creates.
? ? ? joe

Make sure to close the created process and thread handles as soon as you don’t need them. If a handle is not closed, the process object will hang around, still counting against your quota.

To see if there are orphaned process objects, connect a kernel debugger to your SUT, and issue !stacks. You’ll see if there are processes with no alive threads (zombies).

You can also run !vm 1 immediately after the CreateProcess failure, and check if it reports any errors or complains that any counters are too low.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@broadcom.com
Sent: Thursday, January 05, 2012 11:08 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] CreateProcessA ERROR_NOT_ENOUGH_QUOTA

Make sure to close the created process and thread handles as soon as you don’t need them. If a handle is not closed, the process object will hang around, still counting against your quota.

To see if there are orphaned process objects, connect a kernel debugger to your SUT, and issue !stacks. You’ll see if there are processes with no alive threads (zombies).

Also, make sure not to inherit handles

IMHO, launching 80 processes is a small number for this kind of application,
so you shouldn’t be seeing failures unless you have some kind of leak

wrote in message news:xxxxx@ntdev…

Make sure to close the created process and thread handles as soon as you
don’t need them. If a handle is not closed, the process object will hang
around, still counting against your quota.

To see if there are orphaned process objects, connect a kernel debugger to
your SUT, and issue !stacks. You’ll see if there are processes with no alive
threads (zombies).

Thanks to all who contributed to this thread. !job showed that the number of active processes reached the limit.

0: kd> !job ?fffffa8006e2d290 3
Job at fffffa8006e2d290
? TotalPageFaultCount ? ? ?125b7f
? TotalProcesses ? ? ? ? ? 3b9
? ActiveProcesses ? ? ? ? ?10
? TotalTerminatedProcesses 0
? LimitFlags ? ? ? ? ? ? ? 2308
? MinimumWorkingSetSize ? ?0
? MaximumWorkingSetSize ? ?0
? ActiveProcessLimit ? ? ? 10
? PriorityClass ? ? ? ? ? ?0
? UIRestrictionsClass ? ? ?0
? SecurityLimitFlags ? ? ? 0
? Token ? ? ? ? ? ? ? ? ? ?0000000000000000
? Processes assigned to this job:
? ? PROCESS fffffa80060d7b30
? ? ? ? SessionId: 0 ?Cid: 0b00 ? ?Peb: 7fffffd5000 ?ParentCid: 0254
? ? ? ? DirBase: 117839000 ?ObjectTable: fffff8a0028a6f90 ?HandleCount: 435.
? ? ? ? Image: wsmprovhost.exe

Process Explorer confirmed the Job limit.

This is a constraint imposed by?PowerShell 2.0 and WinRM 2.0.?If anyone else is doing $s = New-PSSession ; Invoke-Command -Session $s -ScriptBlock $script; then keep in mind that the $script cannot launch more than 16 processes.

I will look for a tuning parameter targeted at powershell.

I’m just curious why your first check with Process Explorer failed?

You might try to open your process in process explorer on tab Job, and
see if there are any limits applied to it (from parent process)

there’s nothing wrong there. Neither in Task Manager.

Best regards,
Krystian Bigaj

On 11 January 2012 12:15, Calin Iaru wrote:

> !job showed that the number of active processes reached the limit.
> …
> Process Explorer confirmed the Job limit.
>
>

Procexp was accurate the first time. It was not obvious to me.


From: Krystian Bigaj
To: Windows System Software Devs Interest List
Sent: Wednesday, January 11, 2012 6:58 PM
Subject: Re: [ntdev] CreateProcessA ERROR_NOT_ENOUGH_QUOTA

I’m just curious why your first check with Process Explorer failed?

>?You might try to open your process in process explorer on tab Job, and see if there are any limits applied to it (from parent process)

>?there’s nothing wrong there. Neither in Task Manager.

Best regards,
Krystian Bigaj

Hi,

? If others hit problems with Powershell, then these settings are most relevant:

? Set-Item WSMan:\localhost\Shell\MaxProcessesPerShell -Value ;
? Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB -Value ;

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384372(v=vs.85).aspx?
keywords “Installation and Configuration for Windows Remote Management”.

Regards,
? Calin