Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP 2.0 update failure – WP admin won't load

  • Avatar of blankpoint
    blankpoint
    Participant

    @blankpoint

    I have a BP site with ~335,000 members. Updated to WP 1.9 today with no problem. On a clone of the real server, I’ve updated to BP 2.0, and it is not working. With all other plugins disabled, whenever BP is active, I can’t get into the WP admin. Front-end seems fine.

    When I try to access wp-admin, looking at the MySQL slow query log, I see a whole bunch of ridiculously long queries trying to take place. I suppose at some point, it is just timing out, and I get a white screen instead of any admin. It times out after ~10 seconds or more.
    Some of the queries are examining millions of rows.

    Pasting here some of the (slow-logged) queries that happen when I go in to wp-admin:

    # Time: 140417 22:27:15
    # User@Host: digitaljustice[digitaljustice] @ localhost []  Id:    61
    # Query_time: 2.940681  Lock_time: 0.000449 Rows_sent: 0  Rows_examined: 508756
    SET timestamp=1397788035;
    INSERT INTO wp_bp_activity (<code>user_id</code>, <code>component</code>, <code>type</code>, <code>action</code>, <code>content</code>, <code>primary_link</code>, <code>item_id</code>, <code></code>
    date_reco
                      SELECT user_id, 'members' as component, 'last_activity' as type, '' as action, '' as content, '' as
                      FROM wp_usermeta
                      WHERE
                        meta_key = 'last_activity'
                        AND
                        user_id NOT IN (
                          SELECT user_id
                          FROM wp_bp_activity
                          WHERE component = 'members' AND type = 'last_activity'
                        )
            );
    # Time: 140417 22:27:18
    # User@Host: XXXXXXXXXXXXXXXXX] @ localhost []  Id:    61
    # Query_time: 0.944158  Lock_time: 0.062164 Rows_sent: 79994  Rows_examined: 313319
    SET timestamp=1397788038;
    SELECT * FROM wp_users WHERE ID IN (181294,78917,192535,216692,105318,198052,148003,208531,151466,147363,208714,204709
    
    # note: the above line goes on with hundreds of thousands of user IDs!
    
    # Time: 140417 22:27:37
    # User@Host: digitaljustice[digitaljustice] @ localhost []  Id:    61
    # Query_time: 9.810006  Lock_time: 0.045841 Rows_sent: 1694105  Rows_examined: 3388210
    SET timestamp=1397788057;
    SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (38731,38733,38735,38739,38740,38741,38746,3874
    
    #the above also seems to go on with hundreds of thousands of IDs.
    

    Tried restarting MySQL and PHP-FPM.
    Server is a 8GB VPS with 8 cores and SSD, Ubuntu Server 10.04 LTS.
    MySQL is Percona: mysql Ver 14.14 Distrib 5.6.12
    PHP is 5.3.8
    Don’t think it’s relevant, but the webserver is current stable version of nginx.
    I tried getting rid of my bp-custom.php in case I was hooking into something that doesn’t work in 2.0, but it had no effect.

    Hope someone can help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of blankpoint
    blankpoint
    Participant

    @blankpoint

    I can’t edit my post for some reason. After some more digging, I see a PHP fatal error:
    [18-Apr-2014 03:01:33] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 524288 bytes) in /home/public_html/XXXXXXXXX/public/wp-includes/wp-db.php on line 1587

    I tried changing php.ini max memory to 1024M and also set execution time to infinite, but it still hangs at the same place with the same memory message. I know scripts can set the memory limit themselves. Is the BP script somehow setting the mem limit to ~260MB, even though it needs more because of the size of my user tables?

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    @blankpoint Sorry for the troubles. The upgrade routine necessary for BP 2.0 is fairly large.

    I’ll work in the upcoming weeks on improving it, but in the meantime, a few things to try:

    1. Your memory limit issue is due to the fact that WP will not allow you to exceed 256M per pageload without explicitly saying you want to (regardless of your php.ini settings). You can put the following into wp-config.php to override for the admin only:

    define( 'WP_MAX_MEMORY_LIMIT', '1024M' );

    2. Just to get up and running, you might also consider running the heavy migration manually: from the mysql command line.

    INSERT INTO wp_bp_activity (<code>user_id</code>, <code>component</code>, <code>type</code>, <code>action</code>, <code>content</code>, <code>primary_link</code>, <code>item_id</code>, <code></code>
    date_reco
                      SELECT user_id, 'members' as component, 'last_activity' as type, '' as action, '' as content, '' as
                      FROM wp_usermeta
                      WHERE
                        meta_key = 'last_activity'
                        AND
                        user_id NOT IN (
                          SELECT user_id
                          FROM wp_bp_activity
                          WHERE component = 'members' AND type = 'last_activity'
                        )
            );
    

    You could split this up with a LIMIT clause in case you need to run it a few times.

    The other problematic bit of the upgrade routine has to do with migrating your old signups to the new signups schema. (I’m assuming you have open registration + non-multisite.) That migration is not necessarily mission-critical, so you could skip it altogether. So, in other words, once you’ve run the ‘last_activity’ migration, you could comment out line 351 and lines 355-395 here: https://buddypress.trac.wordpress.org/browser/tags/2.0/bp-core/bp-core-update.php#L351 and then reload your admin to mark the migration as complete.

    Again, sorry about the difficulties. You’re running a very large BP site, and the migration tools were not up to the job.

    Then, you could comment out this line: https://buddypress.trac.wordpress.org/browser/tags/2.0/bp-core/bp-core-update.php#L351

    Avatar of Huseyin Berberoglu
    Huseyin Berberoglu
    Participant

    @hberberoglu

    I am facing same issue like @blankpoint :(

    wp_users has 133,369 rows
    wp_usermeta has 2,133,969 rows
    wp_bp_xprofile_data has 184,804 rows

    php memory limit is 128M.

    I think it’s working hard in bp_core_install_signups() function.

    fyi.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.