cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6427) Incorrect Response InputStream closing in AbstractClient
Date Tue, 02 Jun 2015 09:33:17 GMT

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

Sergey Beryozkin commented on CXF-6427:
---------------------------------------

First of all this really needs to be discussed at the CXF dev or the users list due to the
fact the JIRA issue is based on the opinion, second - as I've already mentioned the following
code stops working with the auto-closing by default, 
{code:java}
Source source = client.get(Source.class);
Document doc = client.get(Document.class);
{code}

Effectively, auto-closing by default breaks streaming and the lazy-loading implementations
of Document/etc and we've had concrete side-effects of it in our own productions and therefore
this can not be done by default for non-InputStream classes. I'm closing it - if you feel
strong about please then I'd encourage you to start a CXF dev thread to get the conversation
going, thanks



> Incorrect Response InputStream closing in AbstractClient
> --------------------------------------------------------
>
>                 Key: CXF-6427
>                 URL: https://issues.apache.org/jira/browse/CXF-6427
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.16
>            Reporter: Petr Miko
>            Assignee: Sergey Beryozkin
>             Fix For: Invalid
>
>
> In current implementation of _org.apache.cxf.jaxrs.client.AbstractClient_ is response
body input stream closed in following method
> {noformat}
>     protected boolean responseStreamCanBeClosed(Message outMessage, Class<?> cls)
{
>         return cls != InputStream.class
>             && MessageUtils.isTrue(outMessage.getContextualProperty("response.stream.auto.close"));
>     } 
> {noformat}
> That means, that in case that if the _response.stream.auto.close_ is not set to true,
the input stream stays opened -> Socket is not free for reusing. 
> In my opinion the proper implementation should be:
> {noformat}
>   protected boolean responseStreamCanBeClosed(Message outMessage, Class<?> cls)
{
>     return !cls.isAssignableFrom(InputStream.class) || MessageUtils.isTrue(outMessage.getContextualProperty("response.stream.auto.close"));
>   }
> {noformat}  
> This way is the response body input stream:
> * is closed even when the auto close property is not set (= default?) and cls is not
a child of InputStream
> * the input stream is not closed, if cls is child of InputStream class (do not know if
there might be cases of its subclasses) and the auto close property is not set to true
> * the auto close property still can over-rule the fact that the cls is assignable from
InputStream
> The current implementation is in my opinion incorrect, because in case of a lot quick/parallel
requests over proxy clients we faced running out of Sockets - similarly to what is described
in CXF-5144



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message