[Html2PdfConverter] Bug in PDF generation

[Html2PdfConverter] Bug in PDF generation

  
Forge Component
(40)
Published on 24 Mar by Guilherme Pereira
40 votes
Published on 24 Mar by Guilherme Pereira
Hi all,

A bug was found on this component. 

Found scenario:
Two users call at the same time for two different pdf's to be generated. Both retrieve the same pdf binary. 
This is a very serious bug if you have a multi-tenant application with high usage from users, because it may discredit the multi-tenancy capability from the OutSystems platform.

Analysis:
This situation occurs because the generated random name for the temporary pdf file only takes into account the timestamp. If two requests have the same timestamp, only one temporary file will be created because the other one will be overwritten.

Solution:
The temporary filename random method should take more factors into account besides the timestamp. 
Eg. (Hashing the input URL, quantity of memory available for the garbage collector, etc)

Thank you. 





Hi Rui,

Thanks for the feedback.Eventhough quite rare this is indeed a possible scenario.
To help prevent it but keeping it simple I've released anew version and included a random GUID on the filename that should prevent such scenarios.

Cheers,
Guilherme

Hi Guilherme,

nicely done!

Regard