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 "Michael Herrmann (Issue Comment Edited) (JIRA)" <se...@james.apache.org> on 2011/10/03 14:54:34 UTC

[jira] [Issue Comment Edited] (JAMES-1317) Mail spooled but not processed

    [ https://issues.apache.org/jira/browse/JAMES-1317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119271#comment-13119271 ] 

Michael Herrmann edited comment on JAMES-1317 at 10/3/11 12:53 PM:
-------------------------------------------------------------------

The problem also occurs in the latest snapshot release of 3.0-beta4, revision 1177179. 

Maybe a little code will help. I have one non-standard mailet, AliasingMailet, in mailetcontainer.xml:

...
<processor state="transport" enableJmx="true">
      <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
        <name>X-UserIsAuth</name>
        <value>true</value>
      </mailet>
      <mailet match="All" class="our.company.AliasingMailet"/>
...

Here is its service() method:

public void service(Mail mail) throws MessagingException {
	MailAddress from = new MailAddress((InternetAddress) mail.getMessage().getFrom()[0]);
	MailAddress to = new MailAddress((InternetAddress) mail.getMessage().getRecipients(Message.RecipientType.TO)[0]);
	if (to.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
		Conversation conversation = conversationService.getConversation(mail);

		InternetAddress[] recipients = conversation.getAliasB().getRecipients();
		logger.info("Rewriting recipients of mail " + mail.getMessage().getSubject() + " to " + Arrays.asList(recipients));
		mail.getMessage().setRecipients(Message.RecipientType.TO, recipients);

		String newFrom = conversation.getAliasA() + "@" + mailserverConfiguration.getDefaultDomain();
		logger.info("Rewriting sender of mail " + mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
		mail.getMessage().setFrom(new InternetAddress(newFrom));

		getMailetContext().sendMail(mail.getMessage());
		mail.setState(Mail.GHOST);
	} else if (!from.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
		String newFrom = conversationService.getConversation(mail).getAliasA().toString() + "@" + mailserverConfiguration.getDefaultDomain();
		logger.info("Rewriting sender of mail " + mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
		mail.getMessage().setFrom(new InternetAddress(newFrom));
	}
}

The Spring bean conversationService is autowired and uses James's JPA-infrastructure to persist/load Conversations. The problem occurs (stochastically) when I bombard the server with 50 concurrent SMTP-requests. 

We want to use James to handle email conversations of all users of our portal for classified ads and expect about 1.500.000 mails/month. If this problem cannot be solved we will have to downgrade to version 2.3.2...

If it helps, I can provide you with the (little) source code and JUnit tests that can be used to reproduce the problem. Having an automated build is very important to us so we wrote a little Maven plugin that can be used to start James. I could send you the code for the plugin as well as our project. All you would then have to do is to do mvn install for the Maven plugin and then mvn verify for our project, which then uses the installed plugin to start the server and run the failing integration tests. 
                
      was (Author: mherrmann):
    The problem also occurs in the latest snapshot release of 3.0-beta4, revision 1177179. 

Maybe a little code will help. I have one non-standard mailet, AliasingMailet, in mailetcontainer.xml:

...
<processor state="transport" enableJmx="true">
      <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
        <name>X-UserIsAuth</name>
        <value>true</value>
      </mailet>
      <mailet match="All" class="our.company.AliasingMailet"/>
...

Here is its service() method:

public void service(Mail mail) throws MessagingException {
	MailAddress from = new MailAddress((InternetAddress) mail.getMessage().getFrom()[0]);
	MailAddress to = new MailAddress((InternetAddress) mail.getMessage().getRecipients(Message.RecipientType.TO)[0]);
	if (to.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
		Conversation conversation = conversationService.getConversation(mail);

		InternetAddress[] recipients = conversation.getAliasB().getRecipients();
		logger.info("Rewriting recipients of mail " + mail.getMessage().getSubject() + " to " + Arrays.asList(recipients));
		mail.getMessage().setRecipients(Message.RecipientType.TO, recipients);

		String newFrom = conversation.getAliasA() + "@" + mailserverConfiguration.getDefaultDomain();
		logger.info("Rewriting sender of mail " + mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
		mail.getMessage().setFrom(new InternetAddress(newFrom));

		getMailetContext().sendMail(mail.getMessage());
		mail.setState(Mail.GHOST);
	} else if (!from.getDomain().equals(mailserverConfiguration.getDefaultDomain())) {
		String newFrom = conversationService.getConversation(mail).getAliasA().toString() + "@" + mailserverConfiguration.getDefaultDomain();
		logger.info("Rewriting sender of mail " + mail.getMessage().getSubject() + " from " + from + " to " + newFrom + ".");
		mail.getMessage().setFrom(new InternetAddress(newFrom));
	}
}

The Spring bean conversationService is autowired and uses James's JPA-infrastructure to persist/load Conversations. The problem occurs (stochastically) when I bombard the server with 50 concurrent SMTP-requests. 

We want to use James to handle email conversations of all users of our portal for classified ads and expect about 1.500.000 mails/month. If this problem cannot be solved we will have to downgrade to version 2.3.2 :(
                  
> Mail spooled but not processed
> ------------------------------
>
>                 Key: JAMES-1317
>                 URL: https://issues.apache.org/jira/browse/JAMES-1317
>             Project: JAMES Server
>          Issue Type: Bug
>          Components: SpoolManager & Processors
>    Affects Versions: 3.0-M1, 3.0-M2, 3.0-beta3
>            Reporter: Raju Buchi
>            Priority: Critical
>             Fix For: 3.0-beta4
>
>         Attachments: Dump.txt, jstack.zip
>
>
> Mails sent to James server are spooled but they are not processed and sent out.
> The issue is similar to the one faced by Zach.
> The server seems to be working fine for a few hours or few days, but some time all the mails are spooled but they will not be processed and sent out. Restarted the server several times and some time a few of the mails will be processed and all the others are lost.
> As Norman suggested I have took a jstack trace. 
> Please let me how we can resolve this issue
> Thanks
> - Raju

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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