james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amichai Rothman (JIRA)" <server-...@james.apache.org>
Subject [jira] Created: (JAMES-900) NullPointerException during local delivery spooling
Date Sat, 25 Apr 2009 18:51:30 GMT
NullPointerException during local delivery spooling
---------------------------------------------------

                 Key: JAMES-900
                 URL: https://issues.apache.org/jira/browse/JAMES-900
             Project: JAMES Server
          Issue Type: Bug
          Components: SpoolManager & Processors
    Affects Versions: 2.3.1
         Environment: Windows XP, Sun JDK 1.6.0_12, MySQL 5.0 backend
            Reporter: Amichai Rothman


The exception below occurs 1-2 times a day on a server handling between a few hundred and
a few thousands of messages per day.

I took a short look at the code, and it looks like there's a MimeMessageCopyOnWriteProxy wrapping
a null message. A few possible causes:

- MessageReferenceTracker.getWrapped() should be synchronized, as the field is neither final
nor volatile and so it's possible that a thread other than the one which creates it will see
a null wrapped message.
- the refCount field is not properly synchronized nor volatile so methods which set/replace
its value (private constructor, getWrappedMessageForWriting) may cause some threads to see
the new instance and some the old one. this can result in buggy reference counting, which
can result in the wrapped message being set to null (when reference count is decreased too
much) and then being accessed.
- a MailImpl is being constructed (or copy-constructed) somewhere with a null message (which
is passed on to the proxy class).
- something completely different.


The stacktrace from spoolmanager log:

25/04/09 02:00:58 ERROR spoolmanager.transport: Exception calling LocalDelivery: Exception
spooling message: Exception caught while storing mail Container: 
javax.mail.MessagingException: Exception spooling message: Exception caught while storing
mail Container: ;
  nested exception is:
	javax.mail.MessagingException: Exception caught while storing mail Container: ;
  nested exception is:
	java.lang.NullPointerException
	at org.apache.james.James.sendMail(James.java:501)
	at org.apache.james.James.sendMail(James.java:454)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134)
	at $Proxy9.sendMail(Unknown Source)
	at org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:183)
	at org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:66)
	at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424)
	at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405)
	at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.mail.MessagingException: Exception caught while storing mail Container: ;
  nested exception is:
	java.lang.NullPointerException
	at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:764)
	at org.apache.james.mailrepository.JDBCSpoolRepository.store(JDBCSpoolRepository.java:240)
	at org.apache.james.mailrepository.MailStoreSpoolRepository.store(MailStoreSpoolRepository.java:126)
	at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134)
	at $Proxy5.store(Unknown Source)
	at org.apache.james.James.sendMail(James.java:493)
	... 13 more
Caused by: java.lang.NullPointerException
	at org.apache.james.core.MimeMessageUtil.calculateMessageSize(MimeMessageUtil.java:277)
	at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:261)
	at org.apache.james.core.MimeMessageCopyOnWriteProxy.getMessageSize(MimeMessageCopyOnWriteProxy.java:745)
	at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:257)
	at org.apache.james.core.MailImpl.getMessageSize(MailImpl.java:372)
	at org.apache.james.mailrepository.MessageInputStream.<init>(MessageInputStream.java:53)
	at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:718)
	... 21 more
javax.mail.MessagingException: Exception caught while storing mail Container: ;
  nested exception is:
	java.lang.NullPointerException
	at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:764)
	at org.apache.james.mailrepository.JDBCSpoolRepository.store(JDBCSpoolRepository.java:240)
	at org.apache.james.mailrepository.MailStoreSpoolRepository.store(MailStoreSpoolRepository.java:126)
	at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134)
	at $Proxy5.store(Unknown Source)
	at org.apache.james.James.sendMail(James.java:493)
	at org.apache.james.James.sendMail(James.java:454)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134)
	at $Proxy9.sendMail(Unknown Source)
	at org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:183)
	at org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:66)
	at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424)
	at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405)
	at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
	at org.apache.james.core.MimeMessageUtil.calculateMessageSize(MimeMessageUtil.java:277)
	at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:261)
	at org.apache.james.core.MimeMessageCopyOnWriteProxy.getMessageSize(MimeMessageCopyOnWriteProxy.java:745)
	at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:257)
	at org.apache.james.core.MailImpl.getMessageSize(MailImpl.java:372)
	at org.apache.james.mailrepository.MessageInputStream.<init>(MessageInputStream.java:53)
	at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:718)
	... 21 more
java.lang.NullPointerException
	at org.apache.james.core.MimeMessageUtil.calculateMessageSize(MimeMessageUtil.java:277)
	at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:261)
	at org.apache.james.core.MimeMessageCopyOnWriteProxy.getMessageSize(MimeMessageCopyOnWriteProxy.java:745)
	at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:257)
	at org.apache.james.core.MailImpl.getMessageSize(MailImpl.java:372)
	at org.apache.james.mailrepository.MessageInputStream.<init>(MessageInputStream.java:53)
	at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:718)
	at org.apache.james.mailrepository.JDBCSpoolRepository.store(JDBCSpoolRepository.java:240)
	at org.apache.james.mailrepository.MailStoreSpoolRepository.store(MailStoreSpoolRepository.java:126)
	at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134)
	at $Proxy5.store(Unknown Source)
	at org.apache.james.James.sendMail(James.java:493)
	at org.apache.james.James.sendMail(James.java:454)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134)
	at $Proxy9.sendMail(Unknown Source)
	at org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:183)
	at org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:66)
	at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424)
	at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405)
	at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309)
	at java.lang.Thread.run(Unknown Source)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message