Ticket #291 (assigned Defect: null)

Opened 5 years ago

Last modified 4 years ago

With ArcGIS 9.3 installed, when you use COM Automation to invoke an MGET tool that itself invokes ArcGIS, your process will crash when it exits

Reported by: jjr8 Owned by: jjr8
Priority: Medium Milestone: Unscheduled
Component: Core - ArcGIS Interop Version:
Keywords: Cc:

Description (last modified by jjr8) (diff)

I can reproduce this scenario in two ways. First, by running this VBScript:

Set logger = WScript.CreateObject("GeoEco.Logger")
logger.Initialize()

Set hdf = WScript.CreateObject("GeoEco.HDF")
hdf.SDSToArcGISRaster "C:\\MGETTest\\Conversion\\HDF\\A20050012005008.L3m_8D_SST_9.bz2", "C:\\MGETTest\\Conversion\\Raster\\FromHDFViaCOM\\sst", "l3m_data", -180, -90, 0.0833333333333333333333, 65535, False, False, False, False, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"

When the script completes, an Application Error dialog comes up:

---------------------------
cscript.exe - Application Error
---------------------------
The instruction at "0x734ea266" referenced memory at "0x1016fb84". The memory could not be "read".


Click on OK to terminate the program
---------------------------
OK   
---------------------------

The second way is by running this script in R:

library(rcom)
hdf <- comCreateObject("GeoEco.HDF")
comInvoke(hdf, "SDSToArcGISRaster", "C:\\MGETTest\\Conversion\\HDF\\A20050012005008.L3m_8D_SST_9.bz2", "C:\\MGETTest\\Conversion\\Raster\\FromHDFViaCOM\\sst", "l3m_data", -180, -90, 0.0833333333333333333333, 65535, FALSE, FALSE, FALSE, FALSE, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")

The script completes successfully, but when you close R, you get an identical Application Error dialog:

---------------------------
Rgui.exe - Application Error
---------------------------
The instruction at "0x734ea266" referenced memory at "0x0ea5fb84". The memory could not be "read".


Click on OK to terminate the program
---------------------------
OK   
---------------------------

Note that the error message The instruction at "0x734ea266" referenced memory at "0x0ea5fb84". The memory could not be "read". is exactly the same in the two dialog boxes. This strongly indicates that the same error is occurring.

Both of these scenarios were adapted from the Invoking MGET tools programmatically example. Both reproduce 100% with ArcGIS 9.3 installed, but do not with ArcGIS 9.2 installed. Both reproduce with pywin32 build 210 (available since 2006) and the latest build 212 (available since 2008). This suggests that ArcGIS 9.3 is the problem.

I ran the VBScript example under the debugger and got this stack trace (the deepest call is listed at the top):

>	msvbvm60.dll!RUN_INSTMGR::CPOfSink()  + 0xff bytes	
 	msvbvm60.dll!RUN_INSTMGR::DetachSink()  + 0x21 bytes	
 	msvbvm60.dll!RUN_INSTMGR::UnAdviseSinks()  + 0x7f bytes	
 	msvbvm60.dll!BASIC_CLASS::PRIVATE_UNKNOWN::Release()  + 0x161 bytes	
 	msvbvm60.dll!_BASIC_CLASS_Release@4()  + 0xd bytes	
 	msvbvm60.dll!_EVENT_SINK2_Release@4()  + 0xf bytes	
 	FdaCore.dll!711f4cc0() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for FdaCore.dll]	
 	FdaCore.dll!711ecd32() 	
 	FdaCore.dll!711ed338() 	
 	FdaCore.dll!7122a618() 	
 	FdaCore.dll!711e6621() 	
 	FdaCore.dll!7122afc6() 	
 	ole32.dll!CClassCache::CDllPathEntry::CanUnload_rl()  + 0x3f bytes	
 	ole32.dll!CClassCache::FreeUnused()  + 0x9b bytes	
 	ole32.dll!_CoFreeUnusedLibrariesEx@8()  + 0x2e bytes	
 	ole32.dll!_CoFreeUnusedLibraries@0()  + 0x9 bytes	
 	GxIMS.dll!0f63c549() 	
 	GxIMS.dll!0f68195d() 	
 	GxIMS.dll!0f681d21() 	
 	ntdll.dll!_LdrpCallInitRoutine@16()  + 0x14 bytes	
 	ntdll.dll!_LdrShutdownProcess@0()  - 0xfe bytes	
 	kernel32.dll!__ExitProcess@4()  + 0x42 bytes	
 	kernel32.dll!7c81cb0e() 	
 	cscript.exe!01001fb2() 	
 	cscript.exe!01001f8f() 	
 	kernel32.dll!_lstrlenW@4()  + 0x2d bytes	
 	kernel32.dll!_BaseProcessStart@4()  + 0x23 bytes	

This is some kind of weird COM problem, probably having to do with closing events or connection points when the process is shutting down. I have no immediate idea what to do about this. The best course of action is probably to create as small a repro scenario as possible and submit it to ESRI.

If you invoke MGET through COM Automation, watch out for this problem. As far as I know, the crash occurs only on shutdown, only with MGET tools that use ArcGIS, and only if ArcGIS 9.3 is installed. I suspect the crash will occur with any program that invokes MGET under these conditions, not just VBScript or R.

Change History

Changed 5 years ago by jjr8

  • status changed from new to assigned

Changed 5 years ago by jjr8

  • description modified (diff)

Changed 5 years ago by jjr8

  • summary changed from With ArcGIS 9.3 installed, after you invoke through COM Automation an MGET tool that uses ArcGIS, your process will crash when it exits to With ArcGIS 9.3 installed, when you use COM Automation to invoke an MGET tool that itself invokes ArcGIS, your process will crash when it exits

Changed 5 years ago by jjr8

  • milestone changed from 0.6 to 0.7

Postponing this to MGET 0.7. I am not sure what I can do about it, and I do not want to delay the MGET 0.6 release for it.

Changed 4 years ago by jjr8

  • description modified (diff)
  • milestone changed from 0.7 to Unscheduled

This problem still occurs with ArcGIS 9.3.1 (a.k.a. 9.3 SP2). I am going to keep this ticket open so I keep testing for the problem, but most likely there is nothing I can do about it. I may try to prepare a bug report for ESRI, but I doubt I'll get any traction with them, due to the complexity of the scenario (VB/R/whatever --> COM --> pywin32 --> MGET --> ArcGIS).

The problem does not occur when invoking MGET tools that do not invoke ArcGIS. For example, this VBScript code will succeed:

Set logger = WScript.CreateObject("GeoEco.Logger")
logger.Initialize()

Set hdf = WScript.CreateObject("GeoEco.HDF")
hdf.ExtractHeader "C:\\HabModExample2\\OceanographyFiles\\SST\\8Day\\1999217-1999224.m0483pfv50-qual.hdf", "C:\\Temp\\header.txt", True
Note: See TracTickets for help on using tickets.