Hello
Perhaps have you some advices to give on how to speed up debugging with eclipse : when I’m debugging, stepping over a call to a Aspose method call seems to hang. In fact it becomes very very sloooowwww…
If I click “Suspend” in the Debug view, I see that execution is deep inside jar classes exploration.
Last year I remember that with older Aspose pdf jar I could just click “Suspend” and then “Resume (F8)” and it did make it to run fast again.
But now I use the last eclipse 21-12 and aspose-pdf-22.1.jar and the “Resume (F8)” does not make it fast anymore.
I searched on google for “java debugging sometimes takes long time” and “java debugging hangs when step over”, then tried the different tricks, but this did not fix the hang/slow when stepping over Aspose calls which can takes minutes.
Since some weeks it becomes very hard to debug due to this, and I must restart the whole server application just to save time to not wait minutes…
Please do you know this problem ?
Have you idea how to fix it ?
Why only for Aspose lib calls… Is it perhaps due to a protection mechanism ?
Thanks by advance if you have any advice.
@everteamjmf
First of all, please try to use the latest available version i.e. 22.2 as always recommended. Then you can please try increasing the Java Heap Size and see if it makes things better. In case you still notice the delay in debugging process, please share a chunk of code snippet along with sample PDF document that you are processing. We will test the scenario in our environment and address it accordingly.
Hello
Thanks for your quick answer, I tried what you wrote but it is the same.
So I did a small eclipse project to reproduce :
Before running the test, please :
- in the main() method, replace “D:/src/workspace/TestAspose/” with your own project directory
- add aspose-pdf-22.2.jar in the /lib directory. (too big to put in the zip)
Note that only the calls to Aspose objects produce long hangs.
The test opens a pdf document with 2 pages and calls some Aspose methods.
From the source in the project :
// The code in the try takes only 2 seconds to reach the finally call
// if executing "Debug as Application" + Resume (F8)
document = new Document( _ProjDir + "pdf/test.pdf" ); // <<<<<<<<<< 22 sec
int pagescount = document.getPages().size();
for (int i = 1; i <= pagescount; i++) {
// If using step over debugging, the first loop takes much longer
// Here are the times following "<<<<<<" if stepping over Aspose calls
Page page = document.getPages().get_Item( i ); // <<<<<<<<<< 8 sec
Font font = FontRepository.findFont( "Helvetica" ); // <<<<<<<<<< 27 sec
font.setEmbedded( true );
TextStamp stamp = new TextStamp( "test" ); // <<<<<<<<<< 3 sec
stamp.getTextState().setFont( font );
page.addStamp( stamp ); // <<<<<<<<<< 17 sec / (once 152 sec, and once longer)
// Only the calls during the first loop are slow.
// Stepping over the same loop an other time is fast.
}
=> Using debug + step over from the open document to the end of the first loop it takes more than 1 minute.
=> The second loop is executed fast with step over.
I commented the code with “// <<<<<<<<<<” in the slow lines, with their average time.
Please note that :
- in this test some Aspose calls are fast, but they can hang in our application. For example “getPages().size()” and others.
- even if I cannot show you, with our application (web server) times are much longer than with this test.
I’m sure that you understand that with these times it is very hard to develop/debug : we are obliged to restart our web server each time we forget to hit Resume (F8) and do a step over Aspose calls.
In my knowledge we do not have this hang problem when calling other jars (we use more than 400 external jars) or our own classes, so I suppose Aspose jar is doing something special ?
Thanks for your help.
jmf
@everteamjmf
The Aspose.PDF loads all required resources like system fonts, provided document structure, etc. in the memory at the start which causes delays in the execution. Once all resources are already loaded into memory, the execution time is fast. That is why you noticed less time on subsequent debugging.
Nevertheless, we have observed similar behavior in our environment during testing your application and have logged an issue as PDFJAVA-41415 in our issue management system to investigate whether this performance can further be improved. We will definitely look into details of it and let you know once the ticket is resolved. Please be patient and spare us some time.
We are sorry for the inconvenience.
PS: We removed the attachment from your last message after downloading it as it contained your license file.
Thank you very much.
I consider this as very important since it did prevent me to debug my new code using Aspose.PDF a lot these last days, because restarting a large application every several minutes is not productive.
As an alternative, I’d prefer that “new Document” would prepare/load more structures/resources so that other calls could be faster using step over.
I forget to say that we, Everteam, have a global license (you can verify I let it in the test project).
Have a nice day
jmf
@everteamjmf
We have recorded your feedback and concerns with the ticket as well and will surely let you know once we have some updates in this regard. Please spare us some time.