[buddypress-trac] [BuddyPress Trac] #8688: BP_Groups_Group::get_total_member_count() is highly inefficient, and runs out of memory

buddypress-trac noreply at wordpress.org
Wed Apr 27 10:38:27 UTC 2022


#8688: BP_Groups_Group::get_total_member_count() is highly inefficient, and runs
out of memory
--------------------------+------------------------------
 Reporter:  dd32          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Groups        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by dd32):

 I would like to include the fatal error being encountered after calling
 `groups_join_group()` or `groups_leave_group()`... but it's really not
 exactly obvious.. so I'll include a partial stack trace instead that might
 help understanding of it.

 For those with access to BuddyPress.org fatal errors, you'll find similar
 errors to the below in there, but the details is not at all helpful for
 debugging.

 {{{
 E_ERROR: Allowed memory size of 268435456 bytes exhausted (tried to
 allocate 19846800 bytes)

 ...

 PHP  16. groups_leave_group($group = 17, $user_id = 14842180)
 PHP  17. BP_Groups_Member::delete($user_id = 14842180, $group_id = 17) wp-
 content/plugins/buddypress/bp-groups/bp-groups-functions.php:628
 PHP  18. BP_Groups_Member::refresh_total_member_count_for_group($group_id
 = 17) wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-
 member.php:521
 PHP  19. BP_Groups_Group::get_total_member_count($group_id = 17,
 $skip_cache = TRUE) wp-content/plugins/buddypress/bp-groups/classes/class-
 bp-groups-member.php:489
 PHP  20. groups_get_group_members($args = ['group_id' => 17, 'group_role'
 => [0 => 'member', 1 => 'admin', 2 => 'mod'], 'type' => 'active']) wp-
 content/plugins/buddypress/bp-groups/classes/class-bp-groups-
 group.php:1800
 PHP  21. BP_User_Query->__construct($query = ['group_id' => 17, 'per_page'
 => FALSE, 'page' => FALSE, 'group_role' => [0 => 'member', 1 => 'admin', 2
 => 'mod'], 'exclude' => FALSE, 'search_terms' => FALSE, 'type' =>
 'active']) wp-content/plugins/buddypress/bp-groups/bp-groups-
 functions.php:874
 PHP  22. BP_User_Query->do_wp_user_query() wp-content/plugins/buddypress
 /bp-core/classes/class-bp-user-query.php:210
 PHP  23. WP_User_Query->__construct($query = ['fields' => [0 => 'ID', 1 =>
 'user_login', 2 => 'user_pass', 3 => 'user_nicename', 4 => 'user_email', 5
 => 'user_url', 6 => 'user_registered', 7 => 'user_activation_key', 8 =>
 'user_status', 9 => 'display_name', 10 => 'spam', 11 => 'deleted'],
 'include' => [0 => '10937674', 1 => '15013885', 2 => '15536580', 3 =>
 '13255989', ...], 'blog_id' => 0, 'count_total' => FALSE]) wp-
 content/plugins/buddypress/bp-core/classes/class-bp-user-query.php:594
 PHP  24. WP_User_Query->query() wp-includes/class-wp-user-query.php:78
 PHP  25. wpdb->get_results($query = 'SELECT  wp_users.ID,
 wp_users.user_login, wp_users.user_pass, wp_users.user_nicename,
 wp_users.user_email, wp_users.user_url, wp_users.user_registered,
 wp_users.user_activation_key, wp_users.user_status, wp_users.display_name,
 wp_users.spam, wp_users.deleted FROM  wp_users WHERE 1=1 AND  wp_users.ID
 IN (10937674,15013885,15536580,'..., $output = *uninitialized*) wp-
 includes/class-wp-user-query.php:793
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8688#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list