DependencyTrack / dependency-track

Dependency-Track is an intelligent Component Analysis platform that allows organizations to identify and reduce risk in the software supply chain.
https://dependencytrack.org/
Apache License 2.0
2.46k stars 536 forks source link

NPE on notification using Email publisher #507

Closed RaphC closed 4 years ago

RaphC commented 4 years ago

Hi

Current Behavior:

I got a NPE while dependency-track try to notify after BOM processed

Steps to Reproduce:

Configure an smtp Add an alert (INFORMATIONAL on PORTOFOLIO) and then select BOM_PROCESSED Upload a BOM from the UI and wait analysis performed

Expected Behavior:

Received an email

Environment:

Additional Details:

Seems Email publisher attribute not set if I look at NotificationRouter.java:60 source code

final Class<?> publisherClass = Class.forName(rule.getPublisher().getPublisherClass());

image

Whereas slack, console, webhook, microsoft teams publihser are ok

image

Record in database seems ok

-----------------------------+ ID ENABLED MESSAGE NAME NOTIFICATION_LEVEL NOTIFY_ON PUBLISHER PUBLISHER_CONFIG SCOPE UUID +----+---------+---------+---------------------+--------------------+---------------+-----------+-------------------------------------------------+-----------+--------------------------------------+ 1 NULL swad-bom-processing INFORMATIONAL BOM_PROCESSED 3 {"destination":"xxxxxxxxxx"} PORTFOLIO 91ac7634-1214-477d-94d3-d82770c3a667

15:08:48.139 ERROR [LoggableUncaughtExceptionHandler] An unknown error occurred in an asynchronous event or notification thread java.lang.NullPointerException: null at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.dependencytrack.notification.NotificationRouter.inform(NotificationRouter.java:60) at alpine.notification.NotificationService.lambda$alertSubscriber$0(NotificationService.java:100) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

stevespringett commented 4 years ago

For some reason, the publisher is blank. I just tried with 3.6.1 and could not reproduce.

Screen Shot 2019-11-08 at 9 58 08 AM
RaphC commented 4 years ago

Hi @stevespringett , after restarting dependency-track the problem was resolved. A cache ?

I notice if I edit my alert publisher is blank during a while and after a few seconds the correct value 'SendMailPublisher' appears ...

RaphC commented 4 years ago

Or a database request latency that make SQL join between NOTIFICATIONRULE and NOTIFICATIONPUBLISHER tables slow ?

stevespringett commented 4 years ago

Closing

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.