Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1BFD6200BB6 for ; Fri, 21 Oct 2016 07:53:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1A7A1160AF2; Fri, 21 Oct 2016 05:53:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3B71E160AE0 for ; Fri, 21 Oct 2016 07:53:01 +0200 (CEST) Received: (qmail 90206 invoked by uid 500); 21 Oct 2016 05:52:59 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 90185 invoked by uid 99); 21 Oct 2016 05:52:58 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Oct 2016 05:52:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1EAD7180647 for ; Fri, 21 Oct 2016 05:52:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id omJ4ioAqvYm1 for ; Fri, 21 Oct 2016 05:52:55 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 2D1DA5FADA for ; Fri, 21 Oct 2016 05:52:55 +0000 (UTC) Received: by mail-lf0-f52.google.com with SMTP id b75so124664800lfg.3 for ; Thu, 20 Oct 2016 22:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:message-id:date:user-agent:mime-version; bh=g/XhqwIYTftOR/x17ASdkF2YK4pWNEd7qoe/n91S7Mg=; b=AczCYQOZvxinPPlZJShqsnB2zk0+X8FiYBfiBjfnqh9mxBOUIqnpLO1KGczXdnLJ7G 731xn+VDtQcgsgCXxEB22qgn6SPjrGrmVLVz4hQcJdR1FFeQiAk84niEnrVER3dVf+Yu kNtgxH2QxBmf0jLRq0GXGdnaDTNit7C+GpwjXyl5E+E/+32vkbMfBzW6Km0zi4vaYcqF s4HfyEKn1Gi26oDM761uhPCFMz2V1xrixH+I0U9FQYc0KS7DZNgfBt60E7U4zgbxyXDp HGEa96ZHDl+5oi6eqY2pGBxM+D1pr/tMS29pJ92Dqw3lurn3++DL1HcnUlDx0Q/XFwFo qZCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version; bh=g/XhqwIYTftOR/x17ASdkF2YK4pWNEd7qoe/n91S7Mg=; b=Sw7Et6+NapjGuqP7dmN79DdSTiN/wGaXrMZLI1bE4Ogz9z0KrEfjchTqmrDWYUBCf1 EqbX/UX/ZJ++oycpfXjnyRNjYNuWiBz6iYmO0af6BwjiPhNwiA0Q1otY6PvdCxGotzlQ vSpFfGKZXoRDA4eGkIDPNw7HpBIDoMZD4kl9ARow6hlmKXpXmY81HMZ9XyGCrUX3z8/d S5UDpiPXh4sPN9ElOmt4tNMOFfEkF3kJe5f908ds+1YD0bz1yCgxazWCtewgJ5zSkuxO eFQ8EqgA+My2VF0jqGQS04xctYnZiocrDw/TdqzHiCAO+0C05OmOQJI56pHijK16ts7A UpKQ== X-Gm-Message-State: AA6/9RmeA32ejVmVSe4FarsP/leBljIr4JqjUSgBBPNErjaEPvM/Wq0mpo61QPwMvSzreA== X-Received: by 10.28.38.2 with SMTP id m2mr8637880wmm.102.1477029174298; Thu, 20 Oct 2016 22:52:54 -0700 (PDT) Received: from newton.local (gumbley.plus.com. [84.92.58.245]) by smtp.googlemail.com with ESMTPSA id kq7sm1042179wjb.0.2016.10.20.22.52.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 22:52:53 -0700 (PDT) From: Matt Gumbley Subject: Problem with initial use of callback methods in avro-ipc 1.8.1 To: user@avro.apache.org Message-ID: <5809AD3A.4030406@gmail.com> Date: Fri, 21 Oct 2016 06:52:58 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------090009000800080606030509" archived-at: Fri, 21 Oct 2016 05:53:02 -0000 This is a multi-part message in MIME format. --------------090009000800080606030509 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi, I'm using Avro-IPC 1.8.1 and also the current master branch. Java 1.7.0_75, OSX El Capitan. Using a NettyTransceiver. I'm trying to use callbacks in remote method calls(*) so that I can timeout if the remote side does not reply, and have run into a problem: the first remote method call I make (with a CallFuture) always blocks for the entire duration of the call; it does not return immediately allowing me to await for my timeout duration. However, once connected, and the handshake has been performed, subsequent calls successfully allow me to await the completion of the CallFuture. I've traced this to Requestor::request : /** Writes a request message and returns the result through a Callback. */ void request(Request request, Callback callback) throws Exception { ... where there is an initial section performing a handshake if not connected, and performing a transceive that then blocks without timeout: CallFuture callFuture = new CallFuture(callback); t.transceive(request.getBytes(), new TransceiverCallback(request, callFuture)); // Block until handshake complete callFuture.await(); Subsequent calls (once connected) reach a different part of the request method: if (request.getMessage().isOneWay()) { ... } else { t.transceive(request.getBytes(), new TransceiverCallback(request, callback)); } ... which returns immediately after sending, allowing me to await. Is there a mechanism I'm missing that can establish the connection and perform the handshake without me making remote method calls? Could a handshake timeout be added to Requestor, that is used in the above callFuture.await() ? I could add a kludgey no-op one-way method to each protocol I define, that I call before anything else - this could still block though. (*) There doesn't seem to be a mechanism for providing a timeout for *all* remote method invocations, without supplying my own CallFuture to each call - so I have a dynamic proxy with which I can set a global timeout on all method calls, this then dispatches non-callback method invocations to their callback-supplying variants, with a CallFuture that the invoke method awaits on, for the global timeout duration. I'm happy to contribute this to the project, if it would be useful, or work it into the Requestor. Kind regards, Matt Gumbley --------------090009000800080606030509 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi,
I'm using Avro-IPC 1.8.1 and also the current master branch. Java 1.7.0_75, OSX El Capitan. Using a NettyTransceiver.

I'm trying to use callbacks in remote method calls(*) so that I can timeout if the remote side does not reply, and have run into a problem: the first remote method call I make (with a CallFuture) always blocks for the entire duration of the call; it does not return immediately allowing me to await for my timeout duration. However, once connected, and the handshake has been performed, subsequent calls successfully allow me to await the completion of the CallFuture.

I've traced this to Requestor::request :

  /** Writes a request message and returns the result through a Callback. */
  <T> void request(Request request, Callback<T> callback)
    throws Exception {

... where there is an initial section performing a handshake if not connected, and performing a transceive that then blocks without timeout:

          CallFuture<T> callFuture = new CallFuture<T>(callback);
          t.transceive(request.getBytes(),
                       new TransceiverCallback<T>(request, callFuture));
          // Block until handshake complete
          callFuture.await();

Subsequent calls (once connected) reach a different part of the request method:
    if (request.getMessage().isOneWay()) {
       ...
    } else {
       t.transceive(request.getBytes(),
                   new TransceiverCallback<T>(request, callback));
    }

... which returns immediately after sending, allowing me to await.


Is there a mechanism I'm missing that can establish the connection and perform the handshake without me making remote method calls?
Could a handshake timeout be added to Requestor, that is used in the above callFuture.await() ?

I could add a kludgey no-op one-way method to each protocol I define, that I call before anything else - this could still block though.

(*) There doesn't seem to be a mechanism for providing a timeout for *all* remote method invocations, without supplying my own CallFuture to each call - so I have a dynamic proxy with which I can set a global timeout on all method calls, this then dispatches non-callback method invocations to their callback-supplying variants, with a CallFuture that the invoke method awaits on, for the global timeout duration. I'm happy to contribute this to the project, if it would be useful, or work it into the Requestor.


Kind regards,
Matt Gumbley
--------------090009000800080606030509--