Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#12131 closed defect (bug) (worksforme)

Admin/Dashbard hanging and getting 404 page due to wp_dashboard_recent_comments?

Reported by: aldenta's profile aldenta Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: Administration Keywords: has-patch
Focuses: Cc:


I have no idea how exactly this happened but here's the skinny. I help manage multiple WordPress installs for a client on a Dreamhost server under a single account. I got an email that the client couldn't log in to the admin. Sure enough, the admin (only on one site and not their others) would hang after you entered your username/password and eventually return the 404 WordPress page.

After much debugging (removing the plugins folder and commenting out pieces of the dashboard code), I tracked it down to wp_dashboard_recent_comments in wp-admin/includes/dashboard.php. Just commenting out the call to that function would make the dashboard load just fine.

If I printed out the sql query and ran it in phpMyAdmin the result set looked normal. However, if I ran the "$wpdb->get_results" line by itself it would hang.

So, I changed the query from:

SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50


SELECT * FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE $wpdb->posts.post_status != 'trash' ORDER BY $wpdb->comments.comment_date_gmt DESC LIMIT $start, 50

and then everything worked.

Now, the real stinker is, I tried to reproduce the problem afterward to really find the culprit. I created a test admin index page with just the wp_dashboard_recent_comments code a little while later and it started working. Then, I reverted the wp_dashboard_recent_comments query back to the original state and it now works fine.

I'm guessing it's was due to a combination of PHP, MySQL, the server and/or the result set that was coming back. I can't for the life of me reproduce it other than the time it was happening and I was debugging the code. The server is running PHP 5.2.12 and MySQL 5.0.32

I ran across multiple posts about getting a 404 after signing in to the admin area so I wanted to post this. I know many of the issues were due to permissions or plugins but I thought it would be worth posting to Trac just in case it turns out to be helpful.

This was a really odd occurrence and I wish I could reproduce it. I've attached a patch since it seems simple enough to just add the table names in front of each field.

Attachments (1)

12131.diff (876 bytes) - added by aldenta 14 years ago.

Download all attachments as: .zip

Change History (2)

14 years ago

#1 @scribu
14 years ago

  • Milestone Unassigned deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Not much to work with. Feel free to reopen with steps to reproduce.

Note: See TracTickets for help on using tickets.