-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent #1855
Conversation
AFAIK your watcher should never be null. (Without a watcher you don't know if you are even connected to ZK or not... the successful connection and also the disconnection events reach the ZK client user through the watcher.) Previously we were throwing exception in this watcher==null case, and this was not not too bad, as most likely this is not how the caller app wanted to start the ZooKeeper client in the first place. Although NPE might not the right exception to throw :) So my point here is: Isn't this change breaking compatibility? Shouldn't we throw at least some InvalidStateException after logging? |
I agree with Mate. |
563b372
to
245d55c
Compare
I checked the zk client code carefully, NPE will occur only when watcher is set null either throw ZooKeeper constructor or through register method. Now I think we should do the exactly what had been submitted in latest ZOOKEEPER-1875.patch. Updated the PR. |
245d55c
to
12f44d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks some of our tests violate this rule. Can you take a look and maybe switch these to some noop watcher?
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] QuorumDigestTest.testDigestMatchesDuringDiffSync:88->triggerSync:220->triggerOps:207 » IllegalArgument
[ERROR] QuorumDigestTest.testDigestMatchesDuringSnapSync:96->triggerSync:220->triggerOps:207 » IllegalArgument
[ERROR] QuorumDigestTest.testDigestMismatchesWhenTxnLost:173->triggerOps:207 » IllegalArgument
[ERROR] ObserverMasterTest.testInOrderCommits:216 » IllegalArgument Invalid Watcher, s...
[ERROR] ObserverMasterTest.testInOrderCommits:216 » IllegalArgument Invalid Watcher, s...
[INFO]
[ERROR] Tests run: 2983, Failures: 0, Errors: 5, Skipped: 4
Corrected impacted test cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!!
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes #1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent (cherry picked from commit 86690ff) Signed-off-by: Mohammad Arshad <arshad@apache.org>
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes #1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent (cherry picked from commit 86690ff) Signed-off-by: Mohammad Arshad <arshad@apache.org>
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes #1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent (cherry picked from commit 86690ff) Signed-off-by: Mohammad Arshad <arshad@apache.org>
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes apache#1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent
…sEvent (#56) Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes apache#1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent Co-authored-by: Mohammad Arshad <arshad@apache.org>
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes apache#1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent
…sEvent (#23) Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes apache#1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent Co-authored-by: Mohammad Arshad <arshad@apache.org>
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes apache#1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent (cherry picked from commit 86690ff) Signed-off-by: Mohammad Arshad <arshad@apache.org>
…sEvent Author: Mohammad Arshad <arshad@apache.org> Reviewers: Mate Szalay-Beko <symat@apache.org>, Enrico Olivelli <eolivelli@apache.org> Closes apache#1855 from arshadmohammad/ZOOKEEPER-1875-npe and squashes the following commits: 4a7d471 [Mohammad Arshad] Corrected impacted test cases 12f44d6 [Mohammad Arshad] ZOOKEEPER-1875: NullPointerException in ClientCnxn$EventThread.processEvent (cherry picked from commit 86690ff) Signed-off-by: Mohammad Arshad <arshad@apache.org>
No description provided.