Code Monkey home page Code Monkey logo

Comments (5)

saintstack avatar saintstack commented on July 17, 2024

Thats the InetAddress implementation? How is that? They are different throws?
St.Ack

On Wed, May 11, 2011 at 11:15 PM, tsuna
[email protected]
wrote:

Give asynchbase a single hostname that doesn't exist for a ZooKeeper quorum spec and observe this:

2011-05-11 23:09:52,631 ERROR [main] HBaseClient: Failed to connect to ZooKeeper
java.net.UnknownHostException: tmpzookeeper
       at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.6.0_24]
       at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:850) ~[na:1.6.0_24]
       at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201) ~[na:1.6.0_24]
       at java.net.InetAddress.getAllByName0(InetAddress.java:1154) ~[na:1.6.0_24]
       at java.net.InetAddress.getAllByName(InetAddress.java:1084) ~[na:1.6.0_24]
       at java.net.InetAddress.getAllByName(InetAddress.java:1020) ~[na:1.6.0_24]
       at org.apache.zookeeper.ClientCnxn.(ClientCnxn.java:383) ~[zookeeper-3.3.1.jar:3.3.1-942149]
       at org.apache.zookeeper.ClientCnxn.(ClientCnxn.java:328) ~[zookeeper-3.3.1.jar:3.3.1-942149]
       at org.apache.zookeeper.ZooKeeper.(ZooKeeper.java:377) ~[zookeeper-3.3.1.jar:3.3.1-942149]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2203) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.getDeferredRoot(HBaseClient.java:2120) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.locateRegion(HBaseClient.java:1102) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.sendRpcToRegion(HBaseClient.java:1005) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.get(HBaseClient.java:700) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.ensureTableFamilyExists(HBaseClient.java:653) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.ensureTableExists(HBaseClient.java:673) [hbaseasync-1.0.jar:d1aff70]
       at net.opentsdb.tools.TSDMain.main(TSDMain.java:130) [tsdb-1.0.jar:b4a37c5]
[...]
2011-05-11 23:09:52,644 ERROR [main] HBaseClient: Failed to connect to ZooKeeper
java.net.UnknownHostException: tmpzookeeper
       at java.net.InetAddress.getAllByName0(InetAddress.java:1158) ~[na:1.6.0_24]
       at java.net.InetAddress.getAllByName(InetAddress.java:1084) ~[na:1.6.0_24]
       at java.net.InetAddress.getAllByName(InetAddress.java:1020) ~[na:1.6.0_24]
       at org.apache.zookeeper.ClientCnxn.(ClientCnxn.java:383) ~[zookeeper-3.3.1.jar:3.3.1-942149]
       at org.apache.zookeeper.ClientCnxn.(ClientCnxn.java:328) ~[zookeeper-3.3.1.jar:3.3.1-942149]
       at org.apache.zookeeper.ZooKeeper.(ZooKeeper.java:377) ~[zookeeper-3.3.1.jar:3.3.1-942149]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2203) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.connectZK(HBaseClient.java:2209) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient$ZKClient.getDeferredRoot(HBaseClient.java:2120) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.locateRegion(HBaseClient.java:1102) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.sendRpcToRegion(HBaseClient.java:1005) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.get(HBaseClient.java:700) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.ensureTableFamilyExists(HBaseClient.java:653) [hbaseasync-1.0.jar:d1aff70]
       at org.hbase.async.HBaseClient.ensureTableExists(HBaseClient.java:673) [hbaseasync-1.0.jar:d1aff70]
       at net.opentsdb.tools.TSDMain.main(TSDMain.java:130) [tsdb-1.0.jar:b4a37c5]

Notice how stack frames in connectZK keep adding up?  Bad.

Reply to this email directly or view it on GitHub:
https://github.com/stumbleupon/asynchbase/issues/5

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

No the problem is that ZKClient.connectZK is calling itself recursively when it catches an IOException right after creating a ZooKeeper object. The code is roughly like this:

    private void connectZK() {
      // [...]
        // Session establishment is asynchronous, so this won't block.
        zk = new ZooKeeper(quorum_spec, 5000, this);
      } catch (IOException e) {
        LOG.error("Failed to connect to ZooKeeper", e);
        // XXX don't retry recursively, create a timer with an exponential
        // backoff and schedule the reconnection attempt for later.
        connectZK();
      }

It's time to fix that XXX comment! :)

from asynchbase.

saintstack avatar saintstack commented on July 17, 2024

good one. you told the boys about it?

On Thu, May 12, 2011 at 8:43 AM, tsuna
[email protected]
wrote:

No the problem is that ZKClient.connectZK is calling itself recursively when it catches an IOException right after creating a ZooKeeper object.  The code is roughly like this:

   private void connectZK() {
     // [...]
       // Session establishment is asynchronous, so this won't block.
       zk = new ZooKeeper(quorum_spec, 5000, this);
     } catch (IOException e) {
       LOG.error("Failed to connect to ZooKeeper", e);
       // XXX don't retry recursively, create a timer with an exponential
       // backoff and schedule the reconnection attempt for later.
       connectZK();
     }

It's time to fix that XXX comment! :)

Reply to this email directly or view it on GitHub:
https://github.com/stumbleupon/asynchbase/issues/5#comment_1147334

from asynchbase.

nikolaybotev avatar nikolaybotev commented on July 17, 2024

... if only java had tail-call elimination. sigh

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

Although it's really too bad that the JVM platform (or rather the byte code) doesn't do tail-call optimizations, in this case it would simply turn the imminent stack overflow error into an endless loop.

from asynchbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.