Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1606 closed defect (fixed)

"Stack Reserve Size" should increase to 10M

Reported by: ChristineBao Owned by: Christine Bao
Priority: high Milestone: 2.3
Component: Server Version: 2.2.0
Severity: trivial Keywords:
Cc: Bruce Dechant, Jenny He External ID: 1215506.02

Description

Report from Autodesk QA:

  1. Load the attached treepoints.sdf and create Basic web layout.
  2. View the map in browser, select all the features.

Result:
Repeat with a similar selection set after the first completes and the server memory grows by about 10 or 11MB a request.

Attachments (3)

treepoints.zip (1.1 MB ) - added by ChristineBao 13 years ago.
Fix#1606.patch (1.2 KB ) - added by ChristineBao 13 years ago.
FixLinux.patch (956 bytes ) - added by ChristineBao 13 years ago.

Download all attachments as: .zip

Change History (12)

by ChristineBao, 13 years ago

Attachment: treepoints.zip added

comment:1 by ChristineBao, 13 years ago

Tech assement:

The memory leak associated with large selections is caused by a stack overflow when the MgSelectCommand FDO filter is released and destroyed:

[stack overflow]
	FDO.dll!FdoBinaryLogicalOperator::~FdoBinaryLogicalOperator()  Line 55	C++
	FDO.dll!FdoBinaryLogicalOperator::`scalar deleting destructor'()  + 0x8 bytes	C++
	FDO.dll!FdoDistanceCondition::Dispose()  Line 77	C++
	FDOCommon.dll!FdoIDisposable::Release()  Line 98	C++
	FDO.dll!FdoBinaryLogicalOperator::~FdoBinaryLogicalOperator()  Line 55	C++
	FDO.dll!FdoBinaryLogicalOperator::`scalar deleting destructor'()  + 0x8 bytes	C++
	FDO.dll!FdoDistanceCondition::Dispose()  Line 77	C++
	FDOCommon.dll!FdoIDisposable::Release()  Line 98	C++
	FDO.dll!FdoBinaryLogicalOperator::~FdoBinaryLogicalOperator()  Line 55	C++
	FDO.dll!FdoBinaryLogicalOperator::`scalar deleting destructor'()  + 0x8 bytes	C++
	FDO.dll!FdoDistanceCondition::Dispose()  Line 77	C++
	FDOCommon.dll!FdoIDisposable::Release()  Line 98	C++
	FDO.dll!FdoBinaryLogicalOperator::~FdoBinaryLogicalOperator()  Line 55	C++
	...
	MgServerFeatureServiced.dll!MgSelectCommand::~MgSelectCommand()  Line 57	C++
	MgServerFeatureServiced.dll!MgSelectCommand::`scalar deleting destructor'()  + 0x16 bytes	C++

When you have a large selection the filters can get very large, e.g.:

(FeatId=17282) OR (FeatId=17283) OR (FeatId=17284) OR (FeatId=17285) OR (FeatId=17286) OR
(FeatId=17287) OR (FeatId=17288) OR (FeatId=17289) OR (FeatId=17290) OR (FeatId=17291) OR
(FeatId=17292) OR (FeatId=17293) OR (FeatId=17294) OR (FeatId=17295) OR (FeatId=17296) OR
(FeatId=17297) OR (FeatId=17298) OR (FeatId=17299) OR (FeatId=17300) OR (FeatId=17301) OR
...

and so the hierarchy of objects in the FDO filter is also large. For the default stack size (1Mb) this hierarchy can eventually get too large, and you'll get the stack overflow. And once that happens then the memory associated with the filter objects is not released (plus the stack for that thread becomes corrupted).

comment:2 by ChristineBao, 13 years ago

Solution:

Increate the stack reserve size to 10M.

by ChristineBao, 13 years ago

Attachment: Fix#1606.patch added

comment:4 by ChristineBao, 13 years ago

Resolution: fixed
Status: newclosed

Submit the patch to fix this defect.

comment:5 by brucedechant, 13 years ago

Resolution: fixed
Status: closedreopened

This only fixes Windows. Linux needs to be fixed too.

comment:6 by brucedechant, 13 years ago

To fix Linux you need to update the Makefile.am files and remove this line:

ulimit -s 1024

The above line sets the stack to 1MB. The default stack size on Linux is 10MB.

by ChristineBao, 13 years ago

Attachment: FixLinux.patch added

comment:7 by ChristineBao, 13 years ago

Thanks Bruce for picking up Linux. Attach http://trac.osgeo.org/mapguide/attachment/ticket/1606/FixLinux.patch for review.

comment:8 by ChristineBao, 13 years ago

Resolution: fixed
Status: reopenedclosed

Commit the patch to fix it.

comment:9 by brucedechant, 13 years ago

Milestone: 2.3
Version: 2.1.02.2.0
Note: See TracTickets for help on using tickets.