[jira] [Commented] (HBASE-5067) HMaster uses wrong name for address (in stand-alone mode)

2011-12-20 Thread Eran Hirsch (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-5067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13173079#comment-13173079
 ] 

Eran Hirsch commented on HBASE-5067:


To the best of my understanding, the problem is fixed in the trunk, but only to 
some extent.
It seems like the flow would work correctly, but relies on the underlying VM 
implementation and assumes certain things which are not strictly assumable.

=

I'll explain...
1. the hostname is computed based on the reverse DNS like before
2. an InetSockedAddress is built from this hostname and stored locally as 
'initialIsa'
3. The RPC server now is created using, among others, 'initialIsa.getHostName()'
4. The address which was binded on by the rpc server is stored as the HMaster 
field 'isa'
5. The server name is initialized with the 'isa' field's hostname.

=

Why is this problematic?

Because it assumes things about the socked implementation which are not 
strictly enforced:

We first call the 'bind' method of a ServerSocket object, with an 
InetSocketAddress instance.
Later on we call ServerSocket's 'getLocalSocketAddress' to get this address 
instance back.
There is no way to know if the same object is returned, or maybe a new object 
is built based on the IP, or whatever other way the implementation chooses. 
Specifically to our case, You can tell this would still hold the 'hostname' 
field we gave it, with our fully qualified dns name.



To conclude,
I think there is a semantic problem with the way the HMaster is initialzed in 
it's c'tor:
1. When creating the rpcServer, we should call the method with 
'initialIsa.getAddress().getHostAddress()' (instead of 
'initialIsa.getHostName()).
This would also be consistent with the comment written next to this parameter, 
saying that we are sending an IP (because now we are sending a DNS name).
2. When setting the 'serverName' field, we need to use the local field 
'hostname' computed earlier (instead of 'this.isa.getHostName()).

==

Notes:
1. The same problem applies to HRegionServer which uses almost the same 
initialization code in its c'tor. 
2. I am not an HBase developer, so i don't know really how to add these changes 
myself.



 HMaster uses wrong name for address (in stand-alone mode)
 -

 Key: HBASE-5067
 URL: https://issues.apache.org/jira/browse/HBASE-5067
 Project: HBase
  Issue Type: Bug
  Components: master
Affects Versions: 0.90.4
Reporter: Eran Hirsch

 In STANDALONE mode:
 When setting the configuration option hbase.master.dns.interface (and 
 optional hbase.master.dns.nameserver) to non-default values,
 it is EXPECTED that the master node would report its fully qualified dns name 
 when registering in ZooKeeper,
 BUT INSTEAD, the machines hostname is taken instead.
 For example, my machine is called (aka its hostname is...) machine1 but 
 it's name in the network is machine1.our-dev-network.my-corp.com, so to 
 find this machine's IP anywhere on the network i would need to query for the 
 whole name (because trying to find machine1 is ambiguous on a network).
 Why is this a bug, because when trying to connect to this stand-alone hbase 
 installation from outside the machine it is running on, when querying ZK for 
 /hbase/master we get only the machine1 part, and then fail with an 
 unresolvable address for the master (which later even gives a null pointer 
 because of a missing null check).
 This is the stack trace when calling HTable's c'tor:
 java.lang.IllegalArgumentException: hostname can't be null
   at java.net.InetSocketAddress.init(InetSocketAddress.java:139) 
 ~[na:1.7.0_02]
   at 
 org.apache.hadoop.hbase.HServerAddress.getResolvedAddress(HServerAddress.java:108)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.HServerAddress.init(HServerAddress.java:64) 
 ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.zookeeper.RootRegionTracker.dataToHServerAddress(RootRegionTracker.java:82)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.zookeeper.RootRegionTracker.waitRootRegionLocation(RootRegionTracker.java:73)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:579)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:559)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:688)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:590)
  

[jira] [Commented] (HBASE-5065) wrong IllegalArgumentException thrown when creating an 'HServerAddress' with an un-reachable hostname

2011-12-20 Thread Eran Hirsch (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-5065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13173219#comment-13173219
 ] 

Eran Hirsch commented on HBASE-5065:


i am not an Hbase developer, i don't know how to provide a patch.

Anyhow, i checked the trunk and this class has been deprecated all-together, so 
there is no need to fix this anymore (i guess...?)

 wrong IllegalArgumentException thrown when creating an 'HServerAddress' with 
 an un-reachable hostname
 -

 Key: HBASE-5065
 URL: https://issues.apache.org/jira/browse/HBASE-5065
 Project: HBase
  Issue Type: Bug
  Components: util
Affects Versions: 0.90.4
Reporter: Eran Hirsch
Priority: Trivial

 When trying to build an 'HServerAddress' object with an unresolvable hostname:
 e.g. new HServerAddress(www.IAMUNREACHABLE.com:80)
 a call to 'getResolvedAddress' would cause the 'InetSocketAddress' c'tor to 
 throw an IllegalArgumentException because it is called with a null 'hostname' 
 parameter.
 This happens because there is no null-check after the static 
 'getBindAddressInternal' method returns a null value when the hostname is 
 unresolved.
 This is a trivial bug because the code HServerAddress is expected to throw 
 this kind of exception when this error occurs, but it is thrown for the 
 wrong reason. The method 'checkBindAddressCanBeResolved' should be the one 
 throwing the exception (and give a slightly different reason). Because of 
 this reason the method call itself becomes redundent as it will always 
 succeed in the current flow, because the case it checks is already checked 
 for by the previous getResolvedAddress method.
 In short:
 an IllegalArgumentException is thrown with reason: hostname can't be null 
 from the InetSocketAddress c'tor
 INSTEAD OF
 an IllegalArgumentException with reason: Could not resolve the DNS name of 
 [BADHOSTNAME]:[PORT] from HServerAddress's checkBindCanBeResolved method.
 Stack trace:
 java.lang.IllegalArgumentException: hostname can't be null
   at java.net.InetSocketAddress.init(InetSocketAddress.java:139) 
 ~[na:1.7.0_02]
   at 
 org.apache.hadoop.hbase.HServerAddress.getResolvedAddress(HServerAddress.java:108)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.HServerAddress.init(HServerAddress.java:64) 
 ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.zookeeper.RootRegionTracker.dataToHServerAddress(RootRegionTracker.java:82)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.zookeeper.RootRegionTracker.waitRootRegionLocation(RootRegionTracker.java:73)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:579)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:559)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:688)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:590)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:559)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:688)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:594)
  ~[hbase-0.90.4.jar:0.90.4]
   at 
 org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:559)
  ~[hbase-0.90.4.jar:0.90.4]
   at org.apache.hadoop.hbase.client.HTable.init(HTable.java:173) 
 ~[hbase-0.90.4.jar:0.90.4]
   at org.apache.hadoop.hbase.client.HTable.init(HTable.java:147) 
 ~[hbase-0.90.4.jar:0.90.4]

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira