Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Nov 28, 2022 5:07 pm

Hi,

We are using Spire.PDF to convert html file into PDF files, in a .NET 5.0 application.
While using it on local computer, there are no problems, we can generate a lot of PDF files without problems but in the docker image, we can generate some files and then it just stop work after time. The files aren't generated anymore.
It work again when we push a new version of the code on the docker but for a short amount of time.

I've seen on a post that a problem is occuring on linux, but i'm not sure if it's exactly the same problem since it work like a short amount of time.

I tried to debug a lot, like puting some logs & try catch to see if there are any exceptions but nothing appears ...

The strangest thing is like, it's seems totaly random. Sometimes it work like 4-5 hours and sometimes 1 to 2 days.

Has anyone ever met this problem ? And if yes, do you have any solution ?

PS : sorry for my bad english :)
Sincerely
Thomas

ThomasC31
 
Posts: 5
Joined: Mon Nov 28, 2022 4:51 pm

Tue Nov 29, 2022 10:04 am

Hello,

Thanks for your inquiry.
Are you using the latest version of Spire.Pdf 8.11.2? If not, please update to it and have a test. If the issue still exists, please offer the following message. Thanks for your assistance in advance.

1) The system environment of docker’s host, such as CentOS release 7.9.2009(The information obtained by using the “uname -a” command).
2) Is the QT plug-in used on linux downloaded from our official website?

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Nov 29, 2022 1:40 pm

Hello,

Thanks for the answer.
We aren't using the lastest version of Spire, since we only have an old license. Actually, we are using the version 5.7.3 of Spire.Office.

I just tried to update the nuget to the version 5.8.5, i'll tell you here if i see any changement, probably tommorow.

For the questions you asked, here are the answers :
1) There is the result of the command "uname -a" : Linux lp-vm-ubuntu 5.4.0-110-generic #124~18.04.1-Ubuntu SMP Fri Apr 22 12:01:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
2) Yes, we used the official plugin from your website.

Sincerely
Thomas

ThomasC31
 
Posts: 5
Joined: Mon Nov 28, 2022 4:51 pm

Mon Dec 05, 2022 9:32 am

I'm having a very similar problem as described by ThomasC31. In my case I'm trying to convert each page of the pdf to an image and save them in aws s3. Locally it works without a problem, same goes when I deploy it in docker locally, but when I push it to github and it gets deployed in aws ecs it then trows a java.lang.OutOfMemoryError: Java heap space.

I'm using spire.pdf version 8.11.8 for java (Unlicensed). I have tried to increase the heap size in the dockerfile and the docker-coompose.yml file but none of this worked.

There is one exception in this error and that is when the pdf has only one page, the conversion works just fine in all cases.

Here is the full stack trace for this problem:

Code: Select all
2022-12-05T10:06:18.041+01:00   2022-12-05 09:06:17.980 ERROR 1 --- [nio-8080-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space] with root cause
2022-12-05T10:06:18.041+01:00   java.lang.OutOfMemoryError: Java heap space
2022-12-05T10:06:18.041+01:00   at java.desktop/java.awt.image.DataBufferByte.<init>(DataBufferByte.java:76) ~[na:na]
2022-12-05T10:06:18.041+01:00   at java.desktop/java.awt.image.Raster.createInterleavedRaster(Raster.java:266) ~[na:na]
2022-12-05T10:06:18.041+01:00   at java.desktop/java.awt.image.BufferedImage.<init>(BufferedImage.java:391) ~[na:na]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprbjr.spr┩■(BufferedImageFactory.java:111) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprbjr.spr┼□(BufferedImageFactory.java:49) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprolv.spr︼™(Bitmap.java:190) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprolv.<init>(Bitmap.java:99) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprolv.<init>(Bitmap.java:95) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprdio.spr┚╺(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocumentBase.spr╾∮(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocumentBase.spr┵∭(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocument.spr—▁(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocument.saveAsImage(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]



Thanks in advance, Leo.

leo_3511
 
Posts: 2
Joined: Mon Dec 05, 2022 9:23 am

Tue Dec 06, 2022 3:49 am

ThomasC31 wrote:Hello,

Thanks for the answer.
We aren't using the lastest version of Spire, since we only have an old license. Actually, we are using the version 5.7.3 of Spire.Office.

I just tried to update the nuget to the version 5.8.5, i'll tell you here if i see any changement, probably tommorow.

For the questions you asked, here are the answers :
1) There is the result of the command "uname -a" : Linux lp-vm-ubuntu 5.4.0-110-generic #124~18.04.1-Ubuntu SMP Fri Apr 22 12:01:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
2) Yes, we used the official plugin from your website.

Sincerely
Thomas

Hello,

Thanks for your feedback.
How does it run with version 5.8.5?
Now, the latest version of Spire.Pdf is V 8.11.10, and the latest version is more stable than older version, therefore, I recommend you to use the latest version. And we are willing to provide a temporary license (one month free) to help you better evaluate our product. If you need it, you can contact our sales team([email protected]).
Looking forward to you reply.

Sincerely
Abel
E-iceblue support team
Last edited by Abel.He on Wed Dec 07, 2022 1:10 am, edited 1 time in total.
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Dec 06, 2022 9:58 am

leo_3511 wrote:I'm having a very similar problem as described by ThomasC31. In my case I'm trying to convert each page of the pdf to an image and save them in aws s3. Locally it works without a problem, same goes when I deploy it in docker locally, but when I push it to github and it gets deployed in aws ecs it then trows a java.lang.OutOfMemoryError: Java heap space.

I'm using spire.pdf version 8.11.8 for java (Unlicensed). I have tried to increase the heap size in the dockerfile and the docker-coompose.yml file but none of this worked.

There is one exception in this error and that is when the pdf has only one page, the conversion works just fine in all cases.

Here is the full stack trace for this problem:

Code: Select all
2022-12-05T10:06:18.041+01:00   2022-12-05 09:06:17.980 ERROR 1 --- [nio-8080-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space] with root cause
2022-12-05T10:06:18.041+01:00   java.lang.OutOfMemoryError: Java heap space
2022-12-05T10:06:18.041+01:00   at java.desktop/java.awt.image.DataBufferByte.<init>(DataBufferByte.java:76) ~[na:na]
2022-12-05T10:06:18.041+01:00   at java.desktop/java.awt.image.Raster.createInterleavedRaster(Raster.java:266) ~[na:na]
2022-12-05T10:06:18.041+01:00   at java.desktop/java.awt.image.BufferedImage.<init>(BufferedImage.java:391) ~[na:na]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprbjr.spr┩■(BufferedImageFactory.java:111) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprbjr.spr┼□(BufferedImageFactory.java:49) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprolv.spr︼™(Bitmap.java:190) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprolv.<init>(Bitmap.java:99) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprolv.<init>(Bitmap.java:95) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.packages.sprdio.spr┚╺(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocumentBase.spr╾∮(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocumentBase.spr┵∭(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocument.spr—▁(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]
2022-12-05T10:06:18.041+01:00   at com.spire.pdf.PdfDocument.saveAsImage(Unknown Source) ~[spire.pdf-8.11.8.jar!/:8.11.8]



Thanks in advance, Leo.


Hello,

Thanks for your inquiry.
Due to converting pdf to image will consum much memory. And Memory consumption is related to your documents, operation code and JVM configuration. Therefore, allocate as much memory as possible to the program.
In addition, how many GB of memory does it take to convert more than one page of pdf into a image on your local computer?
To help us do further investigation, please offer the following message:

1) Your input documents and the runnable code that can reproduce your issue, you can attach here or send it to us via email ([email protected]). And if the file is too big, you could upload your large file via Dropbox or OneDrive server, then share us with the download link.
2) The Jdk version, such as Oracle Jdk 1.8.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Dec 06, 2022 3:29 pm

Thanks for the reply, I'm using a 100kb file, Java 11, IntelliJ Ultimate, MacOS 12.6.1, in this environment it uses max 800MB of memory when I use a big file with about 20 pages, and less than 400 when using a 1 page PDF. When I use run the same operation in docker it uses max 1.2GB of memory. But when I deploy this on ECS it throws a heap size error when it hits page 2.
I cannot reply anymore on this issue since I solved this issue by using another library. Consider my issue as solved.
Thanks for helping out.

Kind Regards, Leo.

leo_3511
 
Posts: 2
Joined: Mon Dec 05, 2022 9:23 am

Wed Dec 07, 2022 2:22 am

leo_3511 wrote:Thanks for the reply, I'm using a 100kb file, Java 11, IntelliJ Ultimate, MacOS 12.6.1, in this environment it uses max 800MB of memory when I use a big file with about 20 pages, and less than 400 when using a 1 page PDF. When I use run the same operation in docker it uses max 1.2GB of memory. But when I deploy this on ECS it throws a heap size error when it hits page 2.
I cannot reply anymore on this issue since I solved this issue by using another library. Consider my issue as solved.
Thanks for helping out.

Kind Regards, Leo.


Hello,

Thanks for your feedback.
I'm glad to hear that your issue has been solved. Once if you have any issues in the future, just feel free to contact us.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Wed Dec 07, 2022 5:06 pm

Hello !

I was waiting some time to see any changes, and it's seems that changing the nuget version fixed the problem for me !

I will continue to watch just to be sure but i think it will be ok !

Thank you for your help !

Sincerely,

Thomas

ThomasC31
 
Posts: 5
Joined: Mon Nov 28, 2022 4:51 pm

Thu Dec 08, 2022 2:07 am

Hello,

Thanks for your feedback.
If you have any issue in the future, please don’t hesitate to contact us.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Dec 13, 2022 9:47 am

Hello,

It's me again !

I'm coming back here to give some more informations after time.

I met this problem again, but finally found a solution !

It wasn"t a problem of nuget or of ram. I found the problem by reproducing the issue in local, by restarting manually the docker image.

After doing it, a message just appeared in my docker logs :

2022-12-13 10:44:25 (EE)
2022-12-13 10:44:25 Fatal server error:
2022-12-13 10:44:25 (EE) Server is already active for display 99
2022-12-13 10:44:25 If this server is no longer running, remove /tmp/.X99-lock
2022-12-13 10:44:25 and start again.
2022-12-13 10:44:25 (EE)

Fun fact, this error doesn't appear on server, don't know why. Also, it don't raise any exception in the code.
When i remove the file /tmp/.X99-lock its working again !

I didn't tested on server yet, but i will keep you informed as soon as i put the fix on the server.

Sincerelly,

Thomas

ThomasC31
 
Posts: 5
Joined: Mon Nov 28, 2022 4:51 pm

Tue Dec 13, 2022 10:03 am

Hello,

Thanks for your feedback and sharing your problem-solving process.
I'm glad to hear that your issue has been solved in local. I also keep following this post.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Dec 23, 2022 1:32 pm

Hello guys !

I just wanted to tell you that removing the .X99-lock at the launch of the docker image seems to have fixed the problem for us !

It's been more than one week and the problem never happened again !

Thanks for the support and i hope my solution will fix the problem for another persons !

Sincerelly.

Thomas

ThomasC31
 
Posts: 5
Joined: Mon Nov 28, 2022 4:51 pm

Mon Dec 26, 2022 9:36 am

Hello,

Thanks for your feedback.
I’m glad to hear that your issue has been solved. I‘m sure it will be helpful to many others facing the same issue.
If you have any issue in the future, just feel free to contact us.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF

cron