On Thu, Dec 2, 2021 at 5:07 AM t4k30ff <[email protected]>
wrote:

> Is this a bug?
>

I believe so. Most likely the thread calling `onOffline` is running under
some user’s authentication (or “anonymous”) and that user lacks read
permission to some jobs. Add a `Thread.dumpStack();` call to your listener
to find out. If the stack trace starts with some HTTP handler thread, then
this is likely the culprit. The workaround would be to wrap your call to
`getAllItems` in `ACL.as(ACL.SYSTEM)` (`ACL.as2(ACL.SYSTEM2)` with a newish
Jenkins baseline); if that indeed fixes the problem, you should file a bug
for Jenkins core.

Feel free to offer a fix too; basically any call to any listener method
ought to be run as `SYSTEM[2]` if there is any chance the calling thread
might otherwise have been using a non-system identity. (It is also good
practice to make calls to listener methods catch and log exceptions, so
that bugs in listener implementations do not break other functionality.)

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3edU_vRzeHmneZJtWXWq2YM_4eck10HNRUc5ZpdpFL1Q%40mail.gmail.com.

Reply via email to