Bug 1399157

Summary: when I turn ON notifier, spamming my inbox with email notifications for past notifications
Product: Red Hat CloudForms Management Engine Reporter: Jeeva Kandasamy <jkandasa>
Component: ApplianceAssignee: Libor Pichler <lpichler>
Status: CLOSED CURRENTRELEASE QA Contact: Dmitry Misharov <dmisharo>
Severity: high Docs Contact:
Priority: high    
Version: 5.7.0CC: abellott, cpelland, dajohnso, dmisharo, jhardy, obarenbo, simaishi, slukasik
Target Milestone: GAKeywords: TestOnly
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: email:alert
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1535059 (view as bug list) Environment:
Last Closed: 2018-06-21 20:25:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1535059    
Attachments:
Description Flags
notifier settings
none
email inbox none

Description Jeeva Kandasamy 2016-11-28 12:46:28 UTC
Created attachment 1225274 [details]
notifier settings

Description of problem:
I configured set of alerts and disabled "Notifier". after some hours I plan to receive notifications. But suddenly spamming my inbox with email notifications for past alerts/notifications.

If user configured lot of alerts with email notification and Turn OFF "Notifier" for some months and he turns ON it again. He will receive tons of email notifications.

Version-Release number of selected component (if applicable):
Version: 5.7.0.12-rc2.20161123111642_a4a65ce
Server Name: EVM
User Name: Administrator
User Role: EvmRole-super_administrator
Browser: Firefox
Browser Version: 50
Browser OS: Linux

How reproducible:
100%

Steps to Reproduce:
1. Disable(Turn OFF) "Notifier", (Configurations >> Settings Server >> Server Control >>  Notifier)
2. Configure set of alerts with email notifications with 1 minute "Notification Frequency". These alert should generate notifications.
3. Wait for few hours
4. Enable(Turn ON) "Notifier", (Configurations >> Settings Server >> Server Control >>  Notifier)
5. check email inbox, with in few minutes my inbox filled with lot of old/past notifications.

Actual results:
Sending old/past email notifications when I turn ON "Notifier". This action leads spamming my inbox.

Expected results:
Should send from the time when I enable "Notifier"

Additional info: Screen shot are attached.

Comment 2 Jeeva Kandasamy 2016-11-28 12:47:02 UTC
Created attachment 1225275 [details]
email inbox

Comment 4 Greg McCullough 2017-04-17 16:42:01 UTC
Assigning over to Appliance for review.

After discussion with Jason the thinking was if the Notifier is disabled, we just don't queue the item.  It would seem useful to support an override flag (like :force => true) for cases were we want to queue an item anyway.

Comment 5 Šimon Lukašík 2017-05-16 13:20:23 UTC
https://github.com/ManageIQ/manageiq/pull/14801

Comment 6 Dave Johnson 2017-10-31 02:25:37 UTC
Milan, thinking this is a good candidate for an automated test

Comment 7 Milan Falešník 2017-11-03 11:56:21 UTC
Checked in 5.9.0.5, I noticed that I still received an e-mail when I had the notifier off for ~30 minutes during and after triggering the alert, then turning it on.

The alert I used was hooked to the Tag Complete on provider, notification period every minute.

Comment 8 Gregg Tanzillo 2017-11-15 19:49:52 UTC
Milan, would you be able to provide logs form your test? Was there only a single appliance running it the region or were there other appliance that could have potentially had the role enabled?

If you no longer have the logs, perhaps you can recreate and give me access to the environment.

Comment 9 Milan Falešník 2017-11-20 10:57:58 UTC
I am pretty sure it was a single appliance. The environment is dead by now, I will try recreating, reproducing and eventually passing the details to you.

Comment 10 Milan Falešník 2017-11-20 14:46:08 UTC
So, reproduction details from my last try:

Version 5.9.0.9

1) Have a fresh appliance
2) In Settings, verify that you can send emails, save the settings
3) Also in Settings, disable the Notifier role, save the settigns.
4) Add a provider, I used a vSphere infra provider
5) Create an alert:
Active: Yes
Severity: Warning
Based On: Provider
What to Evaluate: Nothing
Driving Event: Compliance: Provider Compliance Passed
Notification Frequency: 1 Minute
Send E-mail:
To: <your email>
6) Put the alert into an alert profile
7) Assign the alert profile to the provider
8) Create a very simple tag-based provider compliance policy:
NOT( Tag cost center: Cost Center 001 )
so it always passes the compliance, just make sure the tag is not applied
9) Put the compliance policy into a new policy profile
10) Assign the policy profile to the provider
11) Now, assuming the Notifier is off, go to the provider summary and kick off compliance check from the Policy dropdown
12) Wait a minute or two and repeat 11. Repeat this a couple of times. It does not have any visual indication of the compliance.
13) Wait ~5 minutes and go enable the notifier role. Go refresh your inbox a couple of times.
14) Congratulations, you have just received some spam ...

I was wondering, does it need significantly more of the time? But https://github.com/ManageIQ/manageiq/pull/14801/files#diff-eeab7270023711cd8c4963ecafe0af0bR51 looks like that should not be a problem ...