This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 880597 - ovirt-engine-notification-service : Notification service fails to send email notification when $MAIL_FROM is not defined ( Failed to dispatch message java.lang.NullPointerException )
ovirt-engine-notification-service : Notification service fails to send email ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-notification-service (Show other bugs)
3.1.0
Unspecified Unspecified
urgent Severity high
: ---
: 3.2.0
Assigned To: Yair Zaslavsky
Ilanit Stein
infra
: ZStream
Depends On:
Blocks: 915537
  Show dependency treegraph
 
Reported: 2012-11-27 07:10 EST by Oded Ramraz
Modified: 2016-02-10 14:29 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 884242 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
notifier log (8.37 KB, text/x-log)
2012-11-27 07:13 EST, Oded Ramraz
no flags Details

  None (edit)
Description Oded Ramraz 2012-11-27 07:10:17 EST
Description of problem:

I added a user to the system ( the user defined with redhat email address in AD ) and subscribed him to an event( oVirt engine has stopped ) . 
After that I stopped ovirt-engine service on my RHEVM and wait for few minutes . 
The mail wasn't sent and I saw exception in the notification log  ( Failed to dispatch message
java.lang.NullPointerException ) . 


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

2012-11-27 13:56:11,835 ERROR [org.ovirt.engine.core.notifier.NotificationService] Failed to dispatch message
java.lang.NullPointerException
        at org.ovirt.engine.core.notifier.utils.sender.mail.JavaMailSender.send(JavaMailSender.java:178)
        at org.ovirt.engine.core.notifier.utils.sender.mail.EventSenderMailImpl.send(EventSenderMailImpl.java:81)
        at org.ovirt.engine.core.notifier.NotificationService.processEvents(NotificationService.java:205)
        at org.ovirt.engine.core.notifier.NotificationService.run(NotificationService.java:95)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
2012-11-27 14:01:14,962 ERROR [org.ovirt.engine.core.notifier.NotificationService] Failed to dispatch message
java.lang.NullPointerException
        at org.ovirt.engine.core.notifier.utils.sender.mail.JavaMailSender.send(JavaMailSender.java:178)
"notifier.log" 75L, 8574C
Comment 1 Oded Ramraz 2012-11-27 07:13:42 EST
Created attachment 652645 [details]
notifier log
Comment 2 Moti Asayag 2012-11-27 08:37:15 EST
When the MAIL_FROM properties isn't set on [1], the notification service tries to populate it with the same value as provided by MAIL_USER.

Neither MAIL_USER nor MAIL_FROM are mandatory for sending the email.

However, if the message dispatch operations fails, an information is logged about the error the message details including the sender (MAIL_FROM).

Since this field wasn't set - the NPE is thrown.

The following is taken from [2], line 178
log.error(String.format("Failed to send message from [%s] to [%s] with subject [%s] due to error: [%s]",
                    from.toString()...)

from.toString() causes the NPE.


[1] /etc/ovirt-engine/notifier/notifier.conf
[2] ovirt-engine/backend/manager/tools/engine-notifier/engine-notifier-service/src/main/java/org/ovirt/engine/core/notifier/utils/sender/mail/JavaMailSender.java
Comment 3 Yair Zaslavsky 2012-12-04 13:17:43 EST
Suggested patch upstream - 

http://gerrit.ovirt.org/#/c/9726/2
Comment 6 Ilanit Stein 2013-02-11 09:19:21 EST
Verified on si27: 

Put MAIL_USER & MAIL_FROM in comment. Notification email sent, and no dispatch message or exception error seen in the notifier.log
Comment 7 Itamar Heim 2013-06-11 04:54:52 EDT
3.2 has been released
Comment 8 Itamar Heim 2013-06-11 04:54:52 EDT
3.2 has been released
Comment 9 Itamar Heim 2013-06-11 04:54:57 EDT
3.2 has been released
Comment 10 Itamar Heim 2013-06-11 04:57:55 EDT
3.2 has been released
Comment 11 Itamar Heim 2013-06-11 05:27:34 EDT
3.2 has been released

Note You need to log in before you can comment on or make changes to this bug.