Rauno, Thanks again for the reports. There were actually multiple levels of synchronization I had to undo. First, the sendMail() method was synchronized (actually several times) and then the repositories were synchronized on the store() method. This meant that even though threads were obtaining locks, an insert or update would lock the entire repository.
I undid so much blocking, I started hitting big problems because the file repository was assuming that delete() calls were completed after called. I had to switch to an in-memory list of keys in a repository, and it works nicely. I also added code during the initialization() method to remove stranded files (when one of the pair of files is missing). Serge Knystautas Loki Technologies - Unstoppable Websites http://www.lokitech.com/ ----- Original Message ----- From: "Rauno Palosaari" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 23, 2001 4:34 AM Subject: James and multiple incoming mail. > Hi guys and dolls. > > There is a problem with multiple incoming SMTP messages to James (and a > workaround). > The problem is that a thread receiving the DATA part from a client will > block other clients DATA or QUITs. > > To reproduce it: > Start 2 telnet sessions to James (telnet 127.0.0.1 25) > Client 1 sends: > >>>> > HELO rauno > MAIL FROM: <[EMAIL PROTECTED]> > RCPT TO: <[EMAIL PROTECTED]> > DATA > Subject: Test > > Some dummy data, do not send <CRLF>.<CRLF> yet > <<<< > Client 2 sends > >>>> > HELO rauno > MAIL FROM: <[EMAIL PROTECTED]> > RCPT TO: <[EMAIL PROTECTED]> > DATA > Subject: Test > > Some dummy data > <CRLF>.<CRLF> > <<<< > > Client 2 doesn't get "250 Message received" until client 1 sends the > final <CRLF>.<CRLF> > > The problem is that sendMail is synchronized in James.java: > public synchronized void sendMail(MailAddress sender, Collection > recipients, InputStream msg) > > The workaround is to read the entire message before sendMail( > > In SMTPHandler.java, private boolean parseCommand(String command) in > DATA, before the call: > mailServer.sendMail(mail); > add: > mail.getSize(); // force the entire message to be read. > > this forces MailImpl to read the entire mail before the call to sendMail( > > I just got the latest CVS sources and SMTPHandler.java, doDATA(..) has a > test on if maxmessagesize is set that will force the message to be read > before sendMail(..) > If you don't limit the size of incoming mail just set this value very high. > > -rauno --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
