DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22429>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22429

Deadlocking in JDBC MailRepository

           Summary: Deadlocking in JDBC MailRepository
           Product: James
           Version: 2.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: MailStore & MailRepository
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have a specific requirement to send personalized mails to thousands of users. 
I have modified the RemoteDelivery class to my specific needs. I have created a 
mailet configuration which hands on the mails starting with a specific subject 
to my version of RemoteDelivery. In RemoteDelivery's service method, I create 
multiple personalized copies of the same mail, and store it in a DB repository. 
Now the RemoteDelivery's run method picks up the individual mails from the 
database and sends them. My configurations are as under.

James Version - 2.1.3
Database - SQL Server 2000
JDBC Driver - com.microsoft.jdbc.sqlserver.SQLServerDriver
Delivery Threads for my version of RemoteDelivery - 30

Now while sending the mails, some of the times the database reports Deadlock 
conditions. 
Here is the message given by the database in such cases.


java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Tra
nsaction (Process ID 58) was deadlocked on lock resources with another process a
nd has been chosen as the deadlock victim. Rerun the transaction.
        at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
)
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken
(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken
(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken
(Unknown Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown 
Source)
        at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType
(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState
(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)

        at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute
(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
        at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)

        at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)

        at org.apache.james.mailrepository.JDBCMailRepository.store
(JDBCMailRepository.java:533)
        at org.apache.james.mailrepository.JDBCSpoolRepository.store
(JDBCSpoolRepository.java:243)
        at org.apache.james.transport.mailets.SmartMailzRemoteDelivery.run
(myRemoteDelivery.java:1541)
        at java.lang.Thread.run(Thread.java:536)



In myRemoteDelivery.java, it calls outgoing.store(mail); method to save the 
mail updates if the mail could not be sent.

There are other errors also reported like



java.lang.IllegalArgumentException: timeout value is negative
        at java.lang.Object.wait(Native Method)
        at org.apache.james.mailrepository.JDBCSpoolRepository.accept
(JDBCSpoolRepository.java:226)
        at org.apache.james.transport.mailets.SmartMailzRemoteDelivery.run
(SmartMailzRemoteDelivery.java:1520)


To me the problem seems to be something like, multiple threads picking the same 
record from the database for delivery.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to