[ 
https://issues.apache.org/jira/browse/PDFBOX-4601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890918#comment-16890918
 ] 

biswajit commented on PDFBOX-4601:
----------------------------------

Hi,

Thanks for new build. I'll test with latest build and let you know. In the mean 
time I got reply from AWS team and below is their response. Thought this might 
be helpful.
{panel:title=Reply from AWS }


My sincere apologies for the delay - our internal team do have an update on the 
case.

 

Our service team informs that the behavior we observe is related to a known 
issue, which is related to the Lambda execution environment as detailed in the 
following link:

 

[https://aws.amazon.com/cn/blogs/compute/upcoming-updates-to-the-aws-lambda-execution-environment/]

 

 

I would like to make the following recommendations:

 

To verify if this is an issue caused by this runtime variant migration, could 
you please attach the arn:aws:lambda:::awslayer:AmazonLinux1703 layer in your 
Lambda function, then try again? If this fixed their problem, then this is an 
issue related with our migration as in the above link.

 

In the above case, please rest assured that the issue is known and will be 
resolved once the rollout is complete as per the timeline shown in the above 
link. Therefore, the arn:aws:lambda:::awslayer:AmazonLinux1703 layer will only 
be a temporary mitigation, which is supposed to be invalid anymore after Jul 
25. if this is causing any emergent production pains, please let me know and I 
can bring that to the attention of our service team.

 

Alternatively, given this issue is related with RandomeAccessFile ( which 
internally use sun.misc.Unsafe.copyMemory ), and we have seen another related 
cases with the same issue, we suggest that you refrain from using that 
class/library in the meantime.
{panel}

> 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]

Reply via email to