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

ASF GitHub Bot commented on JAMES-3477:
---------------------------------------

jeantil commented on a change in pull request #282:
URL: https://github.com/apache/james-project/pull/282#discussion_r548949128



##########
File path: 
server/container/core/src/main/java/org/apache/james/server/core/MimeMessageInputStream.java
##########
@@ -40,19 +40,13 @@
      *            the message to wrap
      * @param tryCast
      *            try to cast the {@link MimeMessage} to
-     *            {@link MimeMessageCopyOnWriteProxy} /
      *            {@link MimeMessageWrapper} to do some optimized processing if
      *            possible
      * @throws MessagingException
      */
     public MimeMessageInputStream(MimeMessage message, boolean tryCast) throws 
MessagingException {
         MimeMessage m = message;
 
-        // check if we need to use the wrapped message
-        if (tryCast && m instanceof MimeMessageCopyOnWriteProxy) {
-            m = ((MimeMessageCopyOnWriteProxy) m).getWrappedMessage();
-        }
-
         // check if we can use optimized operations
         if (tryCast && m instanceof MimeMessageWrapper) {

Review comment:
       Since the described failure occurred in 'optimized'  access mode, is 
*this* optimization safe too ?

##########
File path: 
server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java
##########
@@ -311,9 +311,9 @@ public void testGetLineCount() throws Exception {
     public void testMessageCloningViaCoW() throws Exception {

Review comment:
       at a minimum the test name is misleading since there is no more COW :) 
you can probably drop this test

##########
File path: 
server/container/core/src/main/java/org/apache/james/server/core/MimeMessageUtil.java
##########
@@ -75,10 +75,6 @@ public static void writeTo(MimeMessage message, OutputStream 
headerOs, OutputStr
      */
     public static void writeTo(MimeMessage message, OutputStream headerOs, 
OutputStream bodyOs, String[] ignoreList) throws IOException, 
MessagingException {
         MimeMessage testMessage = message;

Review comment:
       this variable is no longer necessary, you can use message directlyon 
line 78 and 80 (because of the return) and as previously is the special casing 
for MimeMessageWrapper really useful ?

##########
File path: 
server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java
##########
@@ -336,9 +336,9 @@ public void testMessageCloningViaCoW() throws Exception {
     public void testMessageCloningViaCoW2() throws Exception {

Review comment:
       same as previous comment

##########
File path: 
server/container/core/src/test/java/org/apache/james/server/core/MimeMessageTest.java
##########
@@ -364,7 +364,7 @@ public void testMessageCloningViaCoW2() throws Exception {
     public void testMessageCloningViaCoWSubjectLost() throws Exception {

Review comment:
       same as previous comment




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> MimeMessageCopyOnWriteProxy is not thread safe
> ----------------------------------------------
>
>                 Key: JAMES-3477
>                 URL: https://issues.apache.org/jira/browse/JAMES-3477
>             Project: James Server
>          Issue Type: Wish
>            Reporter: Benoit Tellier
>            Priority: Major
>
> https://www.mail-archive.com/[email protected]/msg69221.html
> & 
> https://github.com/jeantil/james-project/commit/c0354ea21c5b0a8f6d46e9919f7db0d97db9eb23
> proves there is a concurrency issue in MimeMessageCopyOnWriteProxy class that 
> we need to investigate.
> It causes our test suite to be flacky.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to