zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yury Zavarin <yury.zava...@gmail.com>
Subject connection loss in Net::ZooKeeper (perl driver)
Date Fri, 12 Aug 2011 16:02:34 GMT
Hi,

I want to handle CONNECTION LOSS event in perl driver (die() or some undo
work if no connection established after some timeout).
But if I even don't have runned ZooKeeper instance, there are no SIGPIPE.

I tried the following code:

use Net::ZooKeeper qw(:node_flags :acls :log_levels);
Net::ZooKeeper::set_log_level(ZOO_LOG_LEVEL_DEBUG);

$SIG{PIPE} = sub {
    print "AAAAAAAA\n";
    exit;
};

my $zkh = Net::ZooKeeper->new('localhost:2181',
    session_timeout => 2 * 1000,
);

my $err = $zkh->get_error();
print "ERROR: $err\n";

while (1) {
}

Output:
tadam@lucid64:~$ perl zookeeper_test.pl
2011-08-12 19:54:30,262:27316(0x7f6ae238a700):ZOO_INFO@log_env@658: Client
environment:zookeeper.version=zookeeper C client 3.3.3
2011-08-12 19:54:30,262:27316(0x7f6ae238a700):ZOO_INFO@log_env@662: Client
environment:host.name=lucid64.feeds.yandex.net
2011-08-12 19:54:30,262:27316(0x7f6ae238a700):ZOO_INFO@log_env@669: Client
environment:os.name=Linux
2011-08-12 19:54:30,262:27316(0x7f6ae238a700):ZOO_INFO@log_env@670: Client
environment:os.arch=2.6.24-23-openvzyandex
2011-08-12 19:54:30,262:27316(0x7f6ae238a700):ZOO_INFO@log_env@671: Client
environment:os.version=#2 SMP Fri Apr 24 18:54:48 MSD 2009
2011-08-12 19:54:30,262:27316(0x7f6ae238a700):ZOO_INFO@log_env@679: Client
environment:user.name=tadam
2011-08-12 19:54:30,274:27316(0x7f6ae238a700):ZOO_INFO@log_env@687: Client
environment:user.home=/home/tadam
2011-08-12 19:54:30,274:27316(0x7f6ae238a700):ZOO_INFO@log_env@699: Client
environment:user.dir=/home/tadam
2011-08-12 19:54:30,274:27316(0x7f6ae238a700):ZOO_INFO@zookeeper_init@727:
Initiating client connection, host=localhost:2181 sessionTimeout=2000
watcher=(nil) sessionId=0 sessionPasswd=<null> context=(nil) flags=0
2011-08-12 19:54:30,274:27316(0x7f6ae238a700):ZOO_DEBUG@start_threads@152:
starting threads...
2011-08-12 19:54:30,274:27316(0x7f6ade439700):ZOO_DEBUG@do_io@279: started
IO thread
2011-08-12 19:54:30,274:27316(0x7f6addc38700):ZOO_DEBUG@do_completion@326:
started completion thread
ERROR: 0
2011-08-12
19:54:30,274:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:30,937:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:31,607:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:32,277:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:32,947:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:33,617:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:34,287:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:34,957:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:35,627:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
2011-08-12
19:54:36,297:27316(0x7f6ade439700):ZOO_ERROR@handle_socket_error_msg@1579:
Socket [127.0.0.1:2181] zk retcode=-4, errno=111(Connection refused): server
refused to accept the client
...

So, driver understand that there is no connection, but there is no signal
about this. How I can catch this event?

Net::ZooKeeper: 0.35,
ZooKeeper: 3.3.3,
perl: v5.10.1 (*) built for x86_64-linux-gnu-thread-multi,
OS: Ubuntu Lucid,

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message