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

Chris Nauroth commented on HADOOP-12304:
----------------------------------------

The problem is that {{FileSystem#getDefaultPort}} is coded to return {{0}} to 
indicate undefined, and wasb, s3, etc. do not override it.  However, the logic 
of {{AbstractFileSystem#getUri}} expects {{-1}} as the sentinel value to 
indicate undefined.  This is more in line with the contract of 
{{java.net.URI#getPort}}.  The test cases for HADOOP-11618 didn't catch this, 
because they were focused on the positive case of a file system that requires 
specifying an authority (including port), specifically {{FtpFs}}.

Here is a sample stack trace from the MapReduce application master with wasb as 
the default file system.

{code}
2015-08-04 12:17:57,326 ERROR [main] 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler: Failed while 
checking for/creating  history staging path: 
[wasb://cnauroth.blob.core.windows.net:0/tmp/hadoop-yarn/staging/chris/.staging/job_1438715383283_0002]
org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:943)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.initialize(AzureNativeFileSystemStore.java:440)
        at 
org.apache.hadoop.fs.azure.NativeAzureFileSystem.initialize(NativeAzureFileSystem.java:1048)
        at 
org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2653)
        at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:92)
        at 
org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2687)
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)
        at 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler.serviceInit(JobHistoryEventHandler.java:165)
        at 
org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
        at 
org.apache.hadoop.service.CompositeService.serviceInit(CompositeService.java:107)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.serviceInit(MRAppMaster.java:450)
        at 
org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster$4.run(MRAppMaster.java:1518)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.initAndStartAppMaster(MRAppMaster.java:1515)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.main(MRAppMaster.java:1448)
Caused by: org.apache.hadoop.fs.azure.AzureException: Unable to access 
container $root in account cnauroth.blob.core.windows.net:0 using anonymous 
credentials, and no credentials found for them  in the configuration.
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.connectUsingAnonymousCredentials(AzureNativeFileSystemStore.java:740)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:938)
        ... 18 more
Caused by: com.microsoft.azure.storage.StorageException: An unknown failure 
occurred : Can't assign requested address
        at 
com.microsoft.azure.storage.StorageException.translateException(StorageException.java:66)
        at 
com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:219)
        at 
com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:749)
        at 
com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:736)
        at 
org.apache.hadoop.fs.azure.StorageInterfaceImpl$CloudBlobContainerWrapperImpl.exists(StorageInterfaceImpl.java:213)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.connectUsingAnonymousCredentials(AzureNativeFileSystemStore.java:734)
        ... 19 more
Caused by: java.net.NoRouteToHostException: Can't assign requested address
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
        at sun.net.www.http.HttpClient.New(HttpClient.java:308)
        at sun.net.www.http.HttpClient.New(HttpClient.java:326)
        at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
        at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
        at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
        at 
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
        at 
com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:126)
        ... 23 more
2015-08-04 12:17:57,328 INFO [main] org.apache.hadoop.service.AbstractService: 
Service JobHistoryEventHandler failed in state INITED; cause: 
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: 
org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: 
org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
        at 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler.serviceInit(JobHistoryEventHandler.java:171)
        at 
org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
        at 
org.apache.hadoop.service.CompositeService.serviceInit(CompositeService.java:107)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.serviceInit(MRAppMaster.java:450)
        at 
org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster$4.run(MRAppMaster.java:1518)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.initAndStartAppMaster(MRAppMaster.java:1515)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.main(MRAppMaster.java:1448)
Caused by: org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:943)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.initialize(AzureNativeFileSystemStore.java:440)
        at 
org.apache.hadoop.fs.azure.NativeAzureFileSystem.initialize(NativeAzureFileSystem.java:1048)
        at 
org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2653)
        at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:92)
        at 
org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2687)
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)
        at 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler.serviceInit(JobHistoryEventHandler.java:165)
        ... 10 more
Caused by: org.apache.hadoop.fs.azure.AzureException: Unable to access 
container $root in account cnauroth.blob.core.windows.net:0 using anonymous 
credentials, and no credentials found for them  in the configuration.
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.connectUsingAnonymousCredentials(AzureNativeFileSystemStore.java:740)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:938)
        ... 18 more
Caused by: com.microsoft.azure.storage.StorageException: An unknown failure 
occurred : Can't assign requested address
        at 
com.microsoft.azure.storage.StorageException.translateException(StorageException.java:66)
        at 
com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:219)
        at 
com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:749)
        at 
com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:736)
        at 
org.apache.hadoop.fs.azure.StorageInterfaceImpl$CloudBlobContainerWrapperImpl.exists(StorageInterfaceImpl.java:213)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.connectUsingAnonymousCredentials(AzureNativeFileSystemStore.java:734)
        ... 19 more
Caused by: java.net.NoRouteToHostException: Can't assign requested address
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
        at sun.net.www.http.HttpClient.New(HttpClient.java:308)
        at sun.net.www.http.HttpClient.New(HttpClient.java:326)
        at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
        at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
        at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
        at 
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
        at 
com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:126)
        ... 23 more
2015-08-04 12:17:57,329 INFO [main] 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler: Stopping 
JobHistoryEventHandler. Size of the outstanding queue size is 0
2015-08-04 12:17:57,329 INFO [main] 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler: Stopped 
JobHistoryEventHandler. super.stop()
2015-08-04 12:17:57,329 INFO [main] org.apache.hadoop.service.AbstractService: 
Service org.apache.hadoop.mapreduce.v2.app.MRAppMaster failed in state INITED; 
cause: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: 
org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: 
org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
        at 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler.serviceInit(JobHistoryEventHandler.java:171)
        at 
org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
        at 
org.apache.hadoop.service.CompositeService.serviceInit(CompositeService.java:107)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.serviceInit(MRAppMaster.java:450)
        at 
org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster$4.run(MRAppMaster.java:1518)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.initAndStartAppMaster(MRAppMaster.java:1515)
        at 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster.main(MRAppMaster.java:1448)
Caused by: org.apache.hadoop.fs.azure.AzureException: 
org.apache.hadoop.fs.azure.AzureException: Unable to access container $root in 
account cnauroth.blob.core.windows.net:0 using anonymous credentials, and no 
credentials found for them  in the configuration.
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:943)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.initialize(AzureNativeFileSystemStore.java:440)
        at 
org.apache.hadoop.fs.azure.NativeAzureFileSystem.initialize(NativeAzureFileSystem.java:1048)
        at 
org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2653)
        at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:92)
        at 
org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2687)
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)
        at 
org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler.serviceInit(JobHistoryEventHandler.java:165)
        ... 10 more
Caused by: org.apache.hadoop.fs.azure.AzureException: Unable to access 
container $root in account cnauroth.blob.core.windows.net:0 using anonymous 
credentials, and no credentials found for them  in the configuration.
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.connectUsingAnonymousCredentials(AzureNativeFileSystemStore.java:740)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:938)
        ... 18 more
Caused by: com.microsoft.azure.storage.StorageException: An unknown failure 
occurred : Can't assign requested address
        at 
com.microsoft.azure.storage.StorageException.translateException(StorageException.java:66)
        at 
com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:219)
        at 
com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:749)
        at 
com.microsoft.azure.storage.blob.CloudBlobContainer.exists(CloudBlobContainer.java:736)
        at 
org.apache.hadoop.fs.azure.StorageInterfaceImpl$CloudBlobContainerWrapperImpl.exists(StorageInterfaceImpl.java:213)
        at 
org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.connectUsingAnonymousCredentials(AzureNativeFileSystemStore.java:734)
        ... 19 more
Caused by: java.net.NoRouteToHostException: Can't assign requested address
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
        at sun.net.www.http.HttpClient.New(HttpClient.java:308)
        at sun.net.www.http.HttpClient.New(HttpClient.java:326)
        at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
        at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
        at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
        at 
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
        at 
com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:126)
        ... 23 more
2015-08-04 12:17:57,329 INFO [main] 
org.apache.hadoop.mapreduce.v2.app.MRAppMaster: Skipping cleaning up the 
staging dir. assuming AM will be retried.
{code}




> Applications using FileContext fail with the default file system configured 
> to be wasb/s3/etc.
> ----------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-12304
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12304
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.7.0, 2.7.1
>            Reporter: Chris Nauroth
>            Assignee: Chris Nauroth
>            Priority: Blocker
>              Labels: 2.7.2-candidate
>
> HADOOP-11618 fixed a bug with {{DelegateToFileSystem}} using the wrong 
> default port.  As a side effect of this patch, file path URLs that previously 
> had no port now insert :0 for the port, as per the default implementation of 
> {{FileSystem#getDefaultPort}}.  At runtime, this can cause an application to 
> erroneously try contacting port 0 for a remote blob store service.  The 
> connection fails.  Ultimately, this renders wasb, s3, and probably custom 
> file system implementations outside the Hadoop source tree completely 
> unusable as the default file system.



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

Reply via email to