You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Adam Retter <ad...@googlemail.com> on 2015/12/02 01:16:31 UTC
2.0.0-RC2 ScratchFileBuffer not closed!
Hey guys,
Using either 2.0.0-RC1 or 2.0.0-RC2 I am seeing a lot of debug
messages which look like:
"ScratchFileBuffer not closed!"
When I trace this it appears that this is called by `finalize` being
called on the ScratchFileBuffer.
I am opening and closing my PDDocument by using try-with-resources, i.e.
try(final PDDocument doc = PDDocument.load(pdf.asFile)) {
...
}
As far as I can see I am not manually specifying any Scratch files,
are there any known issues with these not being correctly freed in
2.0.0?
Cheers Adam.
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: 2.0.0-RC2 ScratchFileBuffer not closed!
Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,
Am 02.12.2015 um 01:16 schrieb Adam Retter:
> Hey guys,
>
> Using either 2.0.0-RC1 or 2.0.0-RC2 I am seeing a lot of debug
> messages which look like:
>
> "ScratchFileBuffer not closed!"
>
> When I trace this it appears that this is called by `finalize` being
> called on the ScratchFileBuffer.
>
> I am opening and closing my PDDocument by using try-with-resources, i.e.
>
> try(final PDDocument doc = PDDocument.load(pdf.asFile)) {
> ...
> }
>
> As far as I can see I am not manually specifying any Scratch files,
> are there any known issues with these not being correctly freed in
> 2.0.0?
It looks like the finalize is faster than the auto-close.
So, the question is, do you dereference the doc instance right at the end of
your try-with-resources block or is something memory consuming/else done before
reaching the end so that there is enough time for the garbage collection to be
ran before (automatically) calling doc.close?
> Cheers Adam.
BR
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: Fwd: 2.0.0-RC2 ScratchFileBuffer not closed!
Posted by Timo Boehme <ti...@ontochem.com>.
Hi,
this means that ScratchFileBuffer(s) were created on ScratchFile without
closing them. While a COSDocument will currently automatically close the
ScratchFile, the buffers, using the ScratchFile still exists (there
would be an IOException if a read/write method of the buffer is executed).
There are 2 options coming to my mind for suppressing the debug error
message in case ScratchFile is already closed ( a) check ScratchFile
state before printing message, b) ScratchFileBuffer is listening to
close call of ScratchFile and close itself), but I would rather propose
to fix the source of the problem - the not closed buffer - which I
believe will be an COSStream which is not closed.
In order to do the latter one we would need to have a short code snipped
demonstrating the problem.
Best,
Timo
Am 11.12.2015 um 21:02 schrieb John Hewson:
> Timo, any thoughts on this?
>
> — John
>
>> Begin forwarded message:
>>
>> From: Adam Retter <ad...@googlemail.com>
>> Date: 1 December 2015 at 16:16:31 GMT-8
>> To: users@pdfbox.apache.org
>> Subject: 2.0.0-RC2 ScratchFileBuffer not closed!
>>
>> Hey guys,
>>
>> Using either 2.0.0-RC1 or 2.0.0-RC2 I am seeing a lot of debug
>> messages which look like:
>>
>> "ScratchFileBuffer not closed!"
>>
>> When I trace this it appears that this is called by `finalize` being
>> called on the ScratchFileBuffer.
>>
>> I am opening and closing my PDDocument by using try-with-resources, i.e.
>>
>> try(final PDDocument doc = PDDocument.load(pdf.asFile)) {
>> ...
>> }
>>
>> As far as I can see I am not manually specifying any Scratch files,
>> are there any known issues with these not being correctly freed in
>> 2.0.0?
>>
>> Cheers Adam.
>>
>> --
>> Adam Retter
>>
>> skype: adam.retter
>> tweet: adamretter
>> http://www.adamretter.org.uk
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
>
--
Timo Boehme
OntoChem IT Solutions GmbH
Blücherstraße 24
06120 Halle (Saale)
Germany
phone: +49 345 478 047 4 | fax: +49 345 478 047 1
email: ulf.laube@ontochem.com | web: www.ontochem.com
HRB 21962 Amtsgericht Stendal | USt-IdNr.: DE815563824
managing director : Lutz Weber
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Fwd: 2.0.0-RC2 ScratchFileBuffer not closed!
Posted by John Hewson <jo...@jahewson.com>.
Timo, any thoughts on this?
— John
> Begin forwarded message:
>
> From: Adam Retter <ad...@googlemail.com>
> Date: 1 December 2015 at 16:16:31 GMT-8
> To: users@pdfbox.apache.org
> Subject: 2.0.0-RC2 ScratchFileBuffer not closed!
>
> Hey guys,
>
> Using either 2.0.0-RC1 or 2.0.0-RC2 I am seeing a lot of debug
> messages which look like:
>
> "ScratchFileBuffer not closed!"
>
> When I trace this it appears that this is called by `finalize` being
> called on the ScratchFileBuffer.
>
> I am opening and closing my PDDocument by using try-with-resources, i.e.
>
> try(final PDDocument doc = PDDocument.load(pdf.asFile)) {
> ...
> }
>
> As far as I can see I am not manually specifying any Scratch files,
> are there any known issues with these not being correctly freed in
> 2.0.0?
>
> Cheers Adam.
>
> --
> Adam Retter
>
> skype: adam.retter
> tweet: adamretter
> http://www.adamretter.org.uk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>