Hi All, In my application I make heavy use of Apache Phoenix's Cursors (https://phoenix.apache.org/cursors.html) - and for the majority of cases it works great and makes my life a lot easier (thanks for implementing them). However, in very rare cases (fiendishly rare cases), I get NullpointerExceptions such as the following:
java.lang.NullPointerException: null at org.apache.phoenix.util.CursorUtil.updateCursor(CursorUtil.java:179) at org.apache.phoenix.iterate.CursorResultIterator.next(CursorResultIterator.java:46) at org.apache.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:779) (This is for 4.13.1 - but seems that org.apache.phoenix.util.CursorUtil has not changed much since it was first created). Upon closer inspection it would seem that on line 124 of CursorUtil, a HashMap is used to keep state which is then exposed via a number static methods, which, one has to assume, can be accessed by many different threads. Using a plain old HashMap in cases like these have (at least in my experience) been to blame for rare issues such as these. Would you perhaps consider changing the implementation of mapCursorIDQuery to a ConcurrentHashMap instead? That should hopefully tighten up the class and prevent any potential inconsistencies. Regards, Jack Steenkamp
