[buddypress-trac] [BuddyPress Trac] #8683: BP .htaccess rule causes server CPU spikes

buddypress-trac noreply at wordpress.org
Fri Apr 15 19:00:59 UTC 2022


#8683: BP .htaccess rule causes server CPU spikes
--------------------------+-----------------------------
 Reporter:  kuznacic      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  10.2.0
 Severity:  major         |   Keywords:
--------------------------+-----------------------------
 I had posted this on the BP support forum, and a commenter said this is
 not common and suggested I create a ticket here. Please let me know if I
 can supply further info.


 The issue: Running on a 2GB Cloudways-based Digital Ocean droplet with the
 latest versions of WordPress (5.9.3) and BuddyPress (10.2), a client site
 and server were seeing spikes to 100% CPU and high RAM usage — but only
 when a logged-in user opened the WordPress media library (/wp-
 admin/upload.php).

 My hosting support first told me it was a plugin error, then I was told it
 was a theme error. But we were unable to find any evidence of this. I
 cloned the live site, deactivated all plugins and switched to a default WP
 theme, and the issue still occurred.

 There were no related items in the Apache or Nginx error logs, but the PHP
 access log fills with lines like this, seemingly for every media file:

 (server IP) – [15/Apr/2022:15:57:37 +0000] “GET /index.php?bp-
 attachment=13109/NorthCrawford-300×225.jpg” 301 0 – 798 14702 0.648
 8388608 9.27% 3.09% “/?bp-attachment=13109/NorthCrawford-300×225.jpg”

 The solution from my hosting support:

 ''The issue is BuddyPress created htaccess that redirects all wp-
 content/uploads/bp-attachments/ to ?bp_attachments= URL. The redirects
 spawn heaps of apache and php-fpm which also cause the issue . They
 created this sample htaccess found on the directory below

 ''/public_html/wp-content/uploads/bp-attachments# cat .htaccess''

 ''RewriteEngine On
 RewriteBase /
 RewriteRule (.+) ?bp-attachment=$1 [R=302,NC]''

 ''The htaccess has been renamed so, when you load medias, it should no
 longer reach 100%''

 The solution was to take the .htaccess file out of the equation by
 renaming it, which is only a temporary fix. I presume this file would be
 overwritten upon the next BP update?

 If that’s the case, how would I keep this from happening, aside from
 renaming the offending .htaccess file each time there is a BP update?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8683>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list