Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Strange issue with sp_OAMethod Expand / Collapse
Author
Message
Posted Thursday, June 20, 2013 3:51 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 24, 2013 12:10 AM
Points: 19, Visits: 54
My procedure creates a COM object with sp_OACreate. Then it uses the sp_OAMethod to call a "load" method of the underlying DLL. Finally it uses sp_OADestroy to dispose the COM object.

The procedure works perfectly fine the first round.

During the second round of execution, sp_OACreate succeeds. But sp_OAMethod returns insufficient memory error. I was under the impression that sp_OADestroy would have released the memory, but that doesn’t seem to be the reality.

I tried the following commands after the first round of execution
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
DBCC FREESESSIONCACHE
DBCC FREESYSTEMCACHE (‘ALL’)

But none of them (nor all of them together) help.

The only way out is to restart the SQL Service after each round of execution.

Is there a way around this?
Post #1465555
Posted Thursday, June 20, 2013 9:48 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 7:53 AM
Points: 368, Visits: 1,224
Quick google search threw up this:

http://support.microsoft.com/kb/937277

Have you considered / checked?
Post #1465792
Posted Thursday, June 20, 2013 8:41 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 24, 2013 12:10 AM
Points: 19, Visits: 54
Yes had viewed this. But we use SQL 2008, so I didn't think that was relevant. Didn't find any such fixes for 2008 / 2008R2.
Post #1466019
Posted Thursday, June 20, 2013 9:47 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:11 PM
Points: 6,067, Visits: 5,283
Is the com object in-process(dll) or out-of-process (exe)?

How much time between iterations?

How much memory on the machine and how much is SQL allowed to use?

I have had more problems than I can count with in-process com objects and out-of-process were just slightly less problematic..

And if it is at all possible don't use com objects..

CEWII
Post #1466021
Posted Friday, June 21, 2013 2:27 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 24, 2013 12:10 AM
Points: 19, Visits: 54
The COM is in-process (dll).
System RAM: 15.9 GB
Total Paging Size: 32000 MB
Max SQL Server Memory (in MB): 2147483647


Post #1466088
Posted Friday, June 21, 2013 8:56 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, May 15, 2014 5:11 PM
Points: 6,067, Visits: 5,283
If the COM object is hung up in-process then restarting SQL is the only way to clear it.

I found this http://support.persits.com/show.asp?code=PS051122152 it seems to use sp_oadestroy to destroy thing other than the object, I've not seen that before. I find a secondary similar reference http://www.cknotes.com/?p=437

Also you really should set the max memory for you SQL Server, I would think in the 14-15GB range, depending on what else is running on that box perhaps as low as 13GB..

CEWII
Post #1466230
Posted Saturday, June 22, 2013 4:24 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Monday, July 21, 2014 4:52 PM
Points: 7,079, Visits: 12,569
Can you switch from OLE Automation (sp_OA procs) to SQLCLR and COM interop? The .NET Framework being a managed environment you probably won't have any issues with hung in-process dlls.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1466490
Posted Saturday, June 22, 2013 6:57 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 24, 2013 12:10 AM
Points: 19, Visits: 54
Switching/Redesign/Redevelopment is not a viable option as of now. I have to make this work somehow.
Post #1466495
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse