We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

BarCodeReader: Timeout is not working

Timeout is not working.
This is my code:

In pom:


In Java:
BarCodeReader reader = new BarCodeReader();
reader.setBarCodeImage(<stringFilename, where file=.tiff-format>);

//Set timeout in milliseconds
reader.setTimeout(1000604); //1000604=4 minutes

BarCodeResult[] barCodeResult=null;

try {
catch (Exception exception){
throw new Exception ("Barcodeservices->BarcodeService->getBarcodes: Exception: "+exception.getMessage()) ;
finally {

I also tried with “reader.setTimeout(60);” to be sure that it doesn’t work.

It just continues till the end of recognition.

Am i doing something wrong, or is this a (known) bug?



The layout of this topic is a little “messed-up”.
What is really there, is reader.setTimeout(1000604); //100060 4=4 minutes

so reader.setTimeout(240000);


After an initial test, I am able to reproduce the issue as you mentioned. It seems that BarCodeReader.setTimeout() method is not working properly. It just continues to process till the end of recognition code. I tested it using a sample TIFF file and found the issue. I have logged a ticket with an id “BARCODEJAVA-1048” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

Is there some progress concerning this issue please?


We have made some progress towards resolution. Hopefully we will update you on fixed version release or share an ETA on it soon.

Could you provide image where Timeout doesn’t work? Because on our images timeout error on huge images was around 150 ms.


In the case is stated that you were able to reproduce the problem!?

Can you take that document for testing then?

Can you explain the 150ms please?

According the documentation, we have to pass timeout in Seconds and not in MilliSeconds.

All our documents are Strictly Confidential, so I am not able to send those.

I think it is very ease to make a document with a colour picture. Normally it takes a lot of time.

We are only checking the first page for barcodes (set by another parameter), and that takes already 5 minutes (or that parameter maybe does not work either)

If you are not able to produce a pdf to check this case, please let me know. I will try to modify then an existing pdf.



image001.png (6.36 KB)

We have observed the timeout using the attached image and have logged it with the ticket. We will analyze it and share our feedback soon.

Our barcode library is not realtime system, so is has some lags in operations. Real-time systems has maximum lag lower then 10 ms, but we have processing lag on large images close to 150 ms.

According the documentation timeout is passed in milliseconds.

Also problem could be with DecodeType.ALL_SUPPORTED_TYPES, some of barcode processors (2D and Postal) has weak timeout support.


You are right about milliseconds, my mistake.

In my Example to your team the timeout is set in milliseconds=>1000604=240000 milliseconds=4 minutes

What is the status of the case please? Do you need any extra information from my side?



image001.png (6.36 KB)

We have noted your comments and will share our feedback soon.

We tested the work of the “timeout” property on 20.09, 20.10, 21.3 versions. I added a more complex image to show the result in a more clear way. You can test it with the attached example code and image “barcode_2.jpg”. We have the following results for 20.09 version:

Test image : barcode_2.jpg

Test timeout : 20 ms
elapsedTimeWithTimeout: 26
elapsedTimeWithoutTimeout: 3346
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

Test timeout : 60 ms
elapsedTimeWithTimeout: 70
elapsedTimeWithoutTimeout: 2207
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

Test timeout : 100 ms
elapsedTimeWithTimeout: 106
elapsedTimeWithoutTimeout: 1835
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

Test timeout : 120 ms
elapsedTimeWithTimeout: 123
elapsedTimeWithoutTimeout: 1788
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

Test timeout : 130 ms
elapsedTimeWithTimeout: 131
elapsedTimeWithoutTimeout: 1723
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

Test timeout : 150 ms
elapsedTimeWithTimeout: 150
elapsedTimeWithoutTimeout: 1534
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

Test timeout : 210 ms
elapsedTimeWithTimeout: 211
elapsedTimeWithoutTimeout: 1554
elapsedTimeWithTimeout < elapsedTimeWithoutTimeout: true

It’s a proper work of “timeout” property.

timeout_test.zip (80.1 KB)