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

ASF GitHub Bot commented on HADOOP-18883:
-----------------------------------------

saxenapranav opened a new pull request, #6511:
URL: https://github.com/apache/hadoop/pull/6511

   Backport of 
https://github.com/apache/hadoop/commit/7dc166ddc7fa524d842c77c0d6e83dde6d13dc54
   Trunk PR: https://github.com/apache/hadoop/pull/6022
   
   Description:
   
   Address JDK bug JDK-8314978 related to handling of HTTP 100 responses.
   
   https://bugs.openjdk.org/browse/JDK-8314978
   
   In the AbfsHttpOperation, after sendRequest() we call processResponse() 
method from AbfsRestOperation.
   Even if the conn.getOutputStream() fails due to expect-100 error, we consume 
the exception and let the code go ahead. This may call getHeaderField() / 
getHeaderFields() / getHeaderFieldLong() after getOutputStream() has failed. 
These invocation all lead to server calls.
   
   This commit aims to prevent this.
   If connection.getOutputStream() fails due to an Expect-100 error, the ABFS 
client does not invoke getHeaderField(), getHeaderFields(), 
getHeaderFieldLong() or getInputStream().
   
   getResponseCode() is safe as on the failure it sets the responseCode 
variable in HttpUrlConnection object.




> Expect-100 JDK bug resolution: prevent multiple server calls
> ------------------------------------------------------------
>
>                 Key: HADOOP-18883
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18883
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>            Reporter: Pranav Saxena
>            Assignee: Pranav Saxena
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.5.0
>
>
> This is inline to JDK bug: [https://bugs.openjdk.org/browse/JDK-8314978].
>  
> With the current implementation of HttpURLConnection if server rejects the 
> “Expect 100-continue” then there will be ‘java.net.ProtocolException’ will be 
> thrown from 'expect100Continue()' method.
> After the exception thrown, If we call any other method on the same instance 
> (ex getHeaderField(), or getHeaderFields()). They will internally call 
> getOuputStream() which invokes writeRequests(), which make the actual server 
> call. 
> In the AbfsHttpOperation, after sendRequest() we call processResponse() 
> method from AbfsRestOperation. Even if the conn.getOutputStream() fails due 
> to expect-100 error, we consume the exception and let the code go ahead. So, 
> we can have getHeaderField() / getHeaderFields() / getHeaderFieldLong() which 
> will be triggered after getOutputStream is failed. These invocation will lead 
> to server calls.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to