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

Question

Question

Getting Invalid Pointer on OCRMarkedPages

SDK
asked on August 26, 2015 Show version history

Getting this from .net and C++ code and can't figure out what is causing it.  Seems to work when targeting 9.2 but 9.1 Laserfiche fails.

Server is Windows Server 2012 R2 Standard

DocumentProcessor log:

26-Aug-2015, 20:33:39, [16387 (0x00004003)]: 14960 - Invalid pointer

 

Example Program:

```C#

using LFSO91Lib;
using DocumentProcessor91;
using System;

namespace OcrTest
{
   class Program
    {

        static void Main(string[] args)
        {
            var program = new Program();
        }

        public Program()
        {

            var app = new LFApplication();
            app.EnableTracing("C:\\temp\\");

            var server = app.GetServerByName("aosdemo");
            var db = server.GetDatabaseByName("aosdemo");
            var conn = new LFConnection();
            conn.UserName = "admin";
            conn.Password = "admin";
            conn.Create(db);

            MoveFileToDestination(db, "DEFAULT", "__SCTest\\OCRTesting\\New Folder\\", "ctest", "data\\SAMPLE 1.tif");

            Console.WriteLine("Press any key to quit...");
            Console.ReadKey();

            conn.Terminate();
        }


        bool MoveFileToDestination(ILFDatabase db, string Volume, string Destination, string DocumentName, string filename)
        {
            bool result = false;
            bool newDocument = false;

            Entry_Type entryType = Entry_Type.ENTRY_TYPE_DOCUMENT;
            ILFDocument document = null;
            try
            {

                newDocument = true;
                document = new LFDocument();
                var volume = db.GetVolumeByName(Volume);
                var parent = db.GetEntryByPath(Destination);
                document.Create(DocumentName, parent, volume, true);

                int idxStartPage = 0;
                int idxEndPage = 0;


                int pageRef = 0;
                
                var DI = new DocumentImporter();
                DI.LogFile = "C:\\temp\\di.log";
                DI.LogLevel = Log_Level.LOGLEVEL_DEBUG;
       
                DI.Document = document;
                
                var path = System.IO.Path.Combine(
                    System.Reflection.Assembly.GetExecutingAssembly().Location,
                    filename);
                document.LockObject(Lock_Type.LOCK_TYPE_WRITE);
                DI.ImportImagesFromFile(filename);
                document.UnlockObject();


                result = true;

                LFDocumentPages docPages = (LFDocumentPages)document.Pages;
                var ocr = new OCREngine();
                docPages.MarkAllPages();
                ocr.OCRMarkedPages(docPages);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                // if we created a new document and it wasn't sent to LF successfully,
                // then delete it and show the error
                if (document != null)
                {
                    document.Delete();
                    document = null;
                }
            }
            finally
            {

                if (document != null)
                {
                    document.Update();
                    document.Dispose();
                }
            }

            return result;
        }
    }
}

 

```

SAMPLE 1.tif (212.03 KB)
0 0

Replies

replied on August 27, 2015

Does this happen on a page with lots of text (more than 28k characters)? If so, this is a bug that was fixed in 9.2 (116966)

0 0
replied on August 31, 2015

I uploaded a sample tif along with the code.  It doesn't look like it would be anywhere near that character limit.  It fails on the sample tifs provided by Laserfiche.

0 0
replied on August 31, 2015

It must be failing to load the OCR engine. Is there anything else in the trace log?

0 0
replied on August 31, 2015

Unfortunately, that was all that was in the log for the DocumentProcessor (di.log here).  I didn't see anything else that was logged in the temp folder.  Is there something I'm missing to turn on more verbose logging either in LFApplication or DocumentProcessor classes? 

 

FWIW, I am able to open the Laserfiche Client on this machine and OCR the pages from there.  

0 0
replied on August 31, 2015

Turn on LFSO & DocumentProcessor tracing in the 9.1 client (from Help->About->Tracing), then try reproducing the problem. This should produce more verbose logs.

0 0
replied on September 1, 2015

Ok thanks. Here are the two logs' content after running the code.

DocumentProcessor log:

2015-09-01 DP 9.1.0.390
Current Process: C:\temp\Release\OcrTest.exe (PID=9808)
Current Module: c:\Program Files (x86)\Common Files\Laserfiche\9.1\DocumentProcessor91.dll
07:31:50.123 [4072] DocumentImporter::put_Document
07:31:50.123 [4072] DocumentImporter::ImportImagesFromFile
07:31:50.123 [4072]  DocumentImporter::ImageFileImport
07:31:50.123 [4072]   DocumentImporter::IsAPdfFile
07:31:50.123 [4072]   Utility::GetNextPage
07:31:50.404 [4072]   Utility::GetNextPage
07:31:50.482 [11220] OCREngine::OCRMarkedPages
07:31:50.498 [11220]  OCREngine::GetPagesToOCR
07:31:50.498 [11220]  OCREngine::OCRSelectedPages
07:31:50.498 [11220]   OCREngine::ExportTempImage
07:31:50.623 [11220]   OCREngine::OCRPage
07:31:50.638 [11220] Exception: 0x80004003 [16387] (Invalid pointer) (OCREngine::OCRMarkedPages at OCREngine.cpp:224)

 

LFSO log:

2015-09-01 LFSO 9.1.0.411
Current Process: C:\temp\Release\OcrTest.exe (PID=9808)
Current Module: c:\Program Files (x86)\Common Files\Laserfiche\9.1\LFSO91.dll
07:31:49.904 [4072] InitializePropertyMap
07:31:49.904 [4072] Internal parameters:
LoginTimeoutMS: 20000, ResolveTimeoutMS: 0, ConnectTimeoutMS: 5000,
SendTimeoutMS: 45000, ReceiveTimeoutMS: 900000, PingTimeoutMS: 1000,
DBListTimeoutMS: 3000, ServerInfoHTTPTimeoutMS: 5000, DBListHTTPTimeoutMS: 5000,
PingThreadPeriodSeconds: 8, PingThreadThresholdSeconds: 5, WMITimeoutMS: 1000,
WMIShortConnectTimeoutMS: 750, WMILongConnectTimeoutMS: 5000, WMIAdminTimeoutMS: 3000,
MaxMemBufferSize: 5242880, XmlOnly: F, AcceptDeflate: T,
LockTimeoutSeconds: 86400, MaxServerThreads: 256, MaxPagePartMemBufferSize: 52428800, MaxConnections: 4,
ListValueCacheTimeoutSeconds: -1, ShutdownTimeoutMilliseconds: 2000
07:31:49.904 [4072] CLFApplication::CLFApplication
07:31:49.920 [4072] CLFApplication::EnableTracing

 

1 0
replied on September 3, 2015

Ok, I think I figured it out. This is a bug in DocumentProcessor91.dll (SCR 110493), it hasn't been fixed in the SDK yet. If you are using the x86 version of DocumentProcessor91, you can get a fixed copy by installing the 9.1.1 SP2 update. Otherwise you need to use the 9.2 SDK.

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

Sign in to reply to this post.