[ 
https://issues.apache.org/jira/browse/GEODE-8592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Martell updated GEODE-8592:
-----------------------------------
    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:

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

{code:C#}
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);
}
{code}

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
{code:C#}
 await Task.Run(() => d.AttributesMutator.SetCacheListener(
     new LDeal<string, Object>(c, AddDeal)));
 {code}
except that later unregistering a listener
{code:C#}
await Task.Run(() => r.GetSubscriptionService().UnregisterKeys(s));
{code}
always gives a silent error (with apparently no impact)
{panel}
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
{panel}


  was:
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:

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

{code:C#}
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); }

}}
{code:C#}

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
{code:java}
 

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

{{}}
{code:java}
 {code}
{{}}


> Hang in SetCacheListener
> ------------------------
>
>                 Key: GEODE-8592
>                 URL: https://issues.apache.org/jira/browse/GEODE-8592
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Michael Martell
>            Priority: Minor
>
> 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:
> A {{Cache c}} is already initialized. This is using the C# Geode Native 
> Client.
> {code:C#}
> 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);
> }
> {code}
> 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
> {code:C#}
>  await Task.Run(() => d.AttributesMutator.SetCacheListener(
>      new LDeal<string, Object>(c, AddDeal)));
>  {code}
> except that later unregistering a listener
> {code:C#}
> await Task.Run(() => r.GetSubscriptionService().UnregisterKeys(s));
> {code}
> always gives a silent error (with apparently no impact)
> {panel}
> 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
> {panel}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to