1) AvalonMailRepository caches *keys* of messages currently stored.
2) The repository itself is *weak* referenced when used as James inbox: it was hard referenced in James 2.2.0.
  2b) see below...
3) The File_Persistent_Stream_Repository currently caches every inputstream and outputstream used and never release them.

Maybe it is safe to comment the m_inputs and m_outputs hashmaps in the File_Persistent_Stream_Repository as I suggested to try, but this should be confirmed by manual tests.

File_Persistent_Stream_Repository has been copied by the cornerstone-store project. I checked their last version to see if they changed anything and they refactored a lot of things but the m_inputs/m_outputs behaviour seems unchanged.

Imho you would only have to check that solution and put it in trunk and backport it to 2.3 or whatever you like.

Even if I think this is a bug I'm surprised that this throw an OOM even in the current James 2.3 branch code and trunk: inbox repositories are kept in a ReferenceMap (soft values) so the whole "leak" should only be referenced via a weak reference and the JVM should try to remove the whole thing before dying under an OOM.

2b) Btw this would be anyway a problem with the SpoolRepository. The spoolrepository is not weak, so a file based spool repository will end up in OOM if not patched (either in 2.2.0, 2.3 branch and trunk).

Stefano

Joachim Draeger wrote:
Noel J. Bergman schrieb:
Re: http://issues.apache.org/jira/browse/JAMES-512

This problem sounds related one we've previously documented, but not
finished fixing. The file-based repositories maintain an in-memory list of
the e-mails, which grows forever unless you remove messages from it.

They hold references to the complete messages? It should be possible to make them only cache key2filename relation and load messages only on retrieve().

The in-memory message list is initialized when the repository is first
accessed during each server execution, and maintained in-memory for the
remainder of the server process.

My latest information by Stefano was that there should be only weak references to the MessageRepositories and they are gc'ed away after no one is accessing them anymore. IMHO James shouldn't hold a references to every MessageRepository even if it is not accessed. It has to be possible between list() and retrieve() operations to cache something.
Either the references have to be weak or explicitly removed.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to