[
https://issues.apache.org/jira/browse/PDFBOX-4601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890057#comment-16890057
]
biswajit edited comment on PDFBOX-4601 at 7/23/19 11:49 AM:
------------------------------------------------------------
here is debug log:
{code:java}
[2019-07-22 10:05:16.333] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 0, raf length: 0
[2019-07-22 10:05:16.333] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 0
[2019-07-22 10:05:16.334] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
65536, raf length: 0
[2019-07-22 10:05:16.379] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 65536, raf length: 65536
[2019-07-22 10:05:16.379] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 65536
[2019-07-22 10:05:16.380] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
131072, raf length: 65536
[2019-07-22 10:05:16.393] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 131072, raf length: 131072
[2019-07-22 10:05:16.393] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 131072
[2019-07-22 10:05:16.393] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
196608, raf length: 131072
[2019-07-22 10:05:16.417] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 196608, raf length: 196608
[2019-07-22 10:05:16.417] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 196608
[2019-07-22 10:05:16.418] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
262144, raf length: 196608
[2019-07-22 10:05:16.421] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 262144, raf length: 262144
[2019-07-22 10:05:16.421] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 262144
[2019-07-22 10:05:16.421] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
327680, raf length: 262144
[2019-07-22 10:05:16.462] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 0, raf length: 0
[2019-07-22 10:05:16.462] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4050134786201270253.tmp, length: 0
[2019-07-22 10:05:16.462] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
65536, raf length: 0
[2019-07-22 10:05:16.463] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 65536, raf length: 65536
[2019-07-22 10:05:16.463] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4050134786201270253.tmp, length: 65536
[2019-07-22 10:05:16.463] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
131072, raf length: 65536
[2019-07-22 10:05:16.464] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 131072, raf length: 131072
[2019-07-22 10:05:16.464] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4050134786201270253.tmp, length: 131072
[2019-07-22 10:05:16.464] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
196608, raf length: 131072
[2019-07-22 10:05:16.468] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 0, raf length: 0
[2019-07-22 10:05:16.468] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox6315334738223655878.tmp, length: 0
[2019-07-22 10:05:16.468] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
65536, raf length: 0
[2019-07-22 10:05:16.482] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 65536, raf length: 65536
[2019-07-22 10:05:16.482] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox6315334738223655878.tmp, length: 65536
[2019-07-22 10:05:16.482] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
131072, raf length: 65536
[2019-07-22 10:05:16.503] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca ERROR c.o.a.l.DocumentAggregatorLambda -
o1nbcuniAvailsUKLxzVeXCGtcwf14 - DEFAULT_PDF - IOException
consolidatePDFAndUploadToS3:
java.io.IOException: Expected scratch file size of 196608 but found 192512r
at org.apache.pdfbox.io.ScratchFile.enlarge(ScratchFile.java:237)r
at org.apache.pdfbox.io.ScratchFile.getNewPage(ScratchFile.java:167)r
at org.apache.pdfbox.io.ScratchFileBuffer.addPage(ScratchFileBuffer.java:126)r
at org.apache.pdfbox.io.ScratchFileBuffer.<init>(ScratchFileBuffer.java:84)r
at org.apache.pdfbox.io.ScratchFile.createBuffer(ScratchFile.java:405)r
at org.apache.pdfbox.cos.COSStream.createRawOutputStream(COSStream.java:273)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:125)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:109)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:146)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:109)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:117)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:146)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:109)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:146)r
at
org.apache.pdfbox.multipdf.PDFMergerUtility.optimizedMergeDocuments(PDFMergerUtility.java:378)r
at
org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:350)r
at com.operative.aws.util.PDFMerger.merge(PDFMerger.java:45)r
at
com.operative.aws.lambda.DocumentAggregatorLambda.consolidatePDFAndUploadToS3(DocumentAggregatorLambda.java:390)r
at
com.operative.aws.lambda.DocumentAggregatorLambda.lambda$handleRequest$0(DocumentAggregatorLambda.java:202)r
at java.util.ArrayList.forEach(ArrayList.java:1257)r
at
com.operative.aws.lambda.DocumentAggregatorLambda.handleRequest(DocumentAggregatorLambda.java:61)r
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)r
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)r
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)r
at java.lang.reflect.Method.invoke(Method.java:498)r
at
lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:259)r
at
lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:178)r
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888)r
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:293)r
at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:64)r
at java.lang.Class.forName0(Native Method)r
at java.lang.Class.forName(Class.java:348)r
at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:114)r
[2019-07-22 10:05:16.682] [] " + NO_REQUEST_ID + " DEBUG
o.a.p.i.ScratchFileBuffer - ScratchFileBuffer not closed!
{code}
was (Author: debnath):
here is debug log:
[2019-07-22 10:05:16.333] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 0, raf length: 0
[2019-07-22 10:05:16.333] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 0
[2019-07-22 10:05:16.334] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
65536, raf length: 0
[2019-07-22 10:05:16.379] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 65536, raf length: 65536
[2019-07-22 10:05:16.379] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 65536
[2019-07-22 10:05:16.380] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
131072, raf length: 65536
[2019-07-22 10:05:16.393] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 131072, raf length: 131072
[2019-07-22 10:05:16.393] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 131072
[2019-07-22 10:05:16.393] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
196608, raf length: 131072
[2019-07-22 10:05:16.417] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 196608, raf length: 196608
[2019-07-22 10:05:16.417] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 196608
[2019-07-22 10:05:16.418] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
262144, raf length: 196608
[2019-07-22 10:05:16.421] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 262144, raf length: 262144
[2019-07-22 10:05:16.421] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4366862472065969198.tmp, length: 262144
[2019-07-22 10:05:16.421] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
327680, raf length: 262144
[2019-07-22 10:05:16.462] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 0, raf length: 0
[2019-07-22 10:05:16.462] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4050134786201270253.tmp, length: 0
[2019-07-22 10:05:16.462] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
65536, raf length: 0
[2019-07-22 10:05:16.463] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 65536, raf length: 65536
[2019-07-22 10:05:16.463] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4050134786201270253.tmp, length: 65536
[2019-07-22 10:05:16.463] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
131072, raf length: 65536
[2019-07-22 10:05:16.464] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 131072, raf length: 131072
[2019-07-22 10:05:16.464] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox4050134786201270253.tmp, length: 131072
[2019-07-22 10:05:16.464] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
196608, raf length: 131072
[2019-07-22 10:05:16.468] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 0, raf length: 0
[2019-07-22 10:05:16.468] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox6315334738223655878.tmp, length: 0
[2019-07-22 10:05:16.468] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
65536, raf length: 0
[2019-07-22 10:05:16.482] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen
before: 65536, raf length: 65536
[2019-07-22 10:05:16.482] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - file:
/tmp/PDFBox6315334738223655878.tmp, length: 65536
[2019-07-22 10:05:16.482] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca DEBUG o.a.p.i.ScratchFile - fileLen after:
131072, raf length: 65536
[2019-07-22 10:05:16.503] o1nbcuni [[email protected]]
7a964a35-6342-4182-890d-b3205d78c5ca ERROR c.o.a.l.DocumentAggregatorLambda -
o1nbcuniAvailsUKLxzVeXCGtcwf14 - DEFAULT_PDF - IOException
consolidatePDFAndUploadToS3:
java.io.IOException: Expected scratch file size of 196608 but found 192512r
at org.apache.pdfbox.io.ScratchFile.enlarge(ScratchFile.java:237)r
at org.apache.pdfbox.io.ScratchFile.getNewPage(ScratchFile.java:167)r
at org.apache.pdfbox.io.ScratchFileBuffer.addPage(ScratchFileBuffer.java:126)r
at org.apache.pdfbox.io.ScratchFileBuffer.<init>(ScratchFileBuffer.java:84)r
at org.apache.pdfbox.io.ScratchFile.createBuffer(ScratchFile.java:405)r
at org.apache.pdfbox.cos.COSStream.createRawOutputStream(COSStream.java:273)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:125)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:109)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:146)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:109)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:117)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:146)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:109)r
at
org.apache.pdfbox.multipdf.PDFCloneUtility.cloneForNewDocument(PDFCloneUtility.java:146)r
at
org.apache.pdfbox.multipdf.PDFMergerUtility.optimizedMergeDocuments(PDFMergerUtility.java:378)r
at
org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:350)r
at com.operative.aws.util.PDFMerger.merge(PDFMerger.java:45)r
at
com.operative.aws.lambda.DocumentAggregatorLambda.consolidatePDFAndUploadToS3(DocumentAggregatorLambda.java:390)r
at
com.operative.aws.lambda.DocumentAggregatorLambda.lambda$handleRequest$0(DocumentAggregatorLambda.java:202)r
at java.util.ArrayList.forEach(ArrayList.java:1257)r
at
com.operative.aws.lambda.DocumentAggregatorLambda.handleRequest(DocumentAggregatorLambda.java:61)r
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)r
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)r
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)r
at java.lang.reflect.Method.invoke(Method.java:498)r
at
lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:259)r
at
lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:178)r
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888)r
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:293)r
at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:64)r
at java.lang.Class.forName0(Native Method)r
at java.lang.Class.forName(Class.java:348)r
at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:114)r
[2019-07-22 10:05:16.682] [] " + NO_REQUEST_ID + " DEBUG
o.a.p.i.ScratchFileBuffer - ScratchFileBuffer not closed!
> in AWS lambda pdf merge giving error as Error in pdf consolidation: Expected
> scratch file size of 196608 but found 192512
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: PDFBOX-4601
> URL: https://issues.apache.org/jira/browse/PDFBOX-4601
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.12, 2.0.16
> Environment: AWS Lambda
> Reporter: biswajit
> Priority: Major
> Fix For: 2.0.17
>
>
> in AWS lambda pdf merge giving error as
> {{Error in pdf consolidation: Expected scratch file size of 196608 but found
> 192512.}}
> *Code:*
> {code}
> PDFMergerUtility pdfMerger = new PDFMergerUtility();
> pdfMerger.addSources(sources);
> pdfMerger.setDestinationStream(mergedPDFOutputStream);
> pdfMerger.mergeDocuments(MemoryUsageSetting.setupTempFileOnly());
> {code}
> both InputStream and OutputStream are ByteArrayInputStream and
> ByteArrayOutputStream. AWS Lambda environment has 512MB space available only
> for /tmp partition. This could be an issue or not I am not sure. And AWS
> lambda do not permit other directory than /tmp partition to create files.
> And while reading into the code I found below piece of code which I think
> always be true. Because if you add some constant amount to an integer that
> will always be constant amount greater than its original value
> in ScratchFile.java => enlarge() method:
> {code}
> if (pageCount + ENLARGE_PAGE_COUNT > pageCount)
> {
> fileLen += ENLARGE_PAGE_COUNT * PAGE_SIZE;
> raf.setLength(fileLen);
> freePages.set(pageCount, pageCount + ENLARGE_PAGE_COUNT);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]