none
How to resolve “Storage Engine Operation Failed” with Microsoft.Sync? RRS feed

  • Question

  • I have developed a synchronization software that will sync Databases and Directories using Microsoft Sync Framework 2.1.

    After a while a client using the application gets this error :

    A storage engine operation failed with error code 25104 (HRESULT = 0x80004005, Source IID = {0C733A63-2A1C-11CE-ADE5-00AA0044773D}, Parameters=(4001, 0, 0, , , ,)).

    I tried to track the error within my code but with no success.

    The error occurs when the SyncOchestrator begins Synchronization. And from the stacktrace I got :

    at Microsoft.Synchronization.Files.FileSyncProvider...ctor()

    Here is some of my coding :

     try
            {
                // Set options for the sync operation
                FileSyncOptions options = FileSyncOptions.ExplicitDetectChanges |
                         FileSyncOptions.RecycleDeletedFiles | FileSyncOptions.RecyclePreviousFileOnUpdates | FileSyncOptions.RecycleConflictLoserFiles;
    
                FileSyncScopeFilter filter = new FileSyncScopeFilter();
                filter.FileNameExcludes.Add("*.lnk"); // Exclude all *.lnk files
                Thread.Sleep(50);
                // Synchronization of 2 Folders
                FileSyncProvider providerA = new FileSyncProvider(Guid.NewGuid(), replica1RootPath, filter, options);
                FileSyncProvider providerB = new FileSyncProvider(Guid.NewGuid(), replica2RootPath, filter, options);
                providerA.DetectChanges();
                providerB.DetectChanges();
    
                Thread.Sleep(50);
                SyncOrchestrator agent = new SyncOrchestrator();
                agent.LocalProvider = providerA;
                agent.RemoteProvider = providerB;
                agent.Direction = SyncDirectionOrder.Upload;
                MessageBox.Show("Let's SYNC");
                agent.Synchronize(); // The error happens here
    
                Thread.Sleep(50);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                MessageBox.Show(e.StackTrace);
            }

    Can you please help me with this? I'm getting frustrated and I don't know where should I look! The code worked perfectly for one year.

    For more information :

    • The end user has all the required access rights for the folders.
    • The file server has plenty of free space to write.

    I'm on C#, Microsoft.Synchronization 2.1, .Net 4, Visual Studio 2015.

    Thank you very much for any suggestion.


    Friday, November 17, 2017 5:29 PM

Answers

  • I finally figured out the solution. It happened that the Metadata file was too big / corrupted. So to solve my problem I fragmented the synchronization and selected all the subfolders one by one instead of selecting just one folder with 260 Go of files.

        foreach (string dep in Directory.GetDirectories(plantFolder1)) // different departements
                                    {
                                        string depFolder1 = plantFolder1 + dep.Remove(0, plantFolder1.Length);
                                        string depFolder2 = depFolder1.Replace(subReplica1, subReplica2); ;

                                        Thread.Sleep(50);
                                        // Synchronization of 2 Folders
                                        FileSyncProvider providerA = new FileSyncProvider(Guid.NewGuid(), depFolder1, filter, options);

                                        bool exists = Directory.Exists(depFolder2);
                                        if (!exists)
                                            Directory.CreateDirectory(depFolder2);

                                        FileSyncProvider providerB = new FileSyncProvider(Guid.NewGuid(), depFolder2, filter, options);
                                        providerA.DetectChanges();
                                        providerB.DetectChanges();

                                        Thread.Sleep(50);
                                        SyncOrchestrator agent = new SyncOrchestrator();
                                        agent.LocalProvider = providerA;
                                        agent.RemoteProvider = providerB;
                                        agent.Direction = SyncDirectionOrder.Upload;
                                        agent.Synchronize();
                                        Thread.Sleep(50);
                                    }

    That's the solution for my problem. I hope this will help you folks.

    Thanks.
    • Marked as answer by 0uss Wednesday, November 22, 2017 7:46 PM
    Wednesday, November 22, 2017 7:45 PM

All replies

  • Hello 0uss,

    According to your question is more related to Microsoft Sync Framework ,I will move the thread to File Synchronization Forum for suitable support.And the following is my search result.

    If you have some grammar or code errors in using c#, please feel free to contact us. We will try our best to give you a solution .


    Sincerely,

    Fei Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Fei Hu Monday, November 20, 2017 10:32 AM
    Monday, November 20, 2017 10:31 AM
  • Thank you very much Fei Hu.

    I'm sorry I didn't post on the right forum. 

    I'm still searching for a solution to my problem. I will post the answer if found.

    Monday, November 20, 2017 8:23 PM
  • I finally figured out the solution. It happened that the Metadata file was too big / corrupted. So to solve my problem I fragmented the synchronization and selected all the subfolders one by one instead of selecting just one folder with 260 Go of files.

        foreach (string dep in Directory.GetDirectories(plantFolder1)) // different departements
                                    {
                                        string depFolder1 = plantFolder1 + dep.Remove(0, plantFolder1.Length);
                                        string depFolder2 = depFolder1.Replace(subReplica1, subReplica2); ;

                                        Thread.Sleep(50);
                                        // Synchronization of 2 Folders
                                        FileSyncProvider providerA = new FileSyncProvider(Guid.NewGuid(), depFolder1, filter, options);

                                        bool exists = Directory.Exists(depFolder2);
                                        if (!exists)
                                            Directory.CreateDirectory(depFolder2);

                                        FileSyncProvider providerB = new FileSyncProvider(Guid.NewGuid(), depFolder2, filter, options);
                                        providerA.DetectChanges();
                                        providerB.DetectChanges();

                                        Thread.Sleep(50);
                                        SyncOrchestrator agent = new SyncOrchestrator();
                                        agent.LocalProvider = providerA;
                                        agent.RemoteProvider = providerB;
                                        agent.Direction = SyncDirectionOrder.Upload;
                                        agent.Synchronize();
                                        Thread.Sleep(50);
                                    }

    That's the solution for my problem. I hope this will help you folks.

    Thanks.
    • Marked as answer by 0uss Wednesday, November 22, 2017 7:46 PM
    Wednesday, November 22, 2017 7:45 PM