VERIFIED SOLUTION i
X

Resolve scenario where MapInfo Pro or MapXtreme .NET is unable to construct TableInfo from a MapInfo .Tab file

Issue

The user has a set of four Windows services written in C# all running simultaneously on a single machine. Eash service have a queue of messages. Each message instigates an algorithm that requires many calls to MapXtreme 7.3.

The overall algorithm is to take a nationwide set of rasters, cut them into tiles, contour each tile, and then iteratively quarter the contour region objects (via splitting) until they all have fewer than N vertices (where N = 2500 in testing).
When the user run the algorithm without quartering, there are no errors. When the algorithm executed with quartering, it throws random errors.

Two ways to do the quartering – using MapXtreme or using MapInfo Pro.

If use MapXtreme, it throws below error message:
MapInfo.Data.TableInfoException: Unable to construct TableInfo from file (\\CCATS5\CCATSTemp\2a4c9a40e1e34ad99b072857d78570e0\RTmp_N97_26_Smt_CtrB.tab).
at MapInfo.Data.TableInfo.CreateFromFile(String filename, String tableAlias)
at MapInfo.Data.Catalog.OpenTable(String fileName, String tableAlias, TableSessionInfo sessionInfo)
at MapInfo.Data.Catalog.OpenTable(String fileName)
at SGSI.MapXtreme.TableGeometryConverter.Run(String inputPath, String outputPath) in c:\work\SGSI\Shared\SGSI.MapXtreme64\TableGeometry\TableGeometryConverter.cs:line 49

When MapInfo Pro is used(and this is odd), the user also get random error messages. In this case, a MIPro.Do() command will fail, usually during an Open Table or Close Table command, with the following Exception:
SGSI.MapInfoProException: MapInfo Professional raised an exception trying to parse/run this command: [Close Table RTmp_N97_27_Skm_Smt_CtrB]. ---> System.Runtime.InteropServices.COMException: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at SGSI.MapInfoPro.Do(String mapBasicCommand, Int32 retryCount, TimeSpan retryInterval) in c:\work\SGSI\Shared\SGSI.Library\MapInfoPro.cs:line 2105
--- End of inner exception stack trace ---
at SGSI.MapInfoPro.Do(String mapBasicCommand, Int32 retryCount, TimeSpan retryInterval) in c:\work\SGSI\Shared\SGSI.Library\MapInfoPro.cs:line 2118
at SGSI.MapInfoPro.Do(Boolean retry, String mapBasicCommand) in c:\work\SGSI\Shared\SGSI.Library\MapInfoPro.cs:line 2130
at SGSI.MapInfoObjectConverter.Run(String inputPath, String outputPath) in c:\work\SGSI\Shared\SGSI.Library\TableGeometry\MapInfoObjectConverter.cs:line 125

The user run this algorithm several times simultaneously in parallel, however, when run a single processor, it still generated the same exception.
 

Cause

The possible root causes of the issue might be one of the follows:

1. Sharing same instance of Session among multiple threads:
On a multi-threaded desktop application there is one instance per thread. You cannot share the same instance between multiple threads. If your application uses threads or the system thread pool to execute worker methods, each method will have its own session instance.Each instance manages its own state; for example, opening a table in one thread does not open the table in other threads. 

You must call Session.Dispose() at the end of your worker method to free used memory. 

2. Number of File handles:
 The user is having doubt regarding the number of files opened at a time. He may try to increase the limit of maximum number of files handles.

Resolution

UPDATED: April 13, 2017


  • Call Session.Dispose() at the end of your worker method to free used memory. 
  • Increase the maximum number of file handles opened at a time by setting MI_MAX_FILE_HANDLES environment path variable to 2040 file handles.

 

Environment Details

Product Feature: Features

 

Downloads

  • No Downloads