Check for long running tasks

Problem:

SMTP To address may not be blank: SMTP To address may not be blank: SMTP To address may not be blank:

Expected outcome:

Foreman and Proxy versions:
foreman version = version 3.7

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

Hi Team,

any idea on this how to resolve this. the task running everyday and failed

Action:
Actions::DeliverLongRunningTasksNotification
Input:
{“report”=>
{“user_id”=>3,
“time”=>2024-01-01 08:00:00.962702946 +0800,
“interval”=>172800,
“states”=>[“running”, “paused”],
“task_uuids”=>
[“43d143f7-14eb-4e3e-9463-0ad0207866f7”,
“6ed8ec4e-ee57-40dd-8386-e08449daa5f5”,
“b351d207-a594-4ae4-b21b-540d3d6fd4cf”,
“2ddca48a-663d-4a29-992d-f88a095fb305”,
“8f0b5674-1c71-4dea-8173-d28ec396ac5a”,
“bbdaab84-c85f-4bc7-a7e7-9df802e54fde”,
“35374458-929e-4d4e-aa08-0d697f2a0920”,
“a4047970-afc5-412a-9ac5-bdc53d89831d”,
“f4f976a4-b75c-4954-b979-4d3ffcca0c32”,
“d90ef136-75d9-4b44-b009-f677077229b0”,
“7d501977-63dc-4252-bc58-294e34f8b6c6”,
“5799b5e6-dde8-4737-acc7-a9d12d5190f9”,
“c97a3a71-a0eb-45e1-98ba-c8cfdef13651”],
“query”=>
“state ^ (running, paused) AND state_updated_at <= "2023-12-30 00:00:00 UTC"”,
“user”=>nil,
“tasks”=>nil},
“current_request_id”=>“d063f48d-31c2-4d0c-8ed5-a993ff3f39ef”,
“current_timezone”=>“UTC”,
“current_organization_id”=>nil,
“current_location_id”=>nil,
“current_user_id”=>3}
Output:
{}
Exception:
ArgumentError: SMTP To address may not be blank:
Backtrace:
/usr/share/gems/gems/mail-2.8.1/lib/mail/smtp_envelope.rb:27:in to=' /usr/share/gems/gems/mail-2.8.1/lib/mail/smtp_envelope.rb:13:in initialize’
/usr/share/gems/gems/mail-2.8.1/lib/mail/network/delivery_methods/sendmail.rb:65:in new' /usr/share/gems/gems/mail-2.8.1/lib/mail/network/delivery_methods/sendmail.rb:65:in deliver!’
/usr/share/gems/gems/mail-2.8.1/lib/mail/message.rb:2145:in do_delivery' /usr/share/gems/gems/mail-2.8.1/lib/mail/message.rb:253:in block in deliver’
/usr/share/gems/gems/actionmailer-6.1.7.3/lib/action_mailer/base.rb:559:in block in deliver_mail' /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in block in instrument’
/usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in instrument' /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in instrument’
/usr/share/gems/gems/actionmailer-6.1.7.3/lib/action_mailer/base.rb:557:in deliver_mail' /usr/share/gems/gems/mail-2.8.1/lib/mail/message.rb:253:in deliver’
/usr/share/gems/gems/roadie-rails-3.0.0/lib/roadie/rails/inline_on_delivery.rb:13:in deliver' /usr/share/gems/gems/actionmailer-6.1.7.3/lib/action_mailer/message_delivery.rb:119:in block in deliver_now’
/usr/share/gems/gems/actionmailer-6.1.7.3/lib/action_mailer/rescuable.rb:17:in handle_exceptions' /usr/share/gems/gems/actionmailer-6.1.7.3/lib/action_mailer/message_delivery.rb:118:in deliver_now’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/deliver_long_running_tasks_notification.rb:15:in run' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:588:in block (3 levels) in execute_run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/rails_executor_wrap.rb:14:in block in run' /usr/share/gems/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb:91:in wrap’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/rails_executor_wrap.rb:13:in run' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action/progress.rb:31:in with_progress_calculation' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action/progress.rb:17:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/load_setting_values.rb:20:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_request_id.rb:15:in block in run’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_request_id.rb:52:in restore_current_request_id' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_request_id.rb:15:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_timezone.rb:15:in block in run’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_timezone.rb:44:in restore_curent_timezone' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_timezone.rb:15:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_taxonomies.rb:15:in block in run’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_taxonomies.rb:45:in restore_current_taxonomies' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_taxonomies.rb:15:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:32:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:27:in pass’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware.rb:19:in pass' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_user.rb:15:in block in run’
/usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_user.rb:54:in restore_curent_user' /usr/share/gems/gems/foreman-tasks-8.1.1/app/lib/actions/middleware/keep_current_user.rb:15:in run’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/stack.rb:23:in call' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/middleware/world.rb:31:in execute’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:587:in block (2 levels) in execute_run' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:586:in catch’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:586:in block in execute_run' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:489:in block in with_error_handling’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:489:in catch' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:489:in with_error_handling’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:581:in execute_run' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/action.rb:302:in execute’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:18:in block (2 levels) in execute' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/execution_plan/steps/abstract.rb:167:in with_meta_calculation’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:17:in block in execute' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:32:in open_action’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/execution_plan/steps/abstract_flow_step.rb:16:in execute' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/director.rb:69:in execute’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/executors/sidekiq/worker_jobs.rb:11:in block (2 levels) in perform' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/executors.rb:18:in run_user_code’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/executors/sidekiq/worker_jobs.rb:9:in block in perform' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/executors/sidekiq/worker_jobs.rb:25:in with_telemetry’
/usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/executors/sidekiq/worker_jobs.rb:8:in perform' /usr/share/gems/gems/dynflow-1.7.0/lib/dynflow/executors/sidekiq/serialization.rb:27:in perform’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:196:in execute_job' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:164:in block (2 levels) in process’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/middleware/chain.rb:133:in invoke' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:163:in block in process’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:136:in block (6 levels) in dispatch' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/job_retry.rb:112:in local’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:135:in block (5 levels) in dispatch' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq.rb:39:in block in module:Sidekiq’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:131:in block (4 levels) in dispatch' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:257:in stats’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:126:in block (3 levels) in dispatch' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/job_logger.rb:13:in call’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:125:in block (2 levels) in dispatch' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/job_retry.rb:79:in global’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:124:in block in dispatch' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/logger.rb:11:in with’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/job_logger.rb:33:in prepare' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:123:in dispatch’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:162:in process' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:78:in process_one’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/processor.rb:68:in run' /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/util.rb:43:in watchdog’
/usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/util.rb:52:in block in safe_thread' /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in block in create_with_logging_context’

I am not 100% certain on this, but looking at the code I think the problem is the following:
Foreman 3.6 or 3.7 introduced a recurring logic feature to inform users about tasks that run very long (>2 days if I understand correctly). This task also tries to send out an email with a report on the long running tasks. Since at least one of the designated recipients does not have a mail address set, the task fails.
You did not provide information about your installed plugins and versions, but looking around it seems this task is only in foreman-tasks 8.x versions and all of those branches should already contain the fixes for this problem, so I would recommend updating you foreman-tasks and the problem should be gone.

Spot on, thank you.

Looking at the stack trace they seem to have foreman-tasks-8.1.1, updating to 8.1.4 should do the trick.

1 Like

Hi areyus,

Thank you for your feedback. Any other temporary option to fixed this…?
already cancel the job but the task still running and error still prompted.

Thanks

Another option should be to give the admin user (if that does not work, then everyone with the admin permission or the “Organization Admin” role, too) an e-mail address so Foreman can actually send mails to them.

is it under settings.?

No, that’s under Administer → Users, there you can check which users should be changed with this search query:
(admin = true or role = "Organization admin") and mail = ""

Hi,

sorry for late reply. The error still persist .

have assign the role to specific user and user has admin role. but still same