fapifta opened a new pull request #3579:
URL: https://github.com/apache/hadoop/pull/3579


   ### Description of PR
   When an ipc.Client.Connection is created for the first time, it is added to 
the connections pool based on ConnectionId, and then it is there until the 
connection is closed.
   If someone instantiates two clients (eg. when fs.hdfs.impl.disable.cache is 
true), then the same connection is shared between the two DfsClient due to this 
pooling.
   
   Connection.setupIOStreams is responsible to set the fallbackToSimpleAuth 
AtomicBoolean, but when a connection is accessed the second time, 
setupIOStreams returns without setting the AtomicBoolean properly.
   This leads to read failures in the second DfsClient, when the client is 
running with a secure configuration, but connects to a SIMPLE auth cluster with 
ipc.client.fallback-to-simple-auth-allowed set to true unless it is created 
after the first one is closed.
   
   The fix is to properly set the fallbackToSimpleAuth AtomicBoolean even 
though the socket is already created. In this case the authMethod is not null, 
but there is a sanity check for that, so if somehow we get there with an 
authMethod equals null, we just do not touch the AtomicBoolean, similarly if 
the AtomicBoolean itself is null.
   
   ### How was this patch tested?
   In a real environment with different iterations of the code that is shown in 
the JIRA ticket. Event orders that were tested:
   Get two DfsClient with cache enabled - pass (passed before patch)
   Get one DfsClient with cache disabled, then get on DfsClient with cache 
enabled - pass (failed before patch)
   Get two DfsClient with cache disabled - pass (failed before patch)
   Next tests were with cache disabled:
   Get one DfsClient close it get the second DfsClient - pass (passed before 
patch)
   Get one DfsClient close it after the second DfsClient is created - pass 
(failed before patch)
   Get two DfsClient without deliberately closing any of them - pass (failed 
before patch)


-- 
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.

To unsubscribe, e-mail: [email protected]

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



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

Reply via email to