You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Jeff Zhang <zj...@gmail.com> on 2009/11/30 11:35:30 UTC

A weird problem, connection time out ?

Hi all,

The following code run without exception, but it output nothing. And if I
remove the red code , it will output records. So does it because of
connection time out ? If so, it should throw exception rather than doing
nothing.


        ResultScanner scanner = HTableFactory.getTable("a").getScanner(new
Scan());
        Iterator<Result> iter = scanner.iterator();
*        try {
            Thread.sleep(1000*60*2);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }*

        while (iter.hasNext()) {
            Result result = iter.next();
            System.out.println(result);
        }

Jeff Zhang

Re: A weird problem, connection time out ?

Posted by Andrew Purtell <ap...@apache.org>.
If the processing time takes longer than the scanner lease period, then you have to increase the scanner lease period to compensate. Scanners have leases so their state will be cleaned up on the region server should the client die. RPC between HBase clients and servers is sessionless. There's no way for a region server to know that a client is dead or is simply taking a lot of time to process some item and will soon be back for another next(). 

   - Andy




________________________________
From: Jeff Zhang <zj...@gmail.com>
To: hbase-user@hadoop.apache.org
Sent: Mon, November 30, 2009 6:08:49 PM
Subject: Re: A weird problem, connection time out ?

Ryan,

Actually it did not throw any exception.  And I try another piece of code :

        Iterator<Result> iter = scanner.iterator();
        while (iter.hasNext()) {
            Result result = iter.next();
            System.out.println(result);
            // do some processing on this record
*            try {
                 Thread.sleep(1000*60*2);
            } catch (InterruptedException e) {
              // TODO Auto-generated catch block
            e.printStackTrace();
            }*
        }

In this case, it will only output the first record. Sometimes people will
get  record one by one from hbase, and do some processing on this record. If
the processing time cost more than 1 minutes, then it will lose the iterator
and throw no exception.  I do not think this make sense. Should I put a jira
item for it ?

Jeff Zhang

On Mon, Nov 30, 2009 at 6:53 PM, Ryan Rawson <ry...@gmail.com> wrote:

> Since a scanner occupies server side resources (potentially significant),
> there is a 60 second timeout, and the client will throw a scanner related
> IOException.
>
> On Nov 30, 2009 2:50 AM, "Rekha Joshi" <re...@yahoo-inc.com> wrote:
>
> Not sure if connection timeout would register as InterruptedException,
> could
> be a SocketTimeoutException. You may try catching on the logger the general
> Exception to find out the 'e'.Thanks!
>
> On 11/30/09 4:05 PM, "Jeff Zhang" <zj...@gmail.com> wrote:
>
> InterruptedException
>



      

Re: A weird problem, connection time out ?

Posted by Jeff Zhang <zj...@gmail.com>.
Ryan,

Actually it did not throw any exception.  And I try another piece of code :

        Iterator<Result> iter = scanner.iterator();
        while (iter.hasNext()) {
            Result result = iter.next();
            System.out.println(result);
            // do some processing on this record
*            try {
                 Thread.sleep(1000*60*2);
            } catch (InterruptedException e) {
              // TODO Auto-generated catch block
            e.printStackTrace();
            }*
        }

In this case, it will only output the first record. Sometimes people will
get  record one by one from hbase, and do some processing on this record. If
the processing time cost more than 1 minutes, then it will lose the iterator
and throw no exception.  I do not think this make sense. Should I put a jira
item for it ?

Jeff Zhang

On Mon, Nov 30, 2009 at 6:53 PM, Ryan Rawson <ry...@gmail.com> wrote:

> Since a scanner occupies server side resources (potentially significant),
> there is a 60 second timeout, and the client will throw a scanner related
> IOException.
>
> On Nov 30, 2009 2:50 AM, "Rekha Joshi" <re...@yahoo-inc.com> wrote:
>
> Not sure if connection timeout would register as InterruptedException,
> could
> be a SocketTimeoutException. You may try catching on the logger the general
> Exception to find out the 'e'.Thanks!
>
> On 11/30/09 4:05 PM, "Jeff Zhang" <zj...@gmail.com> wrote:
>
> InterruptedException
>

Re: A weird problem, connection time out ?

Posted by Ryan Rawson <ry...@gmail.com>.
Since a scanner occupies server side resources (potentially significant),
there is a 60 second timeout, and the client will throw a scanner related
IOException.

On Nov 30, 2009 2:50 AM, "Rekha Joshi" <re...@yahoo-inc.com> wrote:

Not sure if connection timeout would register as InterruptedException, could
be a SocketTimeoutException. You may try catching on the logger the general
Exception to find out the 'e'.Thanks!

On 11/30/09 4:05 PM, "Jeff Zhang" <zj...@gmail.com> wrote:

InterruptedException

Re: A weird problem, connection time out ?

Posted by Rekha Joshi <re...@yahoo-inc.com>.
Not sure if connection timeout would register as InterruptedException, could be a SocketTimeoutException. You may try catching on the logger the general Exception to find out the 'e'.Thanks!

On 11/30/09 4:05 PM, "Jeff Zhang" <zj...@gmail.com> wrote:

InterruptedException