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 A7ED6200C17 for ; Fri, 10 Feb 2017 10:45:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A6842160B5C; Fri, 10 Feb 2017 09:45:47 +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 EFBC0160B5B for ; Fri, 10 Feb 2017 10:45:46 +0100 (CET) Received: (qmail 53966 invoked by uid 500); 10 Feb 2017 09:45:46 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 53955 invoked by uid 99); 10 Feb 2017 09:45:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2017 09:45:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 65EC1C346A for ; Fri, 10 Feb 2017 09:45:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id IDjXbAJSS0DZ for ; Fri, 10 Feb 2017 09:45:44 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 61B355FE3A for ; Fri, 10 Feb 2017 09:45:44 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1F9DEE060F for ; Fri, 10 Feb 2017 09:45:43 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2661A21D6D for ; Fri, 10 Feb 2017 09:45:42 +0000 (UTC) Date: Fri, 10 Feb 2017 09:45:42 +0000 (UTC) From: "Corentin Chary (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-13159) Coalescing strategy can enter infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 10 Feb 2017 09:45:47 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-13159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15861000#comment-15861000 ] Corentin Chary commented on CASSANDRA-13159: -------------------------------------------- LGTM > Coalescing strategy can enter infinite loop > ------------------------------------------- > > Key: CASSANDRA-13159 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13159 > Project: Cassandra > Issue Type: Bug > Components: Streaming and Messaging > Reporter: Corentin Chary > Assignee: Corentin Chary > Fix For: 3.0.11, 2.1.x, 2.2.x, 3.11.x > > > {code}boolean maybeSleep(int messages, long averageGap, long maxCoalesceWindow, Parker parker){code} > maybeSleep() can enter an infinite loop if messages or averageGap ends up being 0 because sleep will be 0 and the while loop will never exit. I've noticed that on one of my clusters twice this week. > This can happen if in averageGap() sum is bigger than MEASURED_INTERVAL, which should be pretty rare but apparently happen to me. > Even if the diagnostic is wrong (and I'm pretty sure that this thread was using 100% CPU doing nothing), the fix seems pretty safe to apply. > {code} > diff --git a/src/java/org/apache/cassandra/utils/CoalescingStrategies.java b/src/java/org/apache/cassandra/utils/CoalescingStrategies.java > index 0aa980f..982d4a6 100644 > --- a/src/java/org/apache/cassandra/utils/CoalescingStrategies.java > +++ b/src/java/org/apache/cassandra/utils/CoalescingStrategies.java > @@ -100,7 +100,7 @@ public class CoalescingStrategies > { > // only sleep if we can expect to double the number of messages we're sending in the time interval > long sleep = messages * averageGap; > - if (sleep > maxCoalesceWindow) > + if (!sleep || sleep > maxCoalesceWindow) > return false; > > // assume we receive as many messages as we expect; apply the same logic to the future batch: > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)