Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-8592

Hang in SetCacheListener

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • native client
    • None

    Description

      As reported on StackOverflow (https://stackoverflow.com/questions/64045931/repeated-ui-calls-to-geode-native-client-attributesmutator-setcachelistener), this looks like a bug with AttributesMutator when setting multiple CacheListeners.

       

      Direct from SO:

      If I have a button on a UI that registers a listener, sync not async, and click it several times, then repeatedly setting listeners on a region hangs:

      Cache c is already initialized. This is using the C# Geode Native Client.

      IRegion<string, Object> d = c.GetRegion<string, Object>("deal");
      
      try
      {
           Logs.Trace("Registering key"); d.GetSubscriptionService().RegisterKeys(s); 
           d.AttributesMutator.SetCacheListener(new LDeal<string, Object>(c, AddDeal));
      }
      
      catch (Exception ex)
      {
           new ApplicationException("Can't register key: " + clOrdId, ex);
      }
      

      Is this an optimal way to set a listener on a region? If it's going to hang how can I have a timeout so that setting a listener is better managed?

      UPDATE: using async / await appears to resolve this issue, so that the SetCacheListener becomes

       await Task.Run(() => d.AttributesMutator.SetCacheListener(
           new LDeal<string, Object>(c, AddDeal)));
       

      except that later unregistering a listener

      await Task.Run(() => r.GetSubscriptionService().UnregisterKeys(s));
      

      always gives a silent error (with apparently no impact)

      Apache.Geode.Client.IllegalStateException: : illegal State --->
      Apache.Geode.Client.GeodeException: 0# 0x00007FF844136B85 in Apache_Geode
      1# 0x00007FF844136C5D in Apache_Geode
      2# 0x00007FF8441CCC1E in Apache_Geode
      3# 0x00007FF84424EB41 in Apache_Geode
      4# 0x00007FF8441E5557 in Apache_Geode
      5# 0x00007FF85FCA87E

      Attachments

        Activity

          People

            Unassigned Unassigned
            mmartell Michael Martell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: