curator icon indicating copy to clipboard operation
curator copied to clipboard

CURATOR-609 - ModeledCache attempts to deserialize empty ZNodes on deletion, resulting in exceptions

Open Ryan0751 opened this issue 4 years ago • 1 comments

On event type NODE_REMOVED, an additional check was added to ensure that the ZNode actually contains data before attempting to deserialize it into a model.

If no model is present for the ZNode, the accept callback is not called (as this is not a valid ModeledFramework object).

This is already accounted for with events NODE_ADDED/NODE_UPDATED, as there was already a check for null data in the node.

Note: Triggering this bug via a unit test is quite easy, however detecting it is difficult as the exception is thrown by a Curator sub-thread. Therefore I did not add a matching unit test (though ensured all existing unit tests pass).

Ryan0751 avatar Aug 05 '21 15:08 Ryan0751

This issue was targeted 5.2.1 I am postponing to 5.2.2, I am sorry

eolivelli avatar Mar 14 '22 08:03 eolivelli

@Ryan0751 Any interest to continue this ? I think you can construct a test with ModeledCacheListener.handleException. TestCachedModeledFramework should be the right place. I can take care of it in case you are not available. We are evaluating this and plan to conclude (merge or not) this before next release.

kezhuw avatar Apr 06 '23 15:04 kezhuw

I will take another look!

Ryan0751 avatar Apr 07 '23 11:04 Ryan0751

I have gone ahead and added a unit test for this.

Ryan0751 avatar Apr 08 '23 12:04 Ryan0751

Thanks for your contribution @Ryan0751! It reminds me of one of my PRs merged after two years in apache/flink 🤣

tisonkun avatar Apr 11 '23 14:04 tisonkun

Merging...

Thank you @Ryan0751!

tisonkun avatar Apr 12 '23 02:04 tisonkun