View Issue Details

IDProjectCategoryView StatusLast Update
0001727SymmetricDSBugpublic2014-06-17 00:27
Reporterbrickman Assigned Tochenson  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.5.17 
Target Version3.6.0Fixed in Version3.6.0 
Summary0001727: 100% CPU when expiring SYM_DATA_GAP with missing SYM_DATA
DescriptionSymmeticDS Version 3.5.17
Database: Firebird 2.5.1

Our database got into a state where we had a large number of SYM_DATA_GAP records (2499).

In addition, we had SYM_DATA_EVENT records which did not reference any SYM_DATA records.

The following query returned 92 rows
select data_id from sym_data_event a where not exists (select * from sym_data b where a.data_id = b.data_id);

We are not clear how SymmetricDS got into this state, however from review of org.jumpmind.symmetric.route.DataGapDetector#isDataGapExpired, it looks like this state is expected and is handled.

However, when org.jumpmind.symmetric.route.DataGapDetector#isDataGapExpired is called against a Firebird database when in this state, Firebird cannot handle the query which causes SymmetricDS to freeze with 100% CPU utilisation.

We isolated the problematic query in org.jumpmind.symmetric.service.impl.DataServiceSqlMap

putSql("findNextDataCreateTimeSql", ""
                + "select create_time from $(data) where data_id in (select min(data_id) from $(data) where data_id >= ?)");

We resolved this issue in our environment by splitting the query up.
In org.jumpmind.symmetric.service.impl.DataServiceSqlMap we added

putSql("findMinDataSql", ""
                + "select min(data_id) from $(data) where data_id >= ?");

We changed org.jumpmind.symmetric.service.impl.DataService#findNextCreateTimeOfDataStartingAt to

public Date findNextCreateTimeOfDataStartingAt(long dataId) {
        return findCreateTimeOfData(sqlTemplate.queryForObject(getSql("findMinDataSql"), Long.class, dataId));
    }

We rebuild the SymmetricDS project with these changes and it successfully expired the SYM_DATA_GAP records and continued syncing as normal.



Steps To ReproducePlease refer to the description.
The SymmetricDS database was in an unusual state with a large number of SYM_DATA_GAP records and SYM_DATA_EVENT referencing missing SYM_DATA records.
Additional InformationSymmeticDS Version 3.5.17
Database: Firebird 2.5.1
TagsNo tags attached.

Activities

chenson

2014-05-22 12:29

administrator   ~0000522

Kinda strange, but the fix won't hurt anything ...

Related Changesets

SymmetricDS: master e9c4b7b4

2014-05-22 08:28:28

chenson

Details Diff
0001727: 100% CPU when expiring SYM_DATA_GAP with missing SYM_DATA Affected Issues
0001727
mod - symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java Diff File
mod - symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataServiceSqlMap.java Diff File

Issue History

Date Modified Username Field Change
2014-05-21 22:10 brickman New Issue
2014-05-22 12:28 chenson Status new => resolved
2014-05-22 12:28 chenson Fixed in Version => 3.6.0
2014-05-22 12:28 chenson Resolution open => fixed
2014-05-22 12:28 chenson Assigned To => chenson
2014-05-22 12:29 chenson Note Added: 0000522
2014-05-22 12:29 chenson Target Version => 3.6.0
2014-05-22 13:00 Changeset attached => SymmetricDS trunk r8285
2014-06-17 00:27 chenson Status resolved => closed
2015-07-31 01:49 chenson Changeset attached => SymmetricDS master e9c4b7b4