You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Stephen McConnell <mc...@apache.org> on 2002/08/16 06:35:11 UTC

James under Merlin

I've been playing around with James under Merlin.

During the process I came accross a runtime problem:

  1. The class AvalonUsersStore is referenced as a Component
     somewhere or other but doesn't implement the Component
     interface

  2. After starting James inside Merlin, then sending an email
     to an arbitary name on the server James is running on,
     I get NPE - which is where I figure I may need some help
     from you guys ...

Cheers, Steve.

James log:
----------

[INFO   ] (root.james.smtp-server): Hello Name is: home
[INFO   ] (root.james.smtp-server): Connection from zola.noos.net 
(212.198.2.76)
[INFO   ] (root.james.james): Mail Mail1029472297203-0 pushed in spool
[INFO   ] (root.james.smtp-server): Mail sent to Mail Server
[ERROR  ] (root.james.mailstore): Exception retrieving mail: 
java.lang.RuntimeException: Exception caught while retrieving an object: 
java.i
o.StreamCorruptedException: unexpected end of block data, so we're 
deleting it... good riddance!
java.lang.NullPointerException
        at 
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:273)
        at 
org.apache.avalon.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java:47)
        at 
org.apache.avalon.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:80)
[ERROR  ] (root.james.spool): Exception in JamesSpoolManager.run null



-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Paul Hammant <Pa...@yahoo.com>.
Stephen,

>  1. The class AvalonUsersStore is referenced as a Component
>     somewhere or other but doesn't implement the Component
>     interface

If this really is the case, then we should put Component back as an 
interface it impls.  We need to take a long term decision about the 
maillets uses of Component.  This was the blocker for Component's 
complete removal from JAMES (and Conposable's replacement with Serviceable).

- Paul


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Stephen McConnell <mc...@apache.org>.
Noel:

I've added the James related resources to the Merlin 2.0 CVS.

    CVS Respository:
    jakarta-avalon-excalibur/assembly

James content is in ./demo/james - which corresponds to the attached 
files (a) the README.TXT file which details changes need to the CVS 
sources, and (b) james.xml.  The james.xml file is the file that Merlin 
uses to build a container hierachy of the assorted cornerstone services 
and the james components.

Cheers, Steve.



Noel J. Bergman wrote:

>Steve,
>
>You're probably seeing the FAQ item.  Are you running the CVS HEAD?  It
>should happen far less frequently with changes made recently to the code.
>Basically, an exception occurs because of a known race condition.  A thread
>picks up a mail item from the spool.  After it gets the item, it attempts to
>lock the item.  If another thread has it locked, then the second thread will
>give up and go back for another item.  However, there is a window where one
>thread can pickup an item from the spool, and between when it gets the spool
>item and when it attempts to lock it, the thread that actually owns the
>spool item removes it from the spool and unlocks it.  So the second thread
>finds that it is able to lock it, but when it goes to get it, the item is
>gone.
>
>The code:
>
>                String key = spool.accept();
>                MailImpl mail = spool.retrieve(key);
>                if (infoEnabled) {
>
>should be changed to:
>
>                String key = spool.accept();
>                MailImpl mail = spool.retrieve(key);
>                if (mail == null) continue;
>                if (infoEnabled) {
>
>since we know that spool.retrieve(key) can return null.  Try patching your
>copy of the code, and see if that doesn't fix it.
>
>	--- Noel
>
>-----Original Message-----
>From: Stephen McConnell [mailto:mcconnell@apache.org]
>Sent: Friday, August 16, 2002 2:15
>To: James Developers List
>Subject: Re: James under Merlin
>
>
>
>
>In JamesSpoolManager, run method:
>
>                MailImpl mail = spool.retrieve(key);
>
>The mail variable is is the source of the NPE.
>
>Steve.
>
>
>Stephen McConnell wrote:
>
>  
>
>>Paul Hammant wrote:
>>
>>    
>>
>>>Stephen,
>>>
>>>      
>>>
>>>>I've been playing around with James under Merlin.
>>>>
>>>>During the process I came accross a runtime problem:
>>>>
>>>> 1. The class AvalonUsersStore is referenced as a Component
>>>>    somewhere or other but doesn't implement the Component
>>>>    interface
>>>>        
>>>>
>>>
>>>Err should be able to fix that one.
>>>      
>>>
>>
>>It rather easy!
>>
>>    
>>
>>>      
>>>
>>>> 2. After starting James inside Merlin, then sending an email
>>>>    to an arbitary name on the server James is running on,
>>>>    I get NPE - which is where I figure I may need some help
>>>>    from you guys ...
>>>>        
>>>>
>>>
>>>This is where we wich we could unit test each comp.
>>>      
>>>
>>
>>Something to keep in mind is that I'm using the CVS version of
>>cornerstone components.  I had to do a number of updates to
>>cornerstone including
>>
>> (a) addition of the Component interface to soem of the blocks
>>     becuase they are used in James - so adding Component is
>>     basically a backward compatibility thing
>>
>> (b) addition of some meta-info into a couple of the blocks so
>>     that Merlin can automatically build the services without
>>     having Phoenix around
>>
>>Apart from the above, the only differences are that I'm using a few
>>more excalibur jar files that are not included in the James lib
>>(because they are included in Phoenix and not in Merlin) and
>>naturally, this bypasses all of the Phoenix config, assembly, and
>>server files.
>>
>>    
>>
>>>A guy at BP has written a generic AbstractPhoenixTestCase (where
>>>Phoenix is mocked).  I'll get him to write it up and someone might do
>>>the same thing inside Phoenix CVS or maybe Merlin CVS ? :-)
>>>      
>>>
>>
>>I'll put in place a Merlin projects directory containing the James
>>content and update the CVS.
>>
>>    
>>
>>>Failing that we'll have to do good old fashioned debugging.  Question
>>>do you use IntelliJ ?  Have you got interactive debuging working with
>>>Phoenix?
>>>      
>>>
>>
>>No on both points!
>>In the meantime I'll start tracking it down.
>>
>>Cheers, Steve.
>>
>>
>>    
>>
>>>- Paul
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org>
>>>For additional commands, e-mail:
>>><ma...@jakarta.apache.org>
>>>
>>>      
>>>
>
>--
>
>Stephen J. McConnell
>
>OSM SARL
>digital products for a global economy
>mailto:mcconnell@osm.net
>http://www.osm.net
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>  
>

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net



RE: James under Merlin

Posted by "Noel J. Bergman" <no...@devtech.com>.
Stephen,

AvalonMailRepository and JDBCMailRepository differ in at least one
significant interface that I have noticed:
AvalonMailRepository.retrieve(String) returns null when there is no message
in the spool (as documented); JDBCMailRepository.retrieve(String) throws an
exception.  There ought to be null handling after calling
MailRepository.retrieve().  I'm submitting a patch for that issue.

You might want to modify your debugging log to include:

   getLogger().info(--- WHATEVER MESSAGE YOU WANT ---
                    + " for "
                    + Thread.currentThread().getName()
                    + " @ "
                    + new java.util.Date(System.currentTimeMillis()));

That would give you better thread level information.

I expect that we'll see that it was the other worker threads that saw the
message in the repository.  The question is which one locked the message,
and which one generated the exception.

By the way, I notice that in AvalonMailRepository.lock(String), the
notifyAll() is active.  In JDBCMailRepository.lock(String), it is commented
out.  I don't believe that we need to notify other threads when we acquire a
lock.  While you're at it, you might try commenting that out, but you'll
have a better idea when you've got thread related information in the log.

	-- Noel


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Stephen McConnell <mc...@apache.org>.

Noel J. Bergman wrote:

>>What would be really great is if a James wiz could check out the 
>>Merlin/James demo package I've put together and give me some
>>feedback if the sort of things I'm seeing are resonable or not.
>>
>
>What are you seeing?
>

#
# Here is the log with debugging set DEBUG level for the mailstore.
#

$ java -Djava.ext.dirs=.\extensions -jar .\extensions\merlin.jar 
demo\james\james.xml

[INFO   ] (root.james): start: dns, nntp, [store#26644003], 
[datasource#16675983], users, nntp-auth, [threads#17764792], 
[connections#181635
14], [sockets], [null#26174005], nntp-server, mailstore, main, spool, 
smtp-server, remote
[INFO   ] (root.james.dns): DNSServer init...
[INFO   ] (root.james.dns): DNS Servers is: 127.0.0.1
[INFO   ] (root.james.dns): DNS Servers is: 212.198.0.66
[INFO   ] (root.james.dns): DNS Servers is: 212.198.0.67
[INFO   ] (root.james.dns): DNS Servers is: 194.51.32.65
[INFO   ] (root.james.dns): DNSServer ...init end
[INFO   ] (root.james.main): JAMES init...
[INFO   ] (root.james.mailstore): JamesMailStore init...
[INFO   ] (root.james.mailstore): Registering Repository 
org.apache.james.mailrepository.AvalonMailRepository
[INFO   ] (root.james.mailstore): Registered class: 
fileMAIL->org.apache.james.mailrepository.AvalonMailRepository
[INFO   ] (root.james.mailstore): Registering Repository 
org.apache.james.mailrepository.AvalonSpoolRepository
[INFO   ] (root.james.mailstore): Registered class: 
fileSPOOL->org.apache.james.mailrepository.AvalonSpoolRepository
[INFO   ] (root.james.mailstore): Registering Repository 
org.apache.james.mailrepository.JDBCMailRepository
[INFO   ] (root.james.mailstore): Registered class: 
dbMAIL->org.apache.james.mailrepository.JDBCMailRepository
[INFO   ] (root.james.mailstore): Registering Repository 
org.apache.james.mailrepository.JDBCSpoolRepository
[INFO   ] (root.james.mailstore): Registered class: 
dbSPOOL->org.apache.james.mailrepository.JDBCSpoolRepository
[INFO   ] (root.james.mailstore): Registering Repository 
org.apache.james.mailrepository.JDBCMailRepository
[INFO   ] (root.james.mailstore): Registered class: 
dbfileMAIL->org.apache.james.mailrepository.JDBCMailRepository
[INFO   ] (root.james.mailstore): Registering Repository 
org.apache.james.mailrepository.JDBCSpoolRepository
[INFO   ] (root.james.mailstore): Registered class: 
dbfileSPOOL->org.apache.james.mailrepository.JDBCSpoolRepository
[DEBUG  ] (root.james.mailstore): obtained repository: 
org.apache.james.mailrepository.AvalonSpoolRepository to handle: file,SPOOL
[DEBUG  ] (root.james.mailstore): AvalonMailRepository.destinationURL: 
file://var/mail/spool/
[DEBUG  ] (root.james.mailstore): 
org.apache.james.mailrepository.AvalonSpoolRepository created in 
file://var/mail/spool/
[INFO   ] (root.james.mailstore): added repository: 
file://var/mail/spool/SPOOL->org.apache.james.mailrepository.AvalonSpoolRepository
[INFO   ] (root.james.mailstore): SpoolRepository inboundSpool opened: 
19583390
[INFO   ] (root.james.mailstore): James MailStore ...init
[INFO   ] (root.james.main): Local host is: home
[INFO   ] (root.james.main): Handling mail for: home
[INFO   ] (root.james.main): Handling mail for: localhost
[INFO   ] (root.james.main): Handling mail for: home.osm.net
[INFO   ] (root.james.main): Local users repository opened
[DEBUG  ] (root.james.mailstore): obtained repository: 
org.apache.james.mailrepository.AvalonMailRepository to handle: file,MAIL
[DEBUG  ] (root.james.mailstore): AvalonMailRepository.destinationURL: 
file://var/mail/inboxes/
[DEBUG  ] (root.james.mailstore): 
org.apache.james.mailrepository.AvalonMailRepository created in 
file://var/mail/inboxes/
[INFO   ] (root.james.mailstore): added repository: 
file://var/mail/inboxes/MAIL->org.apache.james.mailrepository.AvalonMailRepository
[INFO   ] (root.james.main): Private Repository LocalInbox opened
James 2.1a1-cvs
[INFO   ] (root.james.main): JAMES ...init end
[DEBUG  ] (root.james.mailstore): obtained repository: 
org.apache.james.mailrepository.AvalonMailRepository to handle: file,MAIL
[DEBUG  ] (root.james.mailstore): AvalonMailRepository.destinationURL: 
file://var/mail/error/
[DEBUG  ] (root.james.mailstore): 
org.apache.james.mailrepository.AvalonMailRepository created in 
file://var/mail/error/
[INFO   ] (root.james.mailstore): added repository: 
file://var/mail/error/MAIL->org.apache.james.mailrepository.AvalonMailRepository
[DEBUG  ] (root.james.mailstore): obtained repository: 
org.apache.james.mailrepository.AvalonSpoolRepository to handle: file,SPOOL
[DEBUG  ] (root.james.mailstore): AvalonMailRepository.destinationURL: 
file://var/mail/outgoing/
[DEBUG  ] (root.james.mailstore): 
org.apache.james.mailrepository.AvalonSpoolRepository created in 
file://var/mail/outgoing/
[INFO   ] (root.james.mailstore): added repository: 
file://var/mail/outgoing/SPOOL->org.apache.james.mailrepository.AvalonSpoolRepository
[DEBUG  ] (root.james.mailstore): obtained repository: 
org.apache.james.mailrepository.AvalonMailRepository to handle: file,MAIL
[DEBUG  ] (root.james.mailstore): AvalonMailRepository.destinationURL: 
file://var/mail/spam/
[DEBUG  ] (root.james.mailstore): 
org.apache.james.mailrepository.AvalonMailRepository created in 
file://var/mail/spam/
[INFO   ] (root.james.mailstore): added repository: 
file://var/mail/spam/MAIL->org.apache.james.mailrepository.AvalonMailRepository
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept() called
[DEBUG  ] (root.james.mailstore): Method accept(delay) called
[INFO   ] (root.james.smtp-server): SMTPServer init...
[INFO   ] (root.james.smtp-server): SMTPServer using plain on port 25 at 
null
[INFO   ] (root.james.smtp-server): SMTPServer ...init end
Started SMTP Server plain:25
[INFO   ] (root.james.remote): RemoteManager init...
[INFO   ] (root.james.remote): RemoteManager using plain on port 4555 at 
null
[INFO   ] (root.james.remote): RemoteManager ...init end

#
#  James server and related componets are not all running.  I go over to 
my mail clinet and send myself a message.
# and the following logg entries are generated.
#

[INFO   ] (root.james.smtp-server): Hello Name is: home
[INFO   ] (root.james.smtp-server): Connection from claudel.noos.net 
(212.198.2.83)
Retrieving from: C:\TEMP\Mail1029549462609-036148.m64
Saving to:       file://var/mail/spool//Mail1029549462609-0
Modified: false
[DEBUG  ] (root.james.mailstore): Mail Mail1029549462609-0 stored.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): accept() has locked: Mail1029549462609-0
[DEBUG  ] (root.james.mailstore): Retrieving mail: Mail1029549462609-0
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[ERROR  ] (root.james.mailstore): Exception retrieving mail: 
java.lang.RuntimeException: Exception caught while retrieving an object, 
cause:
 java.io.StreamCorruptedException: unexpected end of block data, so 
we're deleting it... good riddance!
java.lang.RuntimeException: Exception caught while retrieving an object, 
cause: java.io.StreamCorruptedException: unexpected end of block da
ta
        at 
org.apache.avalon.cornerstone.blocks.masterstore.File_Persistent_Object_Repository.get(File_Persistent_Object_Repository.java:66)

        at 
org.apache.james.mailrepository.AvalonMailRepository.retrieve(AvalonMailRepository.java:260)
        at 
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:268)
        at 
org.apache.avalon.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java:47)
        at 
org.apache.avalon.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:80)
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[INFO   ] (root.james.main): Mail Mail1029549462609-0 pushed in spool
[INFO   ] (root.james.smtp-server): Mail sent to Mail Server
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549462609-0 in spool.
[DEBUG  ] (root.james.mailstore): Method accept() called

#
# Any subsequent attempts to send a email to the server result in the 
same exception condition - StreamCorruptedException
# If I attempt to send a message to another account using the SMTP 
server I get the following:
#

[INFO   ] (root.james.smtp-server): Hello Name is: home
[INFO   ] (root.james.smtp-server): Connection from localhost (127.0.0.1)
Retrieving from: C:\TEMP\Mail1029549805531-136149.m64
Saving to:       file://var/mail/spool//Mail1029549805531-1
Modified: false
[DEBUG  ] (root.james.mailstore): Mail Mail1029549805531-1 stored.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): accept() has locked: Mail1029549805531-1
[DEBUG  ] (root.james.mailstore): Retrieving mail: Mail1029549805531-1
[ERROR  ] (root.james.mailstore): Exception retrieving mail: 
java.lang.RuntimeException: Exception caught while retrieving an object, 
cause:
 java.io.StreamCorruptedException: unexpected end of block data, so 
we're deleting it... good riddance!
java.lang.RuntimeException: Exception caught while retrieving an object, 
cause: java.io.StreamCorruptedException: unexpected end of block da
ta
        at 
org.apache.avalon.cornerstone.blocks.masterstore.File_Persistent_Object_Repository.get(File_Persistent_Object_Repository.java:66)

        at 
org.apache.james.mailrepository.AvalonMailRepository.retrieve(AvalonMailRepository.java:260)
        at 
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:268)
        at 
org.apache.avalon.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java:47)
        at 
org.apache.avalon.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:80)
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[INFO   ] (root.james.main): Mail Mail1029549805531-1 pushed in spool
[INFO   ] (root.james.smtp-server): Mail sent to Mail Server
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Found item Mail1029549805531-1 in spool.
[DEBUG  ] (root.james.mailstore): Method accept() called

#
# So as you can see - in both cases the File_Persistent_Object_Repository
# get( String ) method is throwing the StreamCorruptedException when
# attempting to read the stream based on the supplied key.
#

Cheers, Steve.

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: James under Merlin

Posted by "Noel J. Bergman" <no...@devtech.com>.
> What would be really great is if a James wiz could check out the 
> Merlin/James demo package I've put together and give me some
> feedback if the sort of things I'm seeing are resonable or not.

What are you seeing?

Personally, as I said, I only use the JDBC stores.

	--- Noel

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Stephen McConnell <mc...@apache.org>.

Noel J. Bergman wrote:

>Stephen,
>
>Glad that adding the "if (mail == null) continue;" solved the problem.  The
>other exception is likely due to the second thread trying to access the
>file, which of course it can't do.  I use JDBC stores, and haven't looked at
>the file system store code at all, but that'd be my guess. The code is
>probably handling the exception properly, under the circumstances.
>

What would be really great is if a James wiz could check out the 
Merlin/James demo package I've put together and give me some feedback if 
the sort of things I'm seeing are resonable or not.  If there reasonable 
then some work is needed in cleaning up error reporting - but my hunch 
is that something is actually broken inside the store system (but its 
only a hunch).

Cheers, Steve.

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: James under Merlin

Posted by "Noel J. Bergman" <no...@devtech.com>.
Stephen,

Glad that adding the "if (mail == null) continue;" solved the problem.  The
other exception is likely due to the second thread trying to access the
file, which of course it can't do.  I use JDBC stores, and haven't looked at
the file system store code at all, but that'd be my guess. The code is
probably handling the exception properly, under the circumstances.

	--- Noel


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Stephen McConnell <mc...@apache.org>.

Noel J. Bergman wrote:

>Steve,
>
>You're probably seeing the FAQ item.  Are you running the CVS HEAD?  
>

Yep.

>It
>should happen far less frequently with changes made recently to the code.
>Basically, an exception occurs because of a known race condition.  A thread
>picks up a mail item from the spool.  After it gets the item, it attempts to
>lock the item.  If another thread has it locked, then the second thread will
>give up and go back for another item.  However, there is a window where one
>thread can pickup an item from the spool, and between when it gets the spool
>item and when it attempts to lock it, the thread that actually owns the
>spool item removes it from the spool and unlocks it.  So the second thread
>finds that it is able to lock it, but when it goes to get it, the item is
>gone.
>
>The code:
>
>                String key = spool.accept();
>                MailImpl mail = spool.retrieve(key);
>                if (infoEnabled) {
>
>should be changed to:
>
>                String key = spool.accept();
>                MailImpl mail = spool.retrieve(key);
>                if (mail == null) continue;
>                if (infoEnabled) {
>
>since we know that spool.retrieve(key) can return null.  Try patching your
>copy of the code, and see if that doesn't fix it.
>

Thanks!
Patched the code locally and the NPE dissapears.
However, the mailstore exception remains - here is an extract of the 
trace together with some additional comments in-line:

  [INFO   ] (root.james.smtp-server): Hello Name is: home
  [DEBUG  ] (root.james.smtp-server): Max message size is: 0
  [INFO   ] (root.james.smtp-server): Connection from racine.noos.net 
(212.198.2.71)
  [DEBUG  ] (root.james.smtp-server): Sent: 220 home SMTP Server (JAMES 
SMTP Server 2.1a1-cvs) ready Fri, 16 Aug 2002 09:34:06 +0200 (CEST)
  [DEBUG  ] (root.james.smtp-server): Command received: EHLO smtp.noos.fr
  [DEBUG  ] (root.james.smtp-server): Sent: 250 home Hello smtp.noos.fr 
(racine.noos.net [212.198.2.71])
  [DEBUG  ] (root.james.smtp-server): Command received: MAIL 
FROM:<mc...@apache.org>
  [DEBUG  ] (root.james.smtp-server): Sent: 250 Sender 
<mc...@apache.org> OK
  [DEBUG  ] (root.james.smtp-server): Command received: RCPT 
TO:<mc...@home.osm.net>
  [DEBUG  ] (root.james.smtp-server): Sent: 250 Recipient 
<mc...@home.osm.net> OK
  [DEBUG  ] (root.james.smtp-server): Command received: DATA
  [DEBUG  ] (root.james.smtp-server): Sent: 354 Ok Send data ending with 
<CRLF>.<CRLF>
Retrieving from: C:\TEMP\Mail1029483246359-056372.m64
Saving to:       file://var/mail/spool//Mail1029483246359-0
Modified: false
  [DEBUG  ] (root.james.mailstore): Mail Mail1029483246359-0 stored.
  [INFO   ] (root.james.james): Mail Mail1029483246359-0 pushed in spool
  [INFO   ] (root.james.smtp-server): Mail sent to Mail Server
  [DEBUG  ] (root.james.smtp-server): Sent: 250 Message received
  [DEBUG  ] (root.james.smtp-server): Command received: QUIT
  [DEBUG  ] (root.james.smtp-server): Sent: 221 home Service closing 
transmission channel
  [DEBUG  ] (root.james.smtp-server): Closing socket.
  [DEBUG  ] (root.james.mailstore): Retrieving mail: Mail1029483246359-0

The following error is occuring inside the 
File_Persistent_Object_Repository class, get( String key ) method.  I'm 
using the cornerstone version from the Avalon Excalibur CVS, but I 
noticed that there is a excalibur-datasource-1.0.jar in the James lib 
directory which contains classes that also exist in cornerstone.jar. 
 The setup I have is ignoring the excalibur-datasource-1.0.jar - is this 
likely to be a problem?

Steve.


  [ERROR  ] (root.james.mailstore): Exception retrieving mail: 
java.lang.RuntimeException: Exception caught while retrieving an object, 
cause:
 java.io.StreamCorruptedException: unexpected end of block data, so 
we're deleting it... good riddance!
java.lang.RuntimeException: Exception caught while retrieving an object, 
cause: java.io.StreamCorruptedException: unexpected end of block da
ta
        at 
org.apache.avalon.cornerstone.blocks.masterstore.File_Persistent_Object_Repository.get(File_Persistent_Object_Repository.java:68)

        at 
org.apache.james.mailrepository.AvalonMailRepository.retrieve(AvalonMailRepository.java:260)
        at 
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:268)
        at 
org.apache.avalon.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java:47)
        at 
org.apache.avalon.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:80)





>
>	--- Noel
>
>-----Original Message-----
>From: Stephen McConnell [mailto:mcconnell@apache.org]
>Sent: Friday, August 16, 2002 2:15
>To: James Developers List
>Subject: Re: James under Merlin
>
>
>
>
>In JamesSpoolManager, run method:
>
>                MailImpl mail = spool.retrieve(key);
>
>The mail variable is is the source of the NPE.
>
>Steve.
>
>
>Stephen McConnell wrote:
>
>
>>
>>Paul Hammant wrote:
>>
>>
>>>Stephen,
>>>
>>>
>>>>I've been playing around with James under Merlin.
>>>>
>>>>During the process I came accross a runtime problem:
>>>>
>>>> 1. The class AvalonUsersStore is referenced as a Component
>>>>    somewhere or other but doesn't implement the Component
>>>>    interface
>>>>
>>>
>>>
>>>Err should be able to fix that one.
>>>
>>
>>
>>It rather easy!
>>
>>
>>>
>>>> 2. After starting James inside Merlin, then sending an email
>>>>    to an arbitary name on the server James is running on,
>>>>    I get NPE - which is where I figure I may need some help
>>>>    from you guys ...
>>>>
>>>
>>>
>>>This is where we wich we could unit test each comp.
>>>
>>
>>
>>Something to keep in mind is that I'm using the CVS version of
>>cornerstone components.  I had to do a number of updates to
>>cornerstone including
>>
>> (a) addition of the Component interface to soem of the blocks
>>     becuase they are used in James - so adding Component is
>>     basically a backward compatibility thing
>>
>> (b) addition of some meta-info into a couple of the blocks so
>>     that Merlin can automatically build the services without
>>     having Phoenix around
>>
>>Apart from the above, the only differences are that I'm using a few
>>more excalibur jar files that are not included in the James lib
>>(because they are included in Phoenix and not in Merlin) and
>>naturally, this bypasses all of the Phoenix config, assembly, and
>>server files.
>>
>>
>>>A guy at BP has written a generic AbstractPhoenixTestCase (where
>>>Phoenix is mocked).  I'll get him to write it up and someone might do
>>>the same thing inside Phoenix CVS or maybe Merlin CVS ? :-)
>>>
>>
>>
>>I'll put in place a Merlin projects directory containing the James
>>content and update the CVS.
>>
>>
>>>Failing that we'll have to do good old fashioned debugging.  Question
>>>do you use IntelliJ ?  Have you got interactive debuging working with
>>>Phoenix?
>>>
>>
>>
>>No on both points!
>>In the meantime I'll start tracking it down.
>>
>>Cheers, Steve.
>>
>>
>>
>>>
>>>- Paul
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org>
>>>For additional commands, e-mail:
>>><ma...@jakarta.apache.org>
>>>
>
>--
>
>Stephen J. McConnell
>
>OSM SARL
>digital products for a global economy
>mailto:mcconnell@osm.net
>http://www.osm.net
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: James under Merlin

Posted by "Noel J. Bergman" <no...@devtech.com>.
Steve,

You're probably seeing the FAQ item.  Are you running the CVS HEAD?  It
should happen far less frequently with changes made recently to the code.
Basically, an exception occurs because of a known race condition.  A thread
picks up a mail item from the spool.  After it gets the item, it attempts to
lock the item.  If another thread has it locked, then the second thread will
give up and go back for another item.  However, there is a window where one
thread can pickup an item from the spool, and between when it gets the spool
item and when it attempts to lock it, the thread that actually owns the
spool item removes it from the spool and unlocks it.  So the second thread
finds that it is able to lock it, but when it goes to get it, the item is
gone.

The code:

                String key = spool.accept();
                MailImpl mail = spool.retrieve(key);
                if (infoEnabled) {

should be changed to:

                String key = spool.accept();
                MailImpl mail = spool.retrieve(key);
                if (mail == null) continue;
                if (infoEnabled) {

since we know that spool.retrieve(key) can return null.  Try patching your
copy of the code, and see if that doesn't fix it.

	--- Noel

-----Original Message-----
From: Stephen McConnell [mailto:mcconnell@apache.org]
Sent: Friday, August 16, 2002 2:15
To: James Developers List
Subject: Re: James under Merlin




In JamesSpoolManager, run method:

                MailImpl mail = spool.retrieve(key);

The mail variable is is the source of the NPE.

Steve.


Stephen McConnell wrote:

>
>
> Paul Hammant wrote:
>
>> Stephen,
>>
>>> I've been playing around with James under Merlin.
>>>
>>> During the process I came accross a runtime problem:
>>>
>>>  1. The class AvalonUsersStore is referenced as a Component
>>>     somewhere or other but doesn't implement the Component
>>>     interface
>>
>>
>>
>> Err should be able to fix that one.
>
>
>
> It rather easy!
>
>>
>>
>>>  2. After starting James inside Merlin, then sending an email
>>>     to an arbitary name on the server James is running on,
>>>     I get NPE - which is where I figure I may need some help
>>>     from you guys ...
>>
>>
>>
>> This is where we wich we could unit test each comp.
>
>
>
> Something to keep in mind is that I'm using the CVS version of
> cornerstone components.  I had to do a number of updates to
> cornerstone including
>
>  (a) addition of the Component interface to soem of the blocks
>      becuase they are used in James - so adding Component is
>      basically a backward compatibility thing
>
>  (b) addition of some meta-info into a couple of the blocks so
>      that Merlin can automatically build the services without
>      having Phoenix around
>
> Apart from the above, the only differences are that I'm using a few
> more excalibur jar files that are not included in the James lib
> (because they are included in Phoenix and not in Merlin) and
> naturally, this bypasses all of the Phoenix config, assembly, and
> server files.
>
>>
>> A guy at BP has written a generic AbstractPhoenixTestCase (where
>> Phoenix is mocked).  I'll get him to write it up and someone might do
>> the same thing inside Phoenix CVS or maybe Merlin CVS ? :-)
>
>
>
> I'll put in place a Merlin projects directory containing the James
> content and update the CVS.
>
>>
>> Failing that we'll have to do good old fashioned debugging.  Question
>> do you use IntelliJ ?  Have you got interactive debuging working with
>> Phoenix?
>
>
>
> No on both points!
> In the meantime I'll start tracking it down.
>
> Cheers, Steve.
>
>
>>
>>
>> - Paul
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>

--

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Stephen McConnell <mc...@apache.org>.

In JamesSpoolManager, run method:

                MailImpl mail = spool.retrieve(key);

The mail variable is is the source of the NPE.

Steve.


Stephen McConnell wrote:

>
>
> Paul Hammant wrote:
>
>> Stephen,
>>
>>> I've been playing around with James under Merlin.
>>>
>>> During the process I came accross a runtime problem:
>>>
>>>  1. The class AvalonUsersStore is referenced as a Component
>>>     somewhere or other but doesn't implement the Component
>>>     interface
>>
>>
>>
>> Err should be able to fix that one. 
>
>
>
> It rather easy!
>
>>
>>
>>>  2. After starting James inside Merlin, then sending an email
>>>     to an arbitary name on the server James is running on,
>>>     I get NPE - which is where I figure I may need some help
>>>     from you guys ...
>>
>>
>>
>> This is where we wich we could unit test each comp. 
>
>
>
> Something to keep in mind is that I'm using the CVS version of 
> cornerstone components.  I had to do a number of updates to 
> cornerstone including
>
>  (a) addition of the Component interface to soem of the blocks
>      becuase they are used in James - so adding Component is
>      basically a backward compatibility thing
>
>  (b) addition of some meta-info into a couple of the blocks so
>      that Merlin can automatically build the services without
>      having Phoenix around
>
> Apart from the above, the only differences are that I'm using a few 
> more excalibur jar files that are not included in the James lib 
> (because they are included in Phoenix and not in Merlin) and 
> naturally, this bypasses all of the Phoenix config, assembly, and 
> server files.
>
>>
>> A guy at BP has written a generic AbstractPhoenixTestCase (where 
>> Phoenix is mocked).  I'll get him to write it up and someone might do 
>> the same thing inside Phoenix CVS or maybe Merlin CVS ? :-)
>
>
>
> I'll put in place a Merlin projects directory containing the James 
> content and update the CVS.
>
>>
>> Failing that we'll have to do good old fashioned debugging.  Question 
>> do you use IntelliJ ?  Have you got interactive debuging working with 
>> Phoenix? 
>
>
>
> No on both points!
> In the meantime I'll start tracking it down.
>
> Cheers, Steve.
>
>
>>
>>
>> - Paul
>>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>
>

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Stephen McConnell <mc...@apache.org>.

Paul Hammant wrote:

> Stephen,
>
>> I've been playing around with James under Merlin.
>>
>> During the process I came accross a runtime problem:
>>
>>  1. The class AvalonUsersStore is referenced as a Component
>>     somewhere or other but doesn't implement the Component
>>     interface
>
>
> Err should be able to fix that one. 


It rather easy!

>
>
>>  2. After starting James inside Merlin, then sending an email
>>     to an arbitary name on the server James is running on,
>>     I get NPE - which is where I figure I may need some help
>>     from you guys ...
>
>
> This is where we wich we could unit test each comp. 


Something to keep in mind is that I'm using the CVS version of 
cornerstone components.  I had to do a number of updates to cornerstone 
including

  (a) addition of the Component interface to soem of the blocks
      becuase they are used in James - so adding Component is
      basically a backward compatibility thing

  (b) addition of some meta-info into a couple of the blocks so
      that Merlin can automatically build the services without
      having Phoenix around

Apart from the above, the only differences are that I'm using a few more 
excalibur jar files that are not included in the James lib (because they 
are included in Phoenix and not in Merlin) and naturally, this bypasses 
all of the Phoenix config, assembly, and server files.

>
> A guy at BP has written a generic AbstractPhoenixTestCase (where 
> Phoenix is mocked).  I'll get him to write it up and someone might do 
> the same thing inside Phoenix CVS or maybe Merlin CVS ? :-)


I'll put in place a Merlin projects directory containing the James 
content and update the CVS.

>
> Failing that we'll have to do good old fashioned debugging.  Question 
> do you use IntelliJ ?  Have you got interactive debuging working with 
> Phoenix? 


No on both points!
In the meantime I'll start tracking it down.

Cheers, Steve.


>
>
> - Paul
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: James under Merlin

Posted by Paul Hammant <Pa...@yahoo.com>.
Stephen,

> I've been playing around with James under Merlin.
>
> During the process I came accross a runtime problem:
>
>  1. The class AvalonUsersStore is referenced as a Component
>     somewhere or other but doesn't implement the Component
>     interface

Err should be able to fix that one.

>  2. After starting James inside Merlin, then sending an email
>     to an arbitary name on the server James is running on,
>     I get NPE - which is where I figure I may need some help
>     from you guys ...

This is where we wich we could unit test each comp.

A guy at BP has written a generic AbstractPhoenixTestCase (where Phoenix 
is mocked).  I'll get him to write it up and someone might do the same 
thing inside Phoenix CVS or maybe Merlin CVS ? :-)

Failing that we'll have to do good old fashioned debugging.  Question do 
you use IntelliJ ?  Have you got interactive debuging working with Phoenix?

- Paul


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>