Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64C5B10024 for ; Mon, 9 Sep 2013 14:17:50 +0000 (UTC) Received: (qmail 36327 invoked by uid 500); 9 Sep 2013 14:17:40 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 36049 invoked by uid 500); 9 Sep 2013 14:17:40 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 36041 invoked by uid 99); 9 Sep 2013 14:17:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Sep 2013 14:17:39 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.n.gale@gmail.com designates 209.85.219.43 as permitted sender) Received: from [209.85.219.43] (HELO mail-oa0-f43.google.com) (209.85.219.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Sep 2013 14:17:34 +0000 Received: by mail-oa0-f43.google.com with SMTP id i10so6536483oag.16 for ; Mon, 09 Sep 2013 07:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=VAtr94fpAkacKqbD3/o309wwjGvv873prL+CSHIMIro=; b=afVl9cq+poFmVIvagSufZATCMr1SJH8Eb7cy36dec45cT6VwDu4ZXpk/suw/bVCfbd Nwrwq/zZURxexdpvhZEd5Sr1Rxf6s2oZ8mOyr1aenqO9s2RRWKdrkdAQZivJdreAC9GG H1xny4mxr/BHFo5VJUkEf1ihJp0mV3t1OS5Clo3iMl05RnUEqzdADVQTlPZ/ArT2VOyy FdpZvNHBSZ00THHpVhWvYS8A6qMHgX0q5Tue8zQLsV01rii8gG2Moj9L5FtzJ9A/5TLs IoVqDN4fiyt6lxVDqYbAInUdhSnd1ckIV96J+j0j4jpOOAeqI4LtDeCquzNKKGI+SMGK 9XNA== X-Received: by 10.182.61.104 with SMTP id o8mr11146979obr.59.1378736233148; Mon, 09 Sep 2013 07:17:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.38.10 with HTTP; Mon, 9 Sep 2013 07:16:43 -0700 (PDT) In-Reply-To: References: From: Paul Gale Date: Mon, 9 Sep 2013 10:16:43 -0400 Message-ID: Subject: Re: [jira] [Issue Comment Deleted] (AMQ-4710) The first heart-beat after a connection becomes idle isn't sent as quickly as it should be To: dev Content-Type: multipart/alternative; boundary=e89a8fb1ef6a6a7c0304e5f40bf2 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8fb1ef6a6a7c0304e5f40bf2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable If any of the ActiveMQ committers could take a look at my patch for this Jira issue I would really appreciate the feedback as I'd like to incorporate it into 5.8.0. Thanks, Paul On Mon, Sep 9, 2013 at 10:13 AM, Paul Gale (JIRA) wrote: > > [ > https://issues.apache.org/jira/browse/AMQ-4710?page=3Dcom.atlassian.jira.= plugin.system.issuetabpanels:all-tabpanel] > > Paul Gale updated AMQ-4710: > --------------------------- > > Comment: was deleted > > (was: Updated patch containing fix for Jira AMQ-4710. Improved the > checking for when to recreate the write checker timer task. Previous patc= h > attachment has been deleted.) > > > The first heart-beat after a connection becomes idle isn't sent as > quickly as it should be > > > -------------------------------------------------------------------------= ----------------- > > > > Key: AMQ-4710 > > URL: https://issues.apache.org/jira/browse/AMQ-4710 > > Project: ActiveMQ > > Issue Type: Bug > > Components: stomp > > Affects Versions: 5.8.0 > > Reporter: Andy Wilkinson > > Attachments: amq-4710.diff > > > > > > After ActiveMQ sends a stomp frame, it may not send a heart-beat for up > to almost 2x the negotiated interval. > > The following test should illustrate the problem: > > {code} > > import org.junit.Test; > > import static org.junit.Assert.*; > > public class ActiveMqHeartbeatTests { > > @Test > > public void heartbeats() throws Exception { > > BrokerService broker =3D createAndStartBroker(); > > Socket socket =3D null; > > try { > > socket =3D new Socket("localhost", 61613); > > byte[] connectFrame =3D > "CONNECT\nheart-beat:0,10000\naccept-version:1.2\n\n\0".getBytes(); > > socket.getOutputStream().write(connectFrame); > > byte[] buffer =3D new byte[4096]; > > long lastReadTime =3D System.currentTimeMillis(); > > while (true) { > > int read =3D > socket.getInputStream().read(buffer); > > byte[] frame =3D Arrays.copyOf(buffer, re= ad); > > long now =3D System.currentTimeMillis(); > > long timeSinceLastRead =3D now - > lastReadTime; > > lastReadTime =3D now; > > System.out.println(new String(frame)); > > System.out.println("Time since last read: > " + timeSinceLastRead + "ms"); > > if (timeSinceLastRead > 15000) { > > fail("Data not received for " + > timeSinceLastRead + "ms"); > > } > > } > > } finally { > > if (socket !=3D null) { > > socket.close(); > > } > > broker.stop(); > > } > > } > > private BrokerService createAndStartBroker() throws Exception { > > BrokerService broker =3D new BrokerService(); > > broker.addConnector("stomp://localhost:61613"); > > broker.setStartAsync(false); > > broker.setDeleteAllMessagesOnStartup(true); > > broker.start(); > > return broker; > > } > > } > > {code} > > For the initial read of the CONNECTED frame I see: > > {noformat} > > Time since last read: 49ms > > {noformat} > > However, it's then almost 20 seconds before a heart-beat's sent: > > {noformat} > > Time since last read: 19994ms > > {noformat} > > If I comment out the fail(=E2=80=A6) line in the test, after the first = heartbeat > taking almost 20000ms to be sent, things settle down and a heartbeat's > received every 10000ms. > > It looks like the write checker wakes up every 10000ms. The first time > it wakes up, it notices that the CONNECTED frame was sent and does nothin= g. > It then sleeps for a further 10000ms before checking again. As the > CONNECTED frame was sent very early in the first 10000ms window, this lea= ds > to it taking almost 20000ms for the first heart-beat to be sent. From thi= s > point, as no further data frames are sent, the write checker wakes up and > sends a heart-beat every 10000ms. > > In short, I don't think ActiveMQ is adhering to the requirement that > "the sender MUST send new data over the network connection at least every > milliseconds". > > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA > administrators > For more information on JIRA, see: http://www.atlassian.com/software/jira > --e89a8fb1ef6a6a7c0304e5f40bf2--