Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72729

Disabling forum posts message provider causes related adhoc task to continually fail/requeue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.0
    • Forum, Messages
    • MOODLE_400_STABLE
    • MDL-72729-master-sendmessage_disabled_processors
    • Hide

      Manual Test 1 - No Digest re-queue

      1. Ensure mailhog is stopped
      2. Set up a forum with at least one user subscribed to it
      3. Verify user Email Digest type is set to 'No Digest'
      4. Verify 'Subscribed forum posts' messaging notification setting is enabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum posts' setting and ensure enabled is checked).
      5. Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post)
      6. Run the Forum mailings and maintenance jobs scheduled task
      7. Run the CRON
      8. Review the task log and confirm \mod_forum\task\send_user_notifications task now recorded as a FAIL
      9. Confirm task re-queued in task_adhoc table

      Manual Test 2 - No Digest - No re-queue

      1. Set up a forum with at least one user subscribed to it
      2. Verify user Email Digest type is set to 'No Digest'
      3. Verify 'Subscribed forum posts' messaging notification setting is disabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum posts' setting and uncheck enabled).
      4. Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post)
      5. Run the Forum mailings and maintenance jobs scheduled task
      6. Run the CRON
      7. Review the task log and confirm \mod_forum\task\send_user_notifications task now recorded as a SUCCESS
      8. Confirm task NOT re-queued in task_adhoc table

      Manual Test 3 - Digest - re-queue

      1. Ensure mailhog is stopped
      2. Set up a forum with at least one user subscribed to it
      3. Verify user Email Digest type is set to 'Complete' / 'Subjects'
      4. Verify 'Subscribed forum digests' messaging notification setting is enabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum digests setting and ensure enabled is checked.
      5. Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post)
      6. Run the Forum mailings and maintenance jobs scheduled task
      7. Run the CRON
      8. Review the task log and confirm \mod_forum\task\send_user_digests task now recorded as a FAIL
      9. Confirm task re-queued in task_adhoc table

      Manual Test 4 - Digest - No re-queue

      1. Set up a forum with at least one user subscribed to it
      2. Verify user Email Digest type is set to 'Complete' / 'Subjects'
      3. Verify 'Subscribed forum digests' messaging notification setting is disabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum digests' setting and uncheck enabled).
      4. Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post)
      5. Run the Forum mailings and maintenance jobs scheduled task
      6. Run the CRON
      7. Review the task log and confirm \mod_forum\task\send_user_digests task now recorded as a SUCCESS
      8. Confirm task NOT re-queued in task_adhoc table
      Show
      Manual Test 1 - No Digest re-queue Ensure mailhog is stopped Set up a forum with at least one user subscribed to it Verify user Email Digest type is set to 'No Digest' Verify 'Subscribed forum posts' messaging notification setting is enabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum posts' setting and ensure enabled is checked). Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post) Run the Forum mailings and maintenance jobs scheduled task Run the CRON Review the task log and confirm \mod_forum\task\send_user_notifications task now recorded as a FAIL Confirm task re-queued in task_adhoc table Manual Test 2 - No Digest - No re-queue Set up a forum with at least one user subscribed to it Verify user Email Digest type is set to 'No Digest' Verify 'Subscribed forum posts' messaging notification setting is disabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum posts' setting and uncheck enabled). Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post) Run the Forum mailings and maintenance jobs scheduled task Run the CRON Review the task log and confirm \mod_forum\task\send_user_notifications task now recorded as a SUCCESS Confirm task NOT re-queued in task_adhoc table Manual Test 3 - Digest - re-queue Ensure mailhog is stopped Set up a forum with at least one user subscribed to it Verify user Email Digest type is set to 'Complete' / 'Subjects' Verify 'Subscribed forum digests' messaging notification setting is enabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum digests setting and ensure enabled is checked. Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post) Run the Forum mailings and maintenance jobs scheduled task Run the CRON Review the task log and confirm \mod_forum\task\send_user_digests task now recorded as a FAIL Confirm task re-queued in task_adhoc table Manual Test 4 - Digest - No re-queue Set up a forum with at least one user subscribed to it Verify user Email Digest type is set to 'Complete' / 'Subjects' Verify 'Subscribed forum digests' messaging notification setting is disabled. (go to site administration >messaging > notification settings,  find 'Subscribed forum digests' setting and uncheck enabled). Add a post to the form (use Advanced editing and ensure that Send forum post notifications with no editing-time delay is checked for the post) Run the Forum mailings and maintenance jobs scheduled task Run the CRON Review the task log and confirm \mod_forum\task\send_user_digests task now recorded as a SUCCESS Confirm task NOT re-queued in task_adhoc table

      I found the following frequent failures in my task logs report while reviewing MDL-72691:

      Looking into it, I discovered that the "Subscribed forum posts" message provider on my site had been deliberately disabled:

      This causes message_send to return false: https://github.com/moodle/moodle/blob/1a9bee69e60f687bcaf4db0569665f4186c515a4/lib/messagelib.php#L56-L71 - resulting in $errorcount increasing: https://github.com/moodle/moodle/blob/1a9bee69e60f687bcaf4db0569665f4186c515a4/mod/forum/classes/task/send_user_notifications.php#L155-L166 and eventually an exception: https://github.com/moodle/moodle/blob/1a9bee69e60f687bcaf4db0569665f4186c515a4/mod/forum/classes/task/send_user_notifications.php#L182-L185 - example from task logs:

      Execute adhoc task: mod_forum\task\send_user_notifications
      ... started 11:14:18. Current memory use 44.2 MB.
      Sending messages to paul (2)
        Failed to send post 34
      Sent 0 messages with 1 failures
      ... used 21 dbqueries
      ... used 0.03567099571228 seconds
      Adhoc task failed: mod_forum\task\send_user_notifications,error/Error sending posts.
      Backtrace:
      * line 341 of /lib/cronlib.php: call to mod_forum\task\send_user_notifications->execute()
      * line 198 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()
      * line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks()
      * line 178 of /admin/cli/cron.php: call to cron_run()
      

      & subsequently leads to this adhoc task infinitely failing/being requeued (presumably until admin re-enables the provider, at which point all those tasks will run and spam users with every post they would have received since it was disabled)

      Seems to be an unintended side effect of MDL-70046

       

       

            Unassigned Unassigned
            pholden Paul Holden
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 5 minutes
                1h 5m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.