Bug 880597

Summary: ovirt-engine-notification-service : Notification service fails to send email notification when $MAIL_FROM is not defined ( Failed to dispatch message java.lang.NullPointerException )
Product: Red Hat Enterprise Virtualization Manager Reporter: Oded Ramraz <oramraz>
Component: ovirt-engine-notification-serviceAssignee: Yair Zaslavsky <yzaslavs>
Status: CLOSED CURRENTRELEASE QA Contact: Ilanit Stein <istein>
Severity: high Docs Contact:
Priority: urgent    
Version: 3.1.0CC: dyasny, iheim, italkohe, masayag, oourfali, Rhev-m-bugs, sgrinber, ykaul
Target Milestone: ---Keywords: ZStream
Target Release: 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
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:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 915537    
Attachments:
Description Flags
notifier log none

Description Oded Ramraz 2012-11-27 12:10:17 UTC
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 12:13:42 UTC
Created attachment 652645 [details]
notifier log

Comment 2 Moti Asayag 2012-11-27 13:37:15 UTC
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 18:17:43 UTC
Suggested patch upstream - 

http://gerrit.ovirt.org/#/c/9726/2

Comment 6 Ilanit Stein 2013-02-11 14:19:21 UTC
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 08:54:52 UTC
3.2 has been released

Comment 8 Itamar Heim 2013-06-11 08:54:52 UTC
3.2 has been released

Comment 9 Itamar Heim 2013-06-11 08:54:57 UTC
3.2 has been released

Comment 10 Itamar Heim 2013-06-11 08:57:55 UTC
3.2 has been released

Comment 11 Itamar Heim 2013-06-11 09:27:34 UTC
3.2 has been released