How to solve 500 Error on WordPress Admin Dashboard due to time-out on getdirsize

problem:
Only some blogs did not show the dashboard (but did show all other admin pages). I have left this problem for some time (months) since Googling did not bring up anything relevant and I was too lazy to investigate (and could work around it by logging in, getting a 500 error and then press back and click comments). In my mind were .htaccess changes it did, plugins that drop bad rss feeds etc…but… it was core.

So today I went commenting out all passages in dashboard.php and unfortunately it was Murphy since the problem was with the bottom line…

Read More
add_action( 'activity_box_end', 'wp_dashboard_quota' );

In which I commented the line

//$used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
    // returns: 1418.9275159836
$used=0;

Whereafter my dashboard was so speedy that I got tears in my eyes.

I’m logging this here since I hope people searching for the problem now will shortcut time and recognize the reason. Especially with the combo: 500 and admin dashboard.

Question: I assume that the bigger the uploaddir gets, the slower dasboards will load for blogs. I also assume that this happens for every blog out there since this is a line in core.

Am I correct and could I log this as issue or am i stupid – missing something essential that does not cause this to be problem for every multisite blog with large quota after some time?

Now I connected 500 and getdirsize I found http://trac.mu.wordpress.org/ticket/1175 and http://trac.mu.wordpress.org/changeset/2027 ……

In there a transient check was implemented by james collins. What happened to the transient check? that would resolve this I think.

The transient check as implemented in ticket 2027 is still in place (see Rarst answer below) and disabling the quota completely will also shortcut the 500 error since that is what is checked in wp_dashboard_quota.

So: if you do not disable the quota it means you will get a 500 error eventually if you have a large quota limit. IMHO that could be improved / ticketed or not?

Related posts

Leave a Reply

1 comment