hi,
I have found a 100% processor utilization condition that seems to occur
with this patch. It can be reproduced by increasing remotedelivery thread
count to any value greater then 1 while a failed message remains in the
outgoing mail repository waiting on retries. The processor should get into a
100% processor usage scenario until the failed message is removed from the
spool. The reason this occurs is due to the sharing of the unlock function
by the threads waiting on the accept method of AvalonSpoolRepository which
end up notifying each other infinitely.
Below is the fix that eliminates the problem while preserving the original
fix.
--- AvalonMailRepository.java (revision 325944)
+++ AvalonMailRepository.java (working copy)
@@ -200,9 +200,6 @@
.append(new
java.util.Date(System.currentTimeMillis()));
getLogger().debug(debugBuffer.toString());
}
- synchronized (this) {
- notify();
- }
return true;
} else {
return false;
@@ -303,6 +300,9 @@
if (!wasLocked) {
// If it wasn't locked, we need to unlock now
unlock(key);
+ synchronized (this) {
+ notify();
+ }
}
}
----- Original Message -----
From: "Serge Knystautas" <[EMAIL PROTECTED]>
To: "James Developers List" <server-dev@james.apache.org>
Sent: Wednesday, September 07, 2005 10:53 AM
Subject: Re: MailRepository notification/synchronization change (svn commit:
r279353)
Awesome stuff. Glad someone was finally able to track that one down.
--
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. [EMAIL PROTECTED]
On 9/7/05, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
I've just committed a patch I created today.
The bug was both in file repositories and db repositories.
Db repositories never sleeps forever so you simply had 60 seconds delay
when
the notification didn't work.
Adding a Thread.sleep(1000) after each notify() you can easily add
evidence
to notification issues.
If you never noticed the problem then you probably are lucky enough with
your thread timings.
I manually tested the spooling of single messages and ran stress-test to
verify the impact on performance.
Performance under stress are very similar.
Please test the change/review the code and report back any doubt.
I simply moved the notification to the "spool.unlock" method. I also added
locking/unlocking to the spool.store method.
I tryed to reduce differences between the file and db "synchronized"
methods
and locking policies.
Stefano
> Author: bago
> Date: Wed Sep 7 08:43:55 2005
> New Revision: 279353
>
> URL: http://svn.apache.org/viewcvs?rev=279353&view=rev
> Log:
> Fix for repository locks/notification/synchronization.
> I've done stress-test and test with Thread.sleep() after the
> notifications to ensure it is working but this is delicate
> and we should test it more.
> [...]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]