Opened 12 years ago

Closed 11 years ago

#174 closed defect (worksforme)

Race condition on successive feature readers

Reported by: ksgeograf Owned by:
Priority: medium Milestone: 2.0
Component: Server Version: 1.2.0
Severity: major Keywords: MgFeatureReader C# API
Cc: External ID: 939565

Description

The following code will crash the server:

foreach(MgLayerBase l in map.GetLayers())
{
  MgFeatureReader rd = ftr.SelectFeatures(new MgResourceIdentifier(l.GetFeatureSourceId()), l.GetFeatureClassName(), qry);

  while (rd.ReadNext())
  {
     ... read some feature attributes ...
  }
}

If I insert a "Sleep(5000);" before the select everything works fine (and slow :D).

Change History (5)

comment:1 Changed 12 years ago by zjames

Are you calling the reader's close function before creating a new one?

comment:2 Changed 12 years ago by ksgeograf

Yes, I am. Both rd.Close() and rd.Dispose().

The problem persists, even if I don't close the reader. If I remove the rd.ReadNext?(), the problem goes away. If I remove the code to read feature attributes, the problem persists.

So, the open, read, open sequence seems to cause the server crash.

I found the following in the log:

<2007-05-26T14:55:22> 			Administrator
 Error: Invalid argument(s):
        	[1] = "222959432"
        The feature reader ID was not found.
 StackTrace:
  - MgFeatureServiceHandler.ProcessOperation line 83 file c:\build_bond_area\mapguide_open_source_v1.2\build_13.7\mgdev\server\src\services\feature\FeatureServiceHandler.cpp
  - MgOpGetFeatures.Execute line 102 file c:\build_bond_area\mapguide_open_source_v1.2\build_13.7\mgdev\server\src\services\feature\OpGetFeatures.cpp
  - MgServerFeatureService.GetFeatures line 841 file c:\build_bond_area\mapguide_open_source_v1.2\build_13.7\mgdev\server\src\services\feature\ServerFeatureService.cpp	Invalid argument(s):
	[1] = "222959432"
The feature reader ID was not found.

I should have checked there before I posted the error, I appologize.

comment:3 Changed 12 years ago by rexszeto

External ID: 939565

comment:4 Changed 12 years ago by tomfukushima

Milestone: 1.21.3

comment:5 Changed 11 years ago by ksgeograf

Resolution: worksforme
Status: newclosed

I have not seen this problem for a very long time, and thus belive the problem to be fixed by coincidence.

Note: See TracTickets for help on using tickets.