You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Rolf Kalbermatter (JIRA)" <ji...@apache.org> on 2011/09/11 21:36:08 UTC

[jira] [Created] (HTTPASYNC-7) Possible race condition in BasicFuture

Possible race condition in BasicFuture
--------------------------------------

                 Key: HTTPASYNC-7
                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-7
             Project: HttpComponents HttpAsyncClient
          Issue Type: Bug
    Affects Versions: 4.0-alpha2
         Environment: Java source code
            Reporter: Rolf Kalbermatter
             Fix For: 4.0-alpha3


In the complete() method inside the BasicFuture class exists a possible race condition at line 98 and 99. First the "completed" status is set to true and after that the "result" is assigned. However in the get methods the completed status is checked and then the result returned, resulting in the potential race condition that the still unassigned result is returned.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (HTTPASYNC-7) Possible race condition in BasicFuture

Posted by "Rolf Kalbermatter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPASYNC-7?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102824#comment-13102824 ] 

Rolf Kalbermatter commented on HTTPASYNC-7:
-------------------------------------------

You are of course right. I completely overlooked the synchronized attribute of those methods. And removing that attribute seems no option even if the order of the method calls would be changed, so I suppose this is a non issue, or at most a cosmetic one. 

> Possible race condition in BasicFuture
> --------------------------------------
>
>                 Key: HTTPASYNC-7
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-7
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0-alpha2
>         Environment: Java source code
>            Reporter: Rolf Kalbermatter
>              Labels: features
>             Fix For: 4.0-alpha3
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> In the complete() method inside the BasicFuture class exists a possible race condition at line 98 and 99. First the "completed" status is set to true and after that the "result" is assigned. However in the get methods the completed status is checked and then the result returned, resulting in the potential race condition that the still unassigned result is returned.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Resolved] (HTTPASYNC-7) Possible race condition in BasicFuture

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPASYNC-7?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPASYNC-7.
---------------------------------------

       Resolution: Not A Problem
    Fix Version/s:     (was: 4.0-alpha3)

> Possible race condition in BasicFuture
> --------------------------------------
>
>                 Key: HTTPASYNC-7
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-7
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0-alpha2
>         Environment: Java source code
>            Reporter: Rolf Kalbermatter
>              Labels: features
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> In the complete() method inside the BasicFuture class exists a possible race condition at line 98 and 99. First the "completed" status is set to true and after that the "result" is assigned. However in the get methods the completed status is checked and then the result returned, resulting in the potential race condition that the still unassigned result is returned.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Issue Comment Edited] (HTTPASYNC-7) Possible race condition in BasicFuture

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPASYNC-7?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102337#comment-13102337 ] 

Oleg Kalnichevski edited comment on HTTPASYNC-7 at 9/11/11 8:19 PM:
--------------------------------------------------------------------

Rolf, are you sure about that? Both methods are synchronized so only one of them can access the internal state of the object at a time and the sequence of modification of the 'completed' and 'result' instance variables should not matter. 

Oleg

      was (Author: olegk):
    Rolf, are you sure about that? Both methods are synchronized so only one of them can mutate the internal state of the object at a time and the sequence of modification of the 'completed' and 'result' instance variables should not matter. 

Oleg
  
> Possible race condition in BasicFuture
> --------------------------------------
>
>                 Key: HTTPASYNC-7
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-7
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0-alpha2
>         Environment: Java source code
>            Reporter: Rolf Kalbermatter
>              Labels: features
>             Fix For: 4.0-alpha3
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> In the complete() method inside the BasicFuture class exists a possible race condition at line 98 and 99. First the "completed" status is set to true and after that the "result" is assigned. However in the get methods the completed status is checked and then the result returned, resulting in the potential race condition that the still unassigned result is returned.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (HTTPASYNC-7) Possible race condition in BasicFuture

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPASYNC-7?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102337#comment-13102337 ] 

Oleg Kalnichevski commented on HTTPASYNC-7:
-------------------------------------------

Rolf, are you sure about that? Both methods are synchronized so only one of them can mutate the internal state of the object at a time and the sequence of modification of the 'completed' and 'result' instance variables should not matter. 

Oleg

> Possible race condition in BasicFuture
> --------------------------------------
>
>                 Key: HTTPASYNC-7
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-7
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0-alpha2
>         Environment: Java source code
>            Reporter: Rolf Kalbermatter
>              Labels: features
>             Fix For: 4.0-alpha3
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> In the complete() method inside the BasicFuture class exists a possible race condition at line 98 and 99. First the "completed" status is set to true and after that the "result" is assigned. However in the get methods the completed status is checked and then the result returned, resulting in the potential race condition that the still unassigned result is returned.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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