GoogleIt Mail IT Print IT PermaLinkSNTT: Don't Forget To Close That Stream!
10:06:39 PM

Julian flagged this almost three years ago, but it bears repeating. I just got bit by this issue today. I did figure out the problem before finding Julian's solution, but not before a few more hairs were pulled out. And Julian mentions that the problem occurs with Domino 6.5.1, and I can confirm that the problem still exists in Domino 7.0.2.

Here's the problem. The help doc for the InputSource property of the EmbeddedObject Java class in the Lotus Domino back-end classes says:


EmbeddedObject.getInputStream creates a temporary file. The file is deleted when EmbeddedObject is recycled.

What it really should say is this:


EmbeddedObject.getInputStream creates a temporary file. The file is deleted when EmbeddedObject is recycled, but only if the close() method of the InputStream object returned by this property has been called before the EmbeddedObject is recycled. Failure to explicitly close the InputStream object will result in the temporary file remaining in the filesystem, which can cause the system to run out of disk space when running an agent that processes many EmbeddedObjects.

Please note: when I referred above to the fact that "the problem still exists in Domino 7.0.2", I was referring to the fact that the critical information is still missing from the documentation. I'm not trying to imply that failure to delete the file is a bug, because I recognize that still open files can not be deleted by the recycle() method. And even if the InputStream object has gone out of scope by the time the EmbeddedObject.recycle() method has been called there is no guarantee that the InputStream has been garbage-collected and closed yet, so the close really has to be done explicitly.

On the other hand, recycle has void return type, and it doesn't throw an error if you call it for an EmbeddedObject whose InputStream temporary file can't be closed; so the fact that there is no way to detect this problem really should be considered a design flaw in the Domino Java classes. And the fact that the InputStream object requires a temp file in the first place... well, that's an unfortunate design limitation. It would be so much better if you could just stream the data directly to memory from the NSF representation, instead of having to absorb the overhead of writing the temp file.

And by the way: although I haven't tested this, I'm reasonably sure that all of the above information also applies to the getInputSource property of EmbeddedObject as well.

This page has been accessed 396 times. .
Comments :v

1. tom10/18/2007 07:51:31 AM

Dr. Egon Spengler: There's something very important I forgot to tell you.
Dr. Peter Venkman: What?
Dr. Egon Spengler: Don't cross the streams.
Dr. Peter Venkman: Why?
Dr. Egon Spengler: It would be bad.
Dr. Peter Venkman: I'm fuzzy on the whole good/bad thing. What do you mean, "bad?"
Dr. Egon Spengler: Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light.
Dr Ray Stantz: Total protonic reversal.
Dr. Peter Venkman: Right. That's bad. Okay. All right. Important safety tip. Thanks, Egon.

2. Richard Schwartz10/18/2007 08:11:01 AM

Thanks, Tom. Important safety tip, indeed!

Blocked Response!11/28/2007 09:32:01 AM

This response from IP Address was blocked by the owner of this blog.

4. pietre10/04/2016 06:20:41 AM

There is ample evidence that drugs such as , , Cialis and Levitra do work for many men.

5. leilei391502/28/2017 02:26:25 AM

20170228 leilei3915

6. zzzzz02/28/2017 08:51:09 PM

7. chenlixiang08/11/2017 08:56:39 AM lauren.html

Enter Comments^

Email addresses provided are not made available on this site.

You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links

:-x :cry: :laugh: :-( :cool: :huh: :-) :angry: :-D ;-) :-p :grin: :rolleyes: :-\ :emb: :lips: :-o
bold italic underline Strikethrough

Remember me    

Monthly Archive
Responses Elsewhere

About The Schwartz


All opinions expressed here are my own, and do not represent positions of my employer.