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

Question

Question

Importer SDK function worked for years, now works occasionally

asked on September 26, 2016 Show version history

We have a real mystery in an SDK application we wrote in toolkit 8.3, for an 8.3 server.

The application takes files provided from an external source, and imports them into Laserfiche.  We recently moved the server to a VM, and that is the only change in the environment.

Here's the mystery: The application worked without issue for years, even after the server move. Now every other day roughly, it fails at the very last step. The next day, it will work fine.  Later in a day when it fails, it will work fine. 

To summarize we get a batch of images we process and import into Laserfiche.  When the routine fails, it fails for all of them. When it works, it works or all of them.

The very last step involves adding pages to the document we just created, using:

If Importer.IsAnImageFile(sDocumentFile) Then
   Importer.ImportImagesFromFile(sDocumentFile)
Else
   Importer.ImportElectronicFile(sDocumentFile)
End If

'Clean Up and Return a Status
Importer = Nothing
LF_Document.Dispose()
Return True

 

This is within a Try Catch block.

When the process fails, the files do not get written to the Volume.  But, there are NO error messages from the server, and NO error messages in Event Viewer.  It as if the files were whisked to Never Never Land by magic.  The volumes are local to the server itself.

Here are some details. Seen in LF, the document thinks it has pages.

 

 

When you open the document, you have nothing:

Pages either shows nothing:

Or thinks it wrote the files:

In this last case, the files were actually missing entirely, even though the server shows file names and sizes.

 

Any ideas?  TIA

 

0 0

Replies

replied on September 26, 2016

Can you post the code for your Catch?

0 0
replied on September 26, 2016

Hi Miruna - 

 

Here's the block:

        'Assign the document to the importer
        Try
            LF_Document = LFDB.GetEntryByID(lDocID)
            Importer.Document = LF_Document
            ' Locks the object for modification.
            LF_Document.LockObject(Lock_Type.LOCK_TYPE_WRITE)

            'Test the first page
            'Alternative
            'If bDocIsImage = True Then
            'Since we have already tested this.

            If Importer.IsAnImageFile(sDocumentFile) Then
                Importer.ImportImagesFromFile(sDocumentFile)
            Else
                Importer.ImportElectronicFile(sDocumentFile)
            End If

            'Clean Up and Return a Status
            Importer = Nothing
            LF_Document.Dispose()
            Return True

        Catch Ex As Exception
            sMessage = "Error in AddPagetoLFDocument for " & sDocumentFile & _
                                     " " & (Err.Description)
            WriteLog.WriteMessage(Now & " " & sMessage)
            AddPageToLFDocument = False
            Err.Clear()
            LF_Document.Dispose()
            Return False
        End Try

 

The boolean goes back to the calling routine:

 

        'Next, add the pages
        bRet = AddPageToLFDocument(lDocID, sDocumentFile)
        'Check to see if it worked
        If bRet = False Then
            sMessage = Now & " Create Document failed at step AddPageToLFDocument for: " & sDocName & ". "
            WriteLog.WriteMessage(Now & " " & sMessage)
            Return False
        End If

        'Add Messages about the overall result
        If bRet = True Then
            sMessage = ("Successfully created LFDocument # " & lDocID & " for " & sImportTemplate & ".")
            WriteLog.WriteMessage(Now & " " & sMessage)
        Else
            'Add Messages
            sMessage = ("Failed to create LFDocument # " & lDocID & ".")
            WriteLog.WriteMessage(Now & " " & sMessage)
        End If

 

So there are two places where an error would be written.  However, the log always reads:

9/26/2016 2:02:13 PM Entering AddPageToLFDocument for TocID #: 8336837 using U:\Mhf\From Corvel\CorvelBills\IN\015035437241_400009869338_NO_ALT_DCN_16266015065063759497.tif.
9/26/2016 2:02:14 PM Successfully created LFDocument # 8336837 for Claims.
9/26/2016 2:02:14 PM Successfully imported U:\Mhf\From Corvel\CorvelBills\IN\015035437241_400009869338_NO_ALT_DCN_16266015065063759497.tif with Claim Number: 400009869338.
9/26/2016 2:02:14 PM Moved file, U:\Mhf\From Corvel\CorvelBills\IN\015035437241_400009869338_NO_ALT_DCN_16266015065063759497.tif to U:\Mhf\From Corvel\CorvelBills\OUT\with a workflow status of File Room.
 

Thanks for taking a look.

 

0 0
replied on September 26, 2016 Show version history

Bill,

 

Not sure if this is the problem but in your Catch block if you are concatenating a message to write to the error log you should be referencing the ex.Message property of the exception object instead of Err.Description.  Perhaps the importer is failing and running the Catch block but the Catch block code is failing before the error log entry is written?

Have you tried to explicitly run your code to force an error to make sure the code in the Catch block works as anticipated?

That won't fix the problem but at least it might log why the code is failing...

0 0
replied on September 26, 2016

Good catch, Cliff - It's all worth a try.  I am a little skeptical only because the value is set to False at the beginning of the routine.  ( AddPageToLFDocument = False) The only way we return True is if we hit line 22 in the first example.  But when you have a mystery everything is fair game.

0 0
replied on September 27, 2016

I don't see any problems with the code that would lead to this behavior. It seems clear that no exception is being thrown since the function returns true, and the DocumentImporter code shouldn't silently fail. This sounds more like a bug in the LF server. Are you importing into a volume with encryption, compression, or checksums enabled? Do you have any workflows running that could be interfering?

0 0
replied on September 27, 2016

Hi Robert - 

The volumes are plain vanilla, and are just roll overs based on size, no compression, and no encryption. There are times when I've traced this to the folder and file level, and it fails in the middle of a volume - that is, at times other than when it is rolling over.  I'll change the exception, and built a WF rule in the meantime that will help us get the documents into the system.  To be continued, I have no doubt.

0 0
replied on September 27, 2016

If you could get a LFS trace that captures the problem, we would appreciate it. 

0 0
replied on September 28, 2016 Show version history

I'll set that up.  I assume I should select the API Trace?

0 0
replied on September 28, 2016

On the LFS machine, run the Laserfiche Event Trace Viewer, choose File->Start Tracing, then Start. Wait until the problem happens again, then stop the tracing. Open a support case and attach the log and details about when the error happened.

0 0
replied on September 29, 2016 Show version history

Update: Ever since Rob's post, the process has worked flawlessly.  We have closed the support case, and will update this thread when we can come back when 1) the process fails, and 2) we have the tracing information for that interval.

 

0 0
replied on October 4, 2016

Remember to turn off LFS tracing, it can use up a lot of space if left running.

1 0
replied on October 5, 2016

It certainly does!  We are going to wait until it fails to turn it on, because when that happens it tends to fail on additional attempts so long as they are run shortly after.  

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

Sign in to reply to this post.