locked
Getting System.OutOfMemoryException during synchronization RRS feed

  • Question

  • getting this exception when i tried to sync a 2008 r2 server to an empty 2008r2 database.My source database is a large one,around 4gb.I get this exception after provisioning and then next time i get out of memory exception..Any help appreciate.

    Microsoft.Synchronization:Void Start(CONFLICT_RESOLUTION_POLICY, _SYNC_SESSION_STATISTICS ByRef):An unexpected error occured when spooling changes to a batch file. See the inner exception for more details.:System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
       at System.Runtime.Serialization.ObjectIDGenerator.Rehash()
       at System.Runtime.Serialization.ObjectIDGenerator.GetId(Object obj, Boolean& firstTime)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.InternalGetId(Object obj, Boolean assignUniqueIdToValueType, Type type, Boolean& isNew)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteString(NameInfo memberNameInfo, NameInfo typeNameInfo, Object stringObject)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteKnownValueClass(NameInfo memberNameInfo, NameInfo typeNameInfo, Object data)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Object data)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
       at Microsoft.Synchronization.Data.DbSyncBatchInfoFactory.Serialize(DbSyncBatchInfo batchInfo, String batchFileName)
       at Microsoft.Synchronization.Data.DbSyncBatchProducer.SaveBatchFile(DbSyncBatchInfo wrapper)
       at Microsoft.Synchronization.Data.DbSyncBatchProducer.EnqueueBatchAndRaiseEvent(DbSyncBatchInfo batchInfo)
       at Microsoft.Synchronization.Data.DbSyncBatchProducer.PrepareAndQueueBatch(Guid batchId, DataSet batchDataSet, Int64 dataCacheSize, Exception exception, Boolean isLastBatch)

    Out of memory exception:

    Microsoft.Synchronization:Void Start(CONFLICT_RESOLUTION_POLICY, _SYNC_SESSION_STATISTICS ByRef):Cannot enumerate changes at the RelationalSyncProvider for table 'Name_Details'.  Check the inner exception for any store-specific errors.:System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
       at System.Text.Encoding.GetBytes(Char[] chars, Int32 index, Int32 count)
       at System.Text.Encoding.GetBytes(String s)
       at Microsoft.Synchronization.SyncId.GetStringBytes(String stringId)
       at Microsoft.Synchronization.Data.SyncRowMetadata.InitRowId(String tableName, IEnumerable`1 pkVals)
       at Microsoft.Synchronization.Data.DbDataReaderHandler.get_RowId()
       at Microsoft.Synchronization.Data.RelationalSyncProvider.GetRowEnumerationState(DbDataReaderHandler readerHandler, SyncKnowledge knowledgeToCompare)
       at Microsoft.Synchronization.Data.RelationalSyncProvider.EnumerateChangesInBatchesInternal(Object batchProducer)

    Tuesday, October 23, 2012 9:36 AM

All replies

  • how much RAM do you have and what was the batch size you specified?
    Tuesday, October 23, 2012 10:10 AM
  • 25GB RAM .Batch size-50MB  Cache Memory-100MB both for local and remote provider. And I tried to run with different cache memory sizes but no success.

    Tuesday, October 23, 2012 11:12 AM
  • any blobs or image type in the tables you're trying to sync? what's your row size? would you mind posting the snippet where you set the batch size...?

    • Edited by JuneT Tuesday, October 23, 2012 11:54 AM
    Tuesday, October 23, 2012 11:53 AM
  • No blobs or imagetype in tables.

           Table                 no of columns    max row length       row count

    Name_Details                36                       1886                      459374

    RemoteProvider.MemoryDataCacheSize = 100000;
    LocalProvider.MemoryDataCacheSize = 100000;                
    RemoteProvider.ApplicationTransactionSize = 50000;


    Tuesday, October 23, 2012 2:01 PM
  • can you check the available memory on the machine where you run the sync before you run the sync and during sync?

    any other table you're synching before Name_Details?

    and one last thing, can you enable Sync Framework tracing in verbose mode.

    Wednesday, October 24, 2012 2:15 AM
  • yes im syncing another 175 tables in same group.

    before sync-  available memory-20440  cached memory-18750

    during sync - available memory-14136  cached memory-14149

    Tuesday, October 30, 2012 6:01 AM
  • I have the same problem but i have images in table. 

    My servers have 8Gb RAM, and i have 2 tables with 15Gb , each table, for synchronize. (SQL Server 2008 R2)

    Solutions?

    Friday, October 3, 2014 3:55 PM