Project

General

Profile

Actions

Bug #10605

closed

cac-onboarding email sending routine can cause near-infinite db requests

Added by Boone Gorges about 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Onboarding
Target version:
Start date:
2018-10-26
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Here's an odd query loop coming out of one of my debugging tools:

 [1696] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0012948513031006
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->set_to, BP_Email_Recipient->__construct, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1697] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0014610290527344
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, BuddyPress->{closure}, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1698] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0015239715576172
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, BuddyPress->{closure}, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

    [1699] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0017638206481934
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_from, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1700] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0012359619140625
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_from, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

    [1701] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.001255989074707
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_to, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1702] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.001143217086792
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_to, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

    [1703] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0011641979217529
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_subject, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1704] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0013971328735352
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_subject, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

    [1705] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0012741088867188
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_content, BP_Email->get, BP_Email->get_content_type, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1706] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0012631416320801
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_content, BP_Email->get, BP_Email->get_content_type, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

    [1707] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0011889934539795
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_content, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1708] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0014500617980957
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_content, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

    [1709] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.0011370182037354
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_template, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, BP_Email_Recipient->get_user, get_user_by, WP_User::get_data_by
        )

    [1710] => Array
        (
            [0] => SELECT * FROM wp_users WHERE user_email = 'username@myhunter.cuny.edu'
            [1] => 0.001115083694458
            [2] => do_action('admin_post_nopriv_wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Async_Task->handle_postback, CAC\Onboarding\Invitation\AsyncTask->run_action, do_action('wp_async_caco_invitation_event_process'), WP_Hook->do_action, WP_Hook->apply_filters, CAC\Onboarding\Invitation\EmailProcess->CAC\Onboarding\Invitation\{closure}, bp_send_email, BP_Email->validate, BP_Email->get_template, BP_Email->get, apply_filters('bp_email_get_property'), WP_Hook->apply_filters, bp_core_deprecated_email_filters, BP_Email->get, apply_filters('bp_email_get_tokens'), WP_Hook->apply_filters, bp_email_set_default_tokens, get_user_by, WP_User::get_data_by
        )

( is a sanitized version of an actual address). This goes on for a couple dozen times before the system gives up (I guess?) and moves onto the next item on the list.

I'm having a hard time understanding what's going on here. BP seems to be tripped up by the fact that the email address doesn't match a WP user. But even in this case, there shouldn't be an infinite regress.

The simplest fix I can see for the Commons is to unhook `bp_core_deprecated_email_filters()`. Ray, do you see a problem with this? Do you think there's need here for an upstream BP ticket?


Related issues

Related to CUNY Academic Commons - Bug #10633: Tribe__Meta__Chunker->is_supported_post_type runaway queriesDuplicateBoone Gorges2018-10-29

Actions
Related to CUNY Academic Commons - Bug #6710: GES resulting in infinite loopResolvedRaymond Hoh2016-11-14

Actions
Actions

Also available in: Atom PDF