You are viewing limited content. For full access, please sign in.

Question

Question

The current request could not be performed because there are too many existing operations running

SDK
asked on August 18, 2014

 Hello,

 

I need to migrate large number of documents from one volume to another, so I wrote a piece of code to leave it running overnight:

 

Dim LFVolume as New LFVolume
LFVolume = LFDB.GetVolumeByName("NEWVOL")
Dim LFDocument As New LFDocument

        For Each LFID As String In LFDocIDsList
            LFDocument = New LFDocument
            Dim Entry As ILFEntry
            Try
                Entry = LFDB.GetEntryByID(LFID)
            Catch ex As Exception
                GoTo NextEntry
            End Try

            If Entry.EntryType = Entry_Type.ENTRY_TYPE_DOCUMENT Then
                Try
                    LFDocument = Entry
                    DocName = LFDocument.Name
                Catch ex As Exception
                    Entry.Dispose()
                    GoTo NextEntry
                End Try

                Try
                    LFDocument.Migrate(LFVolume)
                Catch ex As Exception
                    LFDocument.Dispose()
                    Entry.Dispose()
                    GoTo NextEntry
                End Try

            End If



NextEntry:
            Try
                LFDocument.Dispose()
                LFDocument = Nothing
            Catch ex As Exception
            End Try
            Try
                Entry.Dispose()
            Catch ex As Exception
            End Try
        Next
Finish:
        LFconn.Terminate()
        MsgBox("Finished")
        Exit Sub

 

But after around 70 Documents migrated, the loop starts throwing the following error:

 

"The current request could not be performed because there are too many existing operations running"

 

I'm using LFSO81 because this is the version of my server.

 

Could anyone help?

 

Thanks in advance and best regards,

 

Ignacio PdeA

BMB sal

0 0

Answers

APPROVED ANSWER
replied on August 18, 2014 Show version history

Migrations are different from most operations in that the LFSO call returns immediately, while the migration itself takes place in the background.  The server limits the number of these background tasks that it will run on your behalf, so you can't start another one until one of the current ones completes.  You'll need to use the LFProgress return value to monitor the migration's progress.  Something like:

 

LFProgress progress = LFDocument.Migrate(LFVolume)
try
{
    while (!progress.IsComplete)
    {
        Thread.Sleep(500);
        progress.Refresh();
    }
    if (progress.Errors != null && progress.Errors.Count > 0)
    {
        progress.ThrowLastError();
    }
}
finally
{
    progress.Dispose();
}

[edited: Added the finally block instead of a using block, since LFProgress doesn't implement IDispose]

 

0 0
replied on August 18, 2014

This is correct, but it's missing one thing. After the IsComplete property is set to true, be sure to call LFProgress.Dispose to release the resources on the server.

0 0
replied on August 20, 2014

Thanks Brian and Michael for your replies, really appreciated.

But I faced a problem when converting the code to VS:

 

What I wrote was the following:

 

Dim ProcessProgress As New LFProgress
Try
     ProcessProgress = LFDocument.Migrate(LFVolume)
     While ProcessProgress.IsComplete = False
          Threading.Thread.Sleep(500)
          ProcessProgress.Refresh()
     End While
     ProcessProgress.Dispose()
Catch ex As Exception
     ProcessProgress.ThrowLastError()
     ProcessProgress.Dispose()
     MsgBox(Err.Description)
End Try

 

But at the Dim ProcessProgress As New LFProgress line, I'm getting the following error:

 

Retrieving the COM class factory for component with CLSID {6D7DABD3-C3E1-4960-8A15-8B5C3FB6C49B} failed due to the following error: 80040111.

 

I searched this entry in my regedit and i found it is related to LFSO81.Progress

 

I tried re-registering LFSO81.dll using regsvr32, but didnt solve the problem.

 

My machine is 64bits so I compile the Tool for x86 CPU but the problem persists.

 

I also tried another option:

 

Try
    While LFDocument.Migrate(LFVolume).IsComplete = False
    Threading.Thread.Sleep(500)
    End While
    MigrResult = "OK"
Catch ex As Exception
    MigrResult = "Error Migrating Document = " & Err.Description
    LFDocument.Dispose()
    Entry.Dispose()
    GoTo NextEntry
End Try

But the error with too many operations running also appears.

 

then I tried the option

 

Dim ProcessProgress As New LFReleaseEntryActivity
If ProcessProgress.HasActivity(Activity_Type.ACTIVITY_TYPE_MIGRATE_DOC) = False Then
   Threading.Thread.Sleep(500)
End If

But I couldnt make it work nor...

 

So any help on the above will be most appreciated, as i really need this tool working for large number of documents.

 

Thanks for your attention and best regards,

 

Ignacio PdeA

BMB sal

0 0
replied on August 20, 2014
Dim ProcessProgress As New LFProgress

This does 3 things:

  1. Declares a variable of type LFProgress named ProcessProgress
  2. Instantiates an object of type LFProgress
  3. Stores a reference to 2 in 1

 

You only want to do the first, so remove the "New" part.  Step 2 is failing because LFProgress objects are supposed to be created internally by LFSO and handed out.

 

Your second example doesn't have the call to Dispose() in the success branch.

1 0
SELECTED ANSWER
replied on August 20, 2014

Thanks Brian again!!!

Now it is working.

For those interested, what worked for me was the following:

 

Dim LFVolume as New LFVolume
LFVolume = LFDB.GetVolumeByName("NEWVOL")
Dim LFDocument As New LFDocument
LFDocument = LFDB.GetEntryByID(1234)


Dim ProcessProgress As LFProgress
Try
     ProcessProgress = LFDocument.Migrate(LFVolume)
     While ProcessProgress.IsComplete = False
          Threading.Thread.Sleep(500)
          ProcessProgress.Refresh()
     End While
     ProcessProgress.Dispose()
Catch ex As Exception
     ProcessProgress.ThrowLastError()
     ProcessProgress.Dispose()
     MsgBox(Err.Description)
End Try

Thanks again and best regards,

 

Ignacio PdeA

BMB sal

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.