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 Anagha Mudigonda <an...@gmail.com> on 2005/08/22 13:50:31 UTC

[PATCH] James Fastfail

Stefano,

Attached the patch that has following changes


- Now SMTPhandler implements SMTPSession interface. Remove the inner
class implementation
- Removed unecessary interfaces from SMTPSession interface
- Made changes to SMTPHandlerChain that doenot allow the server to
start if there are no commandHandlers registered or if there are
commandHandlers for mandatory commands : MAIL, RCPT and DATA.


Re: [PATCH] James Fastfail

Posted by Stefano Bagnara <ap...@bago.org>.
> > - Now SMTPhandler implements SMTPSession interface. Remove 
> the inner 
> > class implementation
> > - Removed unecessary interfaces from SMTPSession interface
> > - Made changes to SMTPHandlerChain that doenot allow the server to 
> > start if there are no commandHandlers registered or if there are 
> > commandHandlers for mandatory commands : MAIL, RCPT and DATA.
> Are there any test cases to ensure that now it's really 'fast' ?
> At least some reproductive measurement procedures?

AFAIK no,
AFAIK there are no tools to test the SMTP protocol.
Stefano


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


Re: [PATCH] James Fastfail

Posted by Klaus Dornfelder <kd...@yahoo.com>.
> Attached the patch that has following changes
> 
> 
> - Now SMTPhandler implements SMTPSession interface. Remove the inner
> class implementation
> - Removed unecessary interfaces from SMTPSession interface
> - Made changes to SMTPHandlerChain that doenot allow the server to
> start if there are no commandHandlers registered or if there are
> commandHandlers for mandatory commands : MAIL, RCPT and DATA.
Are there any test cases to ensure that now it's really 'fast' ?
At least some reproductive measurement procedures?

Thanks,

Klaus.


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


Re: [PATCH] James Fastfail

Posted by Anagha Mudigonda <an...@gmail.com>.
Updated the JIRA 
http://issues.apache.org/jira/secure/attachment/12311884/Aug22JamesFastFail.patch

--anagha

On 8/22/05, Anagha Mudigonda <an...@gmail.com> wrote:
> Stefano,
> 
> Attached the patch that has following changes
> 
> 
> - Now SMTPhandler implements SMTPSession interface. Remove the inner
> class implementation
> - Removed unecessary interfaces from SMTPSession interface
> - Made changes to SMTPHandlerChain that doenot allow the server to
> start if there are no commandHandlers registered or if there are
> commandHandlers for mandatory commands : MAIL, RCPT and DATA.
> 
> 
>

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


Re: James Fastfail

Posted by Anagha Mudigonda <an...@gmail.com>.
thank you:)
 Should I migrate these keys to new message and session scope maps and 
remove *OLD* state hashmap??

// Keys used to store/lookup data in the internal state hash map
private final static String CURRENT_HELO_MODE = "CURRENT_HELO_MODE"; // HELO 
or EHLO
private final static String SENDER = "SENDER_ADDRESS"; // Sender's email 
address
private final static String MESG_FAILED = "MESG_FAILED"; // Message failed 
flag
private final static String MESG_SIZE = "MESG_SIZE"; // The size of the 
message
private final static String RCPT_LIST = "RCPT_LIST"; // The message 
recipients
  --Anagha
     --Anagha


On 8/30/05, Stefano Bagnara <ap...@bago.org> wrote: 
> 
> > sorry I sent a wrong version that didnot compile It should
> > be session.getState().get(MESG_FAILED) as the existing Keys
> > MESG_FAILED, SENDER and so on would continue to use the state
> > variable in the SMTPHandler.
> > -- Anagha
> 
> Fixed, thank you again,
> Stefano
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
>

Re: James Fastfail

Posted by Stefano Bagnara <ap...@bago.org>.
> sorry I sent a wrong version that didnot compile  It should 
> be session.getState().get(MESG_FAILED) as the existing Keys 
> MESG_FAILED, SENDER and so on would continue to use the state 
> variable in the SMTPHandler.
>  -- Anagha

Fixed, thank you again,
Stefano


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


Re: James Fastfail

Posted by Anagha Mudigonda <an...@gmail.com>.
sorry I sent a wrong version that didnot compile
 It should be session.getState().get(MESG_FAILED) as the existing Keys 
MESG_FAILED, SENDER and so on would continue to use the state variable in 
the SMTPHandler.
 -- Anagha
     

 On 8/30/05, Stefano Bagnara <ap...@bago.org> wrote: 
> 
> > Stefano,
> >
> > I am still working on 2 and 3. I thought I could release one
> > patch with the following changes
> >
> > 1. UnknownCommandHandler.java
> > a) Added
> > //If there was message failure, don't consider it as
> > an unknown command
> > if (state.get(MESG_FAILED) != null) {
> > return;
> > }
> 
> Hi Anagha,
> 
> I had to modify it in:
> if (session.getMessageState().get(MESG_FAILED) != null) {
> 
> "state" was not a local field/variable.
> 
> Just applied the patch, thank you :-)
> 
> Stefano
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
>

Re: James Fastfail

Posted by Stefano Bagnara <ap...@bago.org>.
> Stefano,
> 
> I am still working on 2 and 3. I thought I could release one 
> patch with the following changes
> 
> 1. UnknownCommandHandler.java
> a) Added
>         //If there was message failure, don't consider it as 
> an unknown command
>         if (state.get(MESG_FAILED) != null) {
>             return;
>         }

Hi Anagha,

I had to modify it in:
if (session.getMessageState().get(MESG_FAILED) != null) {

"state" was not a local field/variable.

Just applied the patch, thank you :-)

Stefano


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


Re: James Fastfail

Posted by Anagha Mudigonda <an...@gmail.com>.
Stefano,

I am still working on 2 and 3. I thought I could release one patch with the 
following changes

1. UnknownCommandHandler.java
a) Added
        //If there was message failure, don't consider it as an unknown command
        if (state.get(MESG_FAILED) != null) {
            return;
        }
b) Modified the message format to
500 5.5.1 Command <commandName> unrecognized.

2.  Since the Handlers cannot store state internally.  The SMTPSession exposes
Message scope and session scope hashmaps to store state information.
The Message Scope HashMap will be cleared when the message sent or
aborted
The Session Scope HashMap will be cleared after the session ends

--Anagha

On 8/25/05, Stefano Bagnara <ap...@bago.org> wrote:
> > > If you like any of this ideas I can help you identifying james 
> > > services you need and how to use Avalon lifecycle 
> > interfaces to gain 
> > > access to the user db or to the repositories.
> > 
> > I like all of them. To begin with I will work on these
> > 1. 
> > MAILHandler that allow to specify banned from addresses.
> 
> You don't need interfaces for this, just local configurations.
> You can look at the SenderIsRegex.java code that should be similar.
> 
> > 2. RCPTHandler that check the user inbox quota and reply an 
> > error when overquota.
> 
> AbstractStorageQuota.java does similar things.
> You probably need to lookup UsersStore and MailServer roles.
> You can do this by adding the Serviceable interface to the involved handler
> and adding ContainerUtil code to propagate the services in the
> handlerchain.
> Smtpserver already have the 2 services described (UsersStore and
> MailServer).
> You already do "ContainerUtil.configure(handler,children[i]);" in the
> SMTPhandlerChain. You just need to add ContainerUtil.service,
> ContainerUtil.initialize or any other needed lifecycle method.
> 
> > 3. A ConnectHandler that would check how many messages are in 
> > the main spool and reply a "too busy, retry later" code 
> > instead of accepting the connection.
> 
> This is more difficult by now, I'm not sure it's even feasible by now.
> 
> Currently the smtpserver does not have links to the main spool.
> You can do this but it will be harder:
> 
> Change the SMTPServer.xinfo adding the spool dependency:
> <dependency>
>   <service name="org.apache.james.services.SpoolRepository" version="1.0"/>
> </dependency> 
> 
> Change the james-assembly.xml filling the dependecy in the <block
> name="smtpserver" .. /> block.
> This is the line to add dependency on the main spoolrepository.
> <provide name="spoolrepository"
> role="org.apache.james.services.SpoolRepository"/>
> 
> After that you can do the service lookup in the SMTPServer.service method
> adding the:
> spoolrepository = (SpoolRepository)
> manager.lookup("org.apache.james.services.SpoolRepository");
> 
> The main problem now is that the spoolrepository does not provide
> statistics
> about its content and we cannot retrieve the full queue to count the items
> because it would be a performance bottleneck!
> Reminder: We probably should add statistics to the next version of
> MailRepository/SpoolRepository APIs.
> 
> > Help me with the interfaces I need to know to implement the above.
> > 
> > --anagha
> 
> Stefano
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
>

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


Re: [PATCH] James Fastfail

Posted by Stefano Bagnara <ap...@bago.org>.
> > If you like any of this ideas I can help you identifying james 
> > services you need and how to use Avalon lifecycle 
> interfaces to gain 
> > access to the user db or to the repositories.
> 
> I like all of them. To begin with I will work on these
> 1. 
> MAILHandler that allow to specify banned from addresses.

You don't need interfaces for this, just local configurations.
You can look at the SenderIsRegex.java code that should be similar.

> 2. RCPTHandler that check the user inbox quota and reply an 
> error when overquota.

AbstractStorageQuota.java does similar things.
You probably need to lookup UsersStore and MailServer roles.
You can do this by adding the Serviceable interface to the involved handler
and adding ContainerUtil code to propagate the services in the handlerchain.
Smtpserver already have the 2 services described (UsersStore and
MailServer).
You already do "ContainerUtil.configure(handler,children[i]);" in the
SMTPhandlerChain. You just need to add ContainerUtil.service,
ContainerUtil.initialize or any other needed lifecycle method.

> 3. A ConnectHandler that would check how many messages are in 
> the main spool and reply a "too busy, retry later" code 
> instead of accepting the connection.

This is more difficult by now, I'm not sure it's even feasible by now.

Currently the smtpserver does not have links to the main spool.
You can do this but it will be harder:

Change the SMTPServer.xinfo adding the spool dependency:
<dependency>
  <service name="org.apache.james.services.SpoolRepository" version="1.0"/>
</dependency> 

Change the james-assembly.xml filling the dependecy in the <block
name="smtpserver" .. /> block.
This is the line to add dependency on the main spoolrepository.
<provide name="spoolrepository"
role="org.apache.james.services.SpoolRepository"/>

After that you can do the service lookup in the SMTPServer.service method
adding the:
spoolrepository = (SpoolRepository)
manager.lookup("org.apache.james.services.SpoolRepository");

The main problem now is that the spoolrepository does not provide statistics
about its content and we cannot retrieve the full queue to count the items
because it would be a performance bottleneck!
Reminder: We probably should add statistics to the next version of
MailRepository/SpoolRepository APIs.

> Help me with the interfaces I need to know to implement the above.
> 
> --anagha

Stefano


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


Re: [PATCH] James Fastfail

Posted by Anagha Mudigonda <an...@gmail.com>.
On 8/25/05, Stefano Bagnara <ap...@bago.org> wrote:
> IMHO any effort to be able to use Mathers/Mailets or even full processors
> from the MessageHandlers would be useful.
> 
> > Do you want me to work on something specific for my next release?
> 
> We could change the default "command unknown" to:
> 
> 500 5.5.1 Command "COMMANDUSED" unrecognized.
> 5.5.1 is DSNStatus.PERMANENT+"."+DSNStatus.DELIVERY_INVALID_CMD
> 
done

> And here is a few ideas on features related to the new inprotocol command
> handlers:
> 
> - add a few commented out sample in the james-config.xml: e.g. Bayesian
> filter in the MessageHandler.
> 
> - I would love to see a configurable RCPTHandler that will let us to
> configure regexps against recipients we allow for relay (not based on local
> domains but on configuration).
> 
> - I would also like a confirugable MAILHandler that allow to specify banned
> from addresses.
> 
> - Another idea could be an RCPTHandler that check the user inbox quota and
> reply an error when overquota.
> 
> - Maybe we could add VRFY and EXPN commands for users that want to enable
> them (maybe working only when authenticated or from given Ips).
> 
> - A ConnectHandler that would check how many messages are in the main spool
> and reply a "too busy, retry later" code instead of accepting the
> connection.
> 
> If you like any of this ideas I can help you identifying james services you
> need and how to use Avalon lifecycle interfaces to gain access to the user
> db or to the repositories.

I like all of them. To begin with I will work on these
1. MAILHandler that allow to specify banned from addresses.
2. RCPTHandler that check the user inbox quota and reply an error when
overquota.
3. A ConnectHandler that would check how many messages are in the main
spool and reply a "too busy, retry later" code instead of accepting
the connection.

Help me with the interfaces I need to know to implement the above.

--anagha

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

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


Re: [PATCH] James Fastfail

Posted by Stefano Bagnara <ap...@bago.org>.
> > I've just tested that it runs and it accept a message in smtp.
> > I won't have time this week to do more than this.
> 
> I am doing thorough testing. I am planning to refactor some 
> more and start work on MatcherMessageHandler.

IMHO any effort to be able to use Mathers/Mailets or even full processors
from the MessageHandlers would be useful.

> Do you want me to work on something specific for my next release?

We could change the default "command unknown" to:

500 5.5.1 Command "COMMANDUSED" unrecognized.
5.5.1 is DSNStatus.PERMANENT+"."+DSNStatus.DELIVERY_INVALID_CMD

And here is a few ideas on features related to the new inprotocol command
handlers:

- add a few commented out sample in the james-config.xml: e.g. Bayesian
filter in the MessageHandler.

- I would love to see a configurable RCPTHandler that will let us to
configure regexps against recipients we allow for relay (not based on local
domains but on configuration).

- I would also like a confirugable MAILHandler that allow to specify banned
from addresses.

- Another idea could be an RCPTHandler that check the user inbox quota and
reply an error when overquota.

- Maybe we could add VRFY and EXPN commands for users that want to enable
them (maybe working only when authenticated or from given Ips).

- A ConnectHandler that would check how many messages are in the main spool
and reply a "too busy, retry later" code instead of accepting the
connection.

If you like any of this ideas I can help you identifying james services you
need and how to use Avalon lifecycle interfaces to gain access to the user
db or to the repositories.

Stefano


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


Re: [PATCH] James Fastfail

Posted by Anagha Mudigonda <an...@gmail.com>.
On 8/22/05, Stefano Bagnara <ap...@bago.org> wrote:
> > Stefano,
> >
>> Hi Anagha,
> 
> I just committed your update!
> 
> I fixed a "blocklisted = blocklisted;" that should have been
> "this.blocklisted = blocklisted;" in SMTPHandler.

oops I missed that! 

> 
> I also did a few dummy changes:
> - removed an unused import in SMTPHandler.java
> - removed an unused "boolean domainExists = false;" in RcptCmdHandler.
> - removed an unused import in SMTPSession.java
> - removed the unused private final COMMAND_NAME from a few handlers.
> 
> I've just tested that it runs and it accept a message in smtp.
> I won't have time this week to do more than this.

I am doing thorough testing. I am planning to refactor some more and
start work on MatcherMessageHandler.

Do you want me to work on something specific for my next release?

--Anagha


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

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


Re: [PATCH] James Fastfail

Posted by Stefano Bagnara <ap...@bago.org>.
> Stefano,
> 
> Attached the patch that has following changes
> 
> - Now SMTPhandler implements SMTPSession interface. Remove 
> the inner class implementation
> - Removed unecessary interfaces from SMTPSession interface
> - Made changes to SMTPHandlerChain that doenot allow the 
> server to start if there are no commandHandlers registered or 
> if there are commandHandlers for mandatory commands : MAIL, 
> RCPT and DATA.

Hi Anagha,

I just committed your update!

I fixed a "blocklisted = blocklisted;" that should have been
"this.blocklisted = blocklisted;" in SMTPHandler.

I also did a few dummy changes:
- removed an unused import in SMTPHandler.java
- removed an unused "boolean domainExists = false;" in RcptCmdHandler.
- removed an unused import in SMTPSession.java 
- removed the unused private final COMMAND_NAME from a few handlers.

I've just tested that it runs and it accept a message in smtp.
I won't have time this week to do more than this.

Stefano


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