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

Zili Chen updated CURATOR-609:
------------------------------
    Description: 
When using the ModeledCache implementation, when a ZPath is deleted the 
implementation assumes that all ZNodes in the path contain a valid instance of 
the Model.

If intermediary paths have been created that do not contain a Model, the 
implementation is calling the Jackson deserialize method with null data, 
resulting in an exception.

Instead, the code should ensure there is valid data present prior to attempting 
to deserialize and call the "accept()" (callback) method on action NODE_REMOVED.

Example:

TestModel child1 = new TestModel("d", "e", "f", 1, BigInteger.ONE);
 ZPath path1 = path.child("foo").child("bar").child("child1");

try (CachedModeledFramework<TestModel> client = ModeledFramework.wrap(async, 
modelSpec).cached())

{    CountDownLatch latch = new CountDownLatch(1);    
client.listenable().addListener((t, p, s, m) -> latch.countDown());    
client.start();    complete(client.withPath(path1).set(child1));    
assertTrue(timing.awaitLatch(latch));    assertDoesNotThrow(() -> 
rawClient.delete().deletingChildrenIfNeeded().forPath(path.toString())); }

After calling "delete()", an exception is thrown:

ERROR 
org.apache.curator.x.async.modeled.TestCachedModeledFramework$$Lambda$409/0x0000000800e0c850
 Could not process cache message [Curator-SafeNotifyService-0]
 java.lang.IllegalArgumentException: argument "src" is null
 at 
com.fasterxml.jackson.databind.ObjectReader._assertNotNull(ObjectReader.java:2120)

 

 

  was:
# When using the ModeledCache implementation, when a ZPath is deleted the 
implementation assumes that all ZNodes in the path contain a valid instance of 
the Model.

If intermediary paths have been created that do not contain a Model, the 
implementation is calling the Jackson deserialize method with null data, 
resulting in an exception.

Instead, the code should ensure there is valid data present prior to attempting 
to deserialize and call the "accept()" (callback) method on action NODE_REMOVED.

Example:

TestModel child1 = new TestModel("d", "e", "f", 1, BigInteger.ONE);
 ZPath path1 = path.child("foo").child("bar").child("child1");

try (CachedModeledFramework<TestModel> client = ModeledFramework.wrap(async, 
modelSpec).cached())

{    CountDownLatch latch = new CountDownLatch(1);    
client.listenable().addListener((t, p, s, m) -> latch.countDown());    
client.start();    complete(client.withPath(path1).set(child1));    
assertTrue(timing.awaitLatch(latch));    assertDoesNotThrow(() -> 
rawClient.delete().deletingChildrenIfNeeded().forPath(path.toString())); }

After calling "delete()", an exception is thrown:

ERROR 
org.apache.curator.x.async.modeled.TestCachedModeledFramework$$Lambda$409/0x0000000800e0c850
 Could not process cache message [Curator-SafeNotifyService-0]
 java.lang.IllegalArgumentException: argument "src" is null
 at 
com.fasterxml.jackson.databind.ObjectReader._assertNotNull(ObjectReader.java:2120)

 

 


> ModeledCache attempts to deserialize empty ZNodes on deletion, resulting in 
> exceptions
> --------------------------------------------------------------------------------------
>
>                 Key: CURATOR-609
>                 URL: https://issues.apache.org/jira/browse/CURATOR-609
>             Project: Apache Curator
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 5.1.0
>            Reporter: Ryan Ruel
>            Priority: Major
>             Fix For: 5.5.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> When using the ModeledCache implementation, when a ZPath is deleted the 
> implementation assumes that all ZNodes in the path contain a valid instance 
> of the Model.
> If intermediary paths have been created that do not contain a Model, the 
> implementation is calling the Jackson deserialize method with null data, 
> resulting in an exception.
> Instead, the code should ensure there is valid data present prior to 
> attempting to deserialize and call the "accept()" (callback) method on action 
> NODE_REMOVED.
> Example:
> TestModel child1 = new TestModel("d", "e", "f", 1, BigInteger.ONE);
>  ZPath path1 = path.child("foo").child("bar").child("child1");
> try (CachedModeledFramework<TestModel> client = ModeledFramework.wrap(async, 
> modelSpec).cached())
> {    CountDownLatch latch = new CountDownLatch(1);    
> client.listenable().addListener((t, p, s, m) -> latch.countDown());    
> client.start();    complete(client.withPath(path1).set(child1));    
> assertTrue(timing.awaitLatch(latch));    assertDoesNotThrow(() -> 
> rawClient.delete().deletingChildrenIfNeeded().forPath(path.toString())); }
> After calling "delete()", an exception is thrown:
> ERROR 
> org.apache.curator.x.async.modeled.TestCachedModeledFramework$$Lambda$409/0x0000000800e0c850
>  Could not process cache message [Curator-SafeNotifyService-0]
>  java.lang.IllegalArgumentException: argument "src" is null
>  at 
> com.fasterxml.jackson.databind.ObjectReader._assertNotNull(ObjectReader.java:2120)
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to