Issue 2809: Exceptions from plugins listening to PatchSetCreatedEvent causes gerrit to incorrectly report reject.
Status:  New
Owner: ----
Reported by dwx1...@gmail.com, Aug 1, 2014
************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

Affected Version: 2.9

What steps will reproduce the problem?
1. Write a plugin which extends ChangeListener, but throws an exception on PatchSetCreatedEvents
2. Load plugin successfully into Gerrit
3. Push a new changeset to gerrit

What is the expected output? What do you see instead?

The plugin threw an exception, which should be isolated from the rest of gerrit. Instead, messages will fail to send, further PatchsetCreated hooks also do not fire, and the user will see a remote rejected, internal server error message. However, looking at Changes screen shows patchset was successfully created, with no problems.

Please provide any additional information below.

Something similar was found for the ref_updated hook, see https://gerrit-review.googlesource.com/#/c/49727/.
However, it seems that it was not carried over to the newer extension points.
In particular, the fireEventForUnrestrictedListeners() method in ChangeHookRunner is not checked for exceptions, leading to problems. 
Attached a minimum plugin to replicate it.
bug.tar.gz
1.5 KB   Download