Re: Not enough storage is available to process this command. (Exceptio



My guess is that it is a memory allocation problem with Windows
Management Instrumentation (WMI). The code makes a managed call to WMI
(ManagementClass) for the network adapter information
(Win32_NetworkAdapter), which then gets invoked as an unmanaged COM+
call into Cimwin32.dll (InteropServices). The 0x80070008 COM
exceptions occur when the thread's local storage is exhausted.

If correct, this would explain why it occurs sporadically. There may
be a memory leak. I am not sure that this is a security issue, as
Martin Xie suggested. If it was, one would think the exception would
occur each time the code executed.

Have you tried applying .Net 2 SP1?

J Wolfgang Goerlich


Related Links:

MSDN Documentation: Win32_NetworkAdapter
http://msdn2.microsoft.com/en-us/library/aa394216(vs.80).aspx

Microsoft Article 812280, EventLogEntry Class May Cause Leaks in
Thread Local Storage and Event ID 4199 Event Log Entries
http://support.microsoft.com/kb/812280

Microsoft Article 824262, Memory Leak When You Use the
Win32_NetworkAdapter Notification Query
http://support.microsoft.com/kb/824262


On Jun 20, 6:12 am, Dan Händevik
<DanHnde...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi,
I have a piece of code that gives an exception in some cases. The code works
most of the time but on some installations the error occurs sometimes (once a
day or so)

The error below is thrown.
[COMException (0x80070008): Not enough storage is available to process this
command. (Exception from HRESULT: 0x80070008)]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo) +0
System.Management.ManagementScope.InitializeGuts(Object o) +784
System.Management.ManagementScope.Initialize() +216
System.Management.ManagementObject.Initialize(Boolean getObject) +619
System.Management.ManagementClass.GetInstances(EnumerationOptions options)
+121
System.Management.ManagementClass.GetInstances() +6

And the code that generates the exception is
ManagementClass managementClass = new ManagementClass("Win32_NetworkAdapter");
ManagementObjectCollection managementObjects = managementClass.GetInstances();

The code is running on a Windows Server 2003 R2, sp1
The error was not observed until the following patches where installed
kb935839, kb929123, kb935840.
The code is run in an asp.net environment.

Has anyone any idea about the source of the error?
What does InitializeGuts do that can result in a com exception like that


.



Relevant Pages

  • WMI query
    ... I've been trying to run a simple query to get the amount of memory on my ... machine using WMI. ... Dim mem As UInt32 = 0 ... Catch ex As Exception ...
    (microsoft.public.dotnet.languages.vb)
  • Re: URGENT: ArgumentException on creating bitmap
    ... but only for JPG images. ... API raises an exception from time to time, probably due to memory ... management issues in the JPG decoder. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: it hurts when I press here
    ... I'm using eval and die extensively, both for aborting some sequence of ... processing steps from nested subroutines and for actual exception ... which uses a more modern approach for automatic resource management ... Localizing $@ without dealing ...
    (comp.lang.perl.misc)
  • Re: How come Ada isnt more popular?
    ... manual memory management. ... But for the sake of discussion completeness, you might wish to throw an example of a situation where scoped lifetime will not make it. ... this was *manual* resource management. ... The difference is that in languages with scoped lifetime the lifetime management is a property of the type, whereas the "FP-trick" above is a property of the use-side. ...
    (comp.lang.ada)
  • RE: SBS Restore and Exchange Error
    ... An error occurred during a call to Windows Management Instrumentation ID ... no: 80041010 Exchange System Manager ... WMI is really complex and time-consuming. ...
    (microsoft.public.windows.server.sbs)