Hi all,
I have a multi-threaded app which (amongst other things) creates mail files and writes them to disk. When this app is under heavy load, I get several threads "left behind" which appear to be stuck on the call to awaitSpace() within the PipedInputStream class.
In debug, I notice that this method just loops around forever waiting for input. The problem is that I'm not controlling this. I'm just calling the writeTo(OutputStream) method of the MimeMessage class in JavaMail.
Goes something like this...
FileOutputStream fout = null;
try {
fout = new FileOutputStream("somefile.txt");
// Just a normal MimeMessage class initialised elsewhere
message.writeTo(out);
fout.flush();
}
finally {
if (fout != null) {
fout.close();
}
}
This obviously works fine, but under heavy load the call to message.writeTo(out); blocks forever.
Not sure if it's a problem with the MimeMessage class or the PipedInputStream class (or my code?).
Anyone seen this behaviour before?
I'm using JDK 1.5.0_04