View Issue Details

IDProjectCategoryView StatusLast Update
0002374SymmetricDSBugpublic2015-09-11 16:14
Reporterdporob79Assigned Tochenson 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version3.4.9 
Target Version3.7.21Fixed in Version3.7.21 
Summary0002374: Memory being held up un-necessarily in StagingManager and StagedResource
DescriptionThe Staging manager does clean up the resources after the TTL. But the memoryBuffer which is being used (in StagedResource) is held up un-necssarily after the state of the resource changes to 'DONE'. I am talking specifically about resources which are first held in memory and then written to file (when the threshold is reached).
So, if the TTL is 1 hour, then this memoryBuffer is held in memory for that one hour.

I was looking at the code and the implementation of the setState function in StagedResource checks whether a file exists and if yes renames the file else it sets the memoryBuffer to null. Shouldn't it be cleaning up the memory buffer even if the file exists and the state is changed to DONE ?

Essentially shouldn't the below code snippet (in setState function of StagedResource) change from :

=====================================
} else if (memoryBuffer != null && state == State.DONE) {
            this.memoryBuffer.setLength(0);
            this.memoryBuffer = null;
        }
=====================================

TO

=====================================
}
if (memoryBuffer != null && state == State.DONE) {
            this.memoryBuffer.setLength(0);
            this.memoryBuffer = null;
}
=====================================

I see that the latest trunk code also has the same issue. Why would we need the memoryBuffer after the state has changed to 'DONE' ?
Steps To ReproduceWhile large number of events are being replicated, take a heap dump of the JVM which is hosting the symmetric engine and check the amount of memory which is occupied by the StagingManager.
TagsNo tags attached.

Activities

chenson

2015-08-24 16:20

administrator   ~0000712

The ThresholdFileWriter sets the buffer length to 0, but you are probably correct. I'll make that change for the next patch release.

Related Changesets

SymmetricDS: 3.7 49fe0a58

2015-08-24 16:24:51

chenson

Details Diff
0002374: Memory being held up un-necessarily in StagingManager and
StagedResource

0002374
mod - symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagedResource.java Diff File

Issue History

Date Modified Username Field Change
2015-08-24 13:55 dporob79 New Issue
2015-08-24 16:20 chenson Note Added: 0000712
2015-08-24 16:28 chenson Assigned To => chenson
2015-08-24 16:28 chenson Status new => assigned
2015-08-24 16:29 chenson Fixed in Version => 3.7.21
2015-08-24 16:29 chenson Target Version => 3.7.21
2015-08-24 16:29 chenson Status assigned => resolved
2015-08-24 16:29 chenson Resolution open => fixed
2015-08-24 17:00 chenson Changeset attached => SymmetricDS 3.7 49fe0a58
2015-09-11 16:14 chenson Status resolved => closed