Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, November 9, 2005 11:32:27 PM(UTC)

dokit  
dokit

Groups: Registered
Posts: 5


I'm in the process of  stress-testning my application, which reads barcodes from tiff files - hotfolder style.
My function works the first couple of times (2-30x) but then suddenly crashes because of (seemingly) random exceptions generated by the Leadtools SDK. In my test-setup i use exactly the same image over and over again - with 1 second pauses in between.

I've attached the sourcecode for the function.

Among the exceptions i've experienced are:

- "The server threw an exception" (at Dim LEAD As New LEADLib.LEAD)
- "Exception from HRESULT: 0xC0000005 at LTBARLib.LEADBarCodeClass.get_Linear()"
- "LEAD Error: Not enough memory available at LTBARLib.LEADBarCodeClass.set_Bitmap(Int32 pVal)"

I also had a few exceptions when loading the bitmap and trying to read barcodes.

I have a suspicion that it may all be caused because the Leadtools SDK is improperly unloaded, but I can't really figure out how to correct this.

It should be mentioned that the class I've attached is loaded into a seperate thread.

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, November 13, 2005 12:08:14 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


Some of these problems might be caused by not freeing the LEAD OCX bitmap after using with .NET.

In the current version of our .NET components, there exists Leadtools.Compatibility.RasterImageConverter.FreeLeadBitmap

You can use it like this (this is C# code, but can be easily converted to VB.NET):
using Leadtools.Compatibility;
private void ToLeadBitmapTest(RasterImageViewer viewer)
{
IntPtr ocxBitmap = RasterImageConverter.ToLeadBitmap(viewer.Image, "LTKRN14N.DLL");
// Do something with ocxBitmap, for example, use LEADTOOLS COM objects to save it to a file.
RasterImageConverter.FreeLeadBitmap(ocxBitmap, "LTKRN14N.DLL");
System.Runtime.InteropServices.Marshal.FreeHGlobal(ocxBitmap);
}


This should be available in build 14.1.0.5 and later. If you have an earlier build, download the latest setup or patches from our site.

Edited by user Tuesday, December 6, 2016 2:51:10 PM(UTC)  | Reason: Not specified

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Wednesday, November 23, 2005 3:50:31 AM(UTC)

dokit  
dokit

Groups: Registered
Posts: 5


Hi Amin
I just discovered your reply - I thought I would be notified by email.

I'm using the Document Imaging SDK so I do not have access to the .NET components of Raster Imaging.
Is there a similar function in the DLL/COM edition?
I really need a solution for this problem - my deadline is moving closer every day.

Kind regards,

Kasper Hansen

 
#4 Posted : Wednesday, November 23, 2005 6:54:59 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


Kasper,

Since you are using VS.NET, I just assumed you're using our .NET components.

Actually, as an owner of Document Imaging, you are entitled to install
and use the LEADTOOLS.NET components as well. However, since there are
no Barcode modules in these components, it makes sense to use the COM
or OCX instead.

In any case, the solution provided in my previous post does not apply
without using the .NET components. This means your problem is caused by
something else. If you can reproduce it in a small test program (not
your full application), put this program in a ZIP file and either post
it here or send it to support@LEADTOOLS.com and we will check it for
you.

Edited by user Tuesday, December 6, 2016 2:51:30 PM(UTC)  | Reason: Not specified

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#5 Posted : Friday, November 25, 2005 12:38:24 AM(UTC)

dokit  
dokit

Groups: Registered
Posts: 5


Amin,
I just created a small stress-test-program using the code from our main application.
It fails with (seemingly) random errors after 10-15 loops (just press the start button and let it work).

Please run the application directly from the development environment as I have not bothered to build in thread exception-handling.

Kind regards,

Kasper Hansen

 
#6 Posted : Sunday, November 27, 2005 11:32:47 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


Kasper,

Have you tried posting an attachment here? If you want to attach
something, please put in a ZIP file first, because not all file types
work with the forums.

I also searched our support email system and did not find any tickets from your email address.

Edited by user Tuesday, December 6, 2016 2:51:47 PM(UTC)  | Reason: Not specified

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#7 Posted : Sunday, November 27, 2005 9:26:03 PM(UTC)

dokit  
dokit

Groups: Registered
Posts: 5


Amin,
I actually did attach a .zip file -however, I pressed the
"Preview" button before posting my message, which may have removed the attachment.
I've attached the file to this post.

Kasper Hansen

File Attachment(s):
LeadStressTest.zip (10kb) downloaded 32 time(s).
 
#8 Posted : Wednesday, December 7, 2005 8:44:09 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


Kasper,

I checked your project and saw the same kinds of errors you are
getting. However, I couldn't isolate them easily, so I created my own
project, and took most of the LEAD-related code from your project. I'm
attaching the new project. It opens your file, which has 3 pages and a
total of 9 barcodes. I executed a 10,000-loop test run for a grand
total of 90,000 barcode results. It worked with no problems.

This means the problem is likely not caused by LEADTOOLS.

File Attachment(s):
BarcodeOcxVbDotNet.zip (24kb) downloaded 31 time(s).

Edited by user Tuesday, December 6, 2016 2:52:07 PM(UTC)  | Reason: Not specified

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#9 Posted : Wednesday, December 7, 2005 9:08:33 AM(UTC)

dokit  
dokit

Groups: Registered
Posts: 5


Hi Amin

I haven't tested it yet, but I trust that the code you sent me works quite well.
However this error only occurs when run from a seperate thread. I've developed around 20 plugins for my application with excatly the same structure as the one i sent you - none of the behave strangely (and several of them incorporate 3rd party tools).

I'm quite sure this has something to do with garbage collecting or similar, as many of the errors has to do with insufficient resources.
Another thing that points me in the direction of the DLL is that the errors seem to occur at random places in the code - often places that do the simplest things (eg. Exit Sub).

Actually it doesen't really matter to me if you use my code. If you can show me a way to achieve similar functionality from a seperate thread in VB.NET or C#.NET, that will be quite enough for me.

Kind regards

Kasper Hansen

 
#10 Posted : Sunday, December 11, 2005 5:46:36 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


Kasper,
I modified my project to perform barcode recognition in a separate
thread. I made it simple, but tried to guarantee no reentrancy occurs.
It seems to be working also. Please see attached project.

File Attachment(s):
BarcodeOcxVbDotNet_Thread.zip (24kb) downloaded 32 time(s).

Edited by user Tuesday, December 6, 2016 2:52:38 PM(UTC)  | Reason: Not specified

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.285 seconds.