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 5D293200C2F for ; Mon, 6 Mar 2017 20:56:45 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 5B829160B76; Mon, 6 Mar 2017 19:56:45 +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 7D1B0160B66 for ; Mon, 6 Mar 2017 20:56:44 +0100 (CET) Received: (qmail 66716 invoked by uid 500); 6 Mar 2017 19:56:43 -0000 Mailing-List: contact dev-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list dev@geode.apache.org Received: (qmail 66704 invoked by uid 99); 6 Mar 2017 19:56:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Mar 2017 19:56:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id B0A811AA2EE for ; Mon, 6 Mar 2017 19:56:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.78 X-Spam-Level: * X-Spam-Status: No, score=1.78 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=pivotal-io.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id WJcWsEHDjbE3 for ; Mon, 6 Mar 2017 19:56:40 +0000 (UTC) Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com [209.85.220.174]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1E97F5F23D for ; Mon, 6 Mar 2017 19:56:40 +0000 (UTC) Received: by mail-qk0-f174.google.com with SMTP id p64so53693399qke.1 for ; Mon, 06 Mar 2017 11:56:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=N1u7CJl2PLpWS4YGFAojCXBU9M/4/DgCU5aCwXPXPFc=; b=orUQr7K4YSV0SMgfP/VbV6LBAhqbivxr/CJo/2tiEeo83eHtto364Bs7nXLZucDvfD 4a242M2lwoQmycQztEz9B6hhCBCzpjlu5u6vyKlDXDCVfDbkKUVxfI+fZAzKqO69DlBC QCO8aG6WNC6sYageLCeDld7bVpIGU2mu5VI5IYI9J5AvSmM+vxjEGkMi3quPyDfLLlXn DLbbvHTiMmrLYgH8wNlqfEZb8Sqzco+25G2RfvbmfJmoAd19P+dPmXE856dIWuOXjZe7 cXoY84yhWjn8jXyGF7va/AaBAFT8ehcPs0TFX3jk3MZSPn8827vT8qmbFLXQDkyE9ES1 Qbyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=N1u7CJl2PLpWS4YGFAojCXBU9M/4/DgCU5aCwXPXPFc=; b=qK+FgVXncqy11+dj1S8fJGdNWEZ+Z3VKChPoIJ7WkcheDeWrqC/h8k+Dal333POlI4 nZflv0arsHIF7nWTP9WvSJCaPq+gV37IOCvif4ge5Mh3je7EE0VT4TMMRwIfK2gvHsuv 0dC49gi3oHuCGXuO6fjApa1u1C5gCu8smypCa3EpbUY6n3u8BZHgWuB3VCEmnAjxhZI2 eG1SVU5THbWQefek5wQ7g9+TFqGeWqtZV2UaL0e0D4KMyjyspFkJ81cayxd2I/Y1d+Ho VAh05W3jMYc0M73xhw01jLB9NhRbhGObyTPJ34Tgv5GKLQhMU5G03A/ytk8lzWm/I6Fh APhg== X-Gm-Message-State: AMke39n7TUwvWka9JtPbIrr4XE3BjUjndEZX77sTgkgA8IdkEnQGKWS0f7SeR4hh3qc/7/4LVPAXS4yPwpxKGrHq X-Received: by 10.200.39.41 with SMTP id g38mr19760067qtg.45.1488829867547; Mon, 06 Mar 2017 11:51:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.61.253 with HTTP; Mon, 6 Mar 2017 11:51:07 -0800 (PST) In-Reply-To: References: From: Darrel Schneider Date: Mon, 6 Mar 2017 11:51:07 -0800 Message-ID: Subject: Re: Gemfire proxy cache race condition bug? To: user@geode.apache.org Cc: dev@geode.apache.org, user@geode.incubator.apache.org, geode Content-Type: multipart/alternative; boundary=001a114032aa63026a054a15372f archived-at: Mon, 06 Mar 2017 19:56:45 -0000 --001a114032aa63026a054a15372f Content-Type: text/plain; charset=UTF-8 This is a known limitation of CacheListeners on a PROXY region. On other types of regions the local region entry that the operation is modifying is synchronized during the operation and during the CacheListener invocation. That is what the javadocs on the CacheListener calls "holding a lock on the entry." But since a PROXY region has none of its own state it has no local region entry to hold a lock on. The javadocs should be changed to mention this. Did you see this in some other place in the docs? Another thing to keep in mind is that even when the entry is locked during CacheListener invocation this does not guarantee a total ordering across the distributed system. In particular the events you receive on a client are async with those that occur on the server. You best bet is to use a CacheListener on the server side on a partitioned region. All the modify ops go through the single primary. Another odd thing about a PROXY is that "get" will call afterCreate on a listener on the proxy even when the get was a hit on the server. This is because our PROXY logic always looks at the local state (not the server state) when deciding on what CacheListener method to call. Ideally you would only have "get" deliver afterCreate when the "get" does a load. On Mon, Mar 6, 2017 at 8:55 AM, Michael Stolz wrote: > If you always do whatever processing you are planning to do inside the > CacheListener and use the "newValue" field that is supplied to that > callback you will always begin processing in the order the data was > received. I suppose if you want to ensure that you are completing > processing in the correct order you would need to synchronize on your > callback as you said. > > To "prime the pump" you can use get as you are now, or registerInterest > with a list of keys or wildcard on string-based keys. Register interest can > optionally deliver the initial value followed by all updates in the correct > order. > > > -- > Mike Stolz > Principal Engineer, GemFire Product Manager > Mobile: +1-631-835-4771 <(631)%20835-4771> > > On Sat, Mar 4, 2017 at 7:58 AM, David Wales > wrote: > >> Hi there, >> >> I have a client proxy cache with an associated cache listener. An >> invocation of the region get method will trigger the afterCreate callback. >> I realized this call back was on the same thread that called get and is >> different to the thread that dispatches the region updates. So I had a >> look >> at the code and there seems to be no synchronization. I could mark the >> cache listener methods as synchronized but this doesn't fully mitigate the >> race. How does one get the initial state of an entry in a region in a way >> that synchronizes with updates on. Is this a known limitation or a bug as >> the documentation talks about cache listener methods being mutually >> exclusive? >> >> Much appreciated >> Thank you >> David >> > > --001a114032aa63026a054a15372f--