Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30E5184D1 for ; Fri, 12 Aug 2011 16:03:03 +0000 (UTC) Received: (qmail 34173 invoked by uid 500); 12 Aug 2011 16:03:02 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 34090 invoked by uid 500); 12 Aug 2011 16:03:02 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 34077 invoked by uid 99); 12 Aug 2011 16:03:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 16:03:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yury.zavarin@gmail.com designates 209.85.210.172 as permitted sender) Received: from [209.85.210.172] (HELO mail-iy0-f172.google.com) (209.85.210.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 16:02:55 +0000 Received: by iye7 with SMTP id 7so3669896iye.3 for ; Fri, 12 Aug 2011 09:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=+300Mh88Z/WtrcbiUVzPuJwGfthpBs7wKaKXjH0qyXI=; b=ao8QFuTg0aV2gKBQ52oCt+IHUhugSto/tpTVBdDoWtU7YJ6zAPqzdxGtpA4n3bEL8e 5K7Nq4k7fUrcwFBcLk9S4wxT69GibOBLMTKUJJX4IpVFgX8TOQADElAHNkSOQDhbTJDy GBtY+x4BUXB9s/xymxYHqf8FW69lnEjWbyFZc= MIME-Version: 1.0 Received: by 10.42.19.66 with SMTP id a2mr1070791icb.4.1313164954381; Fri, 12 Aug 2011 09:02:34 -0700 (PDT) Received: by 10.42.189.137 with HTTP; Fri, 12 Aug 2011 09:02:34 -0700 (PDT) Date: Fri, 12 Aug 2011 20:02:34 +0400 Message-ID: Subject: connection loss in Net::ZooKeeper (perl driver) From: Yury Zavarin To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=20cf3040ee64a32d5f04aa510a3b X-Virus-Checked: Checked by ClamAV on apache.org --20cf3040ee64a32d5f04aa510a3b Content-Type: text/plain; charset=UTF-8 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= 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, --20cf3040ee64a32d5f04aa510a3b--