[ https://issues.apache.org/jira/browse/JAMES-3791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17566321#comment-17566321 ]
Benoit Tellier commented on JAMES-3791: --------------------------------------- We wrote in depth integration tests. - https://github.com/apache/james-project/tree/master/server/mailet/remote-delivery-integration-testing/src/test/java/org/apache/james - https://github.com/apache/james-project/blob/master/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java - https://github.com/apache/james-project/blob/master/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java This class wraps a side effect and is only some technical javax-mail manipulations that are not that important to test in isolation - (hate mocks: tests are coupled to the code, you enforce assertions on the underlying library that might be wrong, verbose, etc...). However the integration test suite brings independence from implementation (tests can be reused during a migration, no assumptions of underlying libraries). This integration test suite should be decent. Obviously it missed concurrency tests ... :-( > Remote Delivery sometimes uses wrong MAIL FROM address > ------------------------------------------------------ > > Key: JAMES-3791 > URL: https://issues.apache.org/jira/browse/JAMES-3791 > Project: James Server > Issue Type: Bug > Components: Remote Delivery > Affects Versions: master, 3.7.0 > Reporter: Karsten Otto > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > *Observed Issue:* > When delivering a mail to a remote server, James sometimes under load uses > the wrong envelope sender (MAIL FROM). This creates a wrong Return-Path at > the recipients end, which among other things causes problems with DSN replies. > *Analysis:* > I traced this to MailDelivrerToHost.tryDeliveryToHost(), which shows in the > debug log a pattern like: > # Attempting delivery of ... from al...@example.org > # Mail sent successfully to ... from b...@example.org > I also notice that getPropertiesForMail() modifies the shared SMTPSession by > putting the envelope sender into its properties. So this is likely a race > condition. > *Possible Fixes:* > I am not sure what the best fix for this would be: > # Make tryDeliveryToHost() synchronized (ugly) > # Use SMTPMessage.setEnvelopeSender() instead of SMTPSession properties > Fix 2 is nicer as it preserves concurrency, but it requires that > mail.getMessage() is always an SMTPMessage (extends MimeMessage). I do not > know the James code base well enough to be certain of that. > Any thoughts? -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org