Make WordPress Core

Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#6305 closed defect (bug) (fixed)

AJAX is teh b0rked when adding categories.

Reported by: christhomson's profile christhomson Owned by:
Milestone: 2.5 Priority: normal
Severity: major Version: 2.5
Component: Administration Keywords:
Focuses: Cc:

Description

When adding a new category on /wp-admin/categories.php, you always get an error saying "AJAX is teh b0rked". This is happening to me, and a few users on the WP Support Forums.

This is critical to get fixed by the final 2.5 release, otherwise users have to go to the write post page to add a new category.

Attachments (6)

wp-ajax-response-debug.php (3.0 KB) - added by mdawaffe 16 years ago.
WP Ajax Response Debug.png (26.3 KB) - added by mdawaffe 16 years ago.
example output of attached plugin
wpdb_ping.diff (2.6 KB) - added by ryan 16 years ago.
wp-db.php (17.4 KB) - added by ryan 16 years ago.
wp-db.diff (2.6 KB) - added by westi 16 years ago.
Update patch to not ping if the reconnect fails
wp-db.2.php (18.0 KB) - added by westi 16 years ago.
Update wp-db.php to not ping if the reconnect fails

Download all attachments as: .zip

Change History (30)

#1 @markjaquith
17 years ago

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

Cannot reproduce as of [7412] using Safari 3.1 or Firefox 2.0.0.12 (both OS X 10.5.2). Server environment is Apache 2, PHP 5.2.4

Please re-open with more details about your server/browser environment. Please try it with ALL plugins disabled.

#2 @christhomson
16 years ago

  • Resolution worksforme deleted
  • Severity changed from critical to normal
  • Status changed from closed to reopened

I just tested this locally and it seems to work fine (on Mac OS X Leopard with MAMP, with no plugins). I just tested it again on the same install, with the same settings (on my actual website), and it still said "AJAX is teh b0rked" but once I refreshed it, all the categories disappeared! I refreshed again, and all the categories reappeared, including the one I was trying to make when "AJAX was b0rked". Here's a little info that might be useful to find the problem:

I'm running Apache/2.0.54, php 5.2.5, mysql 4.1.11.

#3 @markjaquith
16 years ago

christhompson, what WordPress version/revision?

#4 @mdawaffe
16 years ago

Try disabling JavaScript in your browser and then add a category from Manage -> Categories. What happens?

#5 @ryan
16 years ago

Trunk adds some extra error checks to help isolate the problem. If you're using svn, update and trying adding a category. Do you see "Could not insert term into the database"?

#6 @Viper007Bond
16 years ago

Indeed. I'm having this happen on a client's install.

#7 @mdawaffe
16 years ago

wp-ajax-response-debug.php

A plugin that will output the parsed data of any XML response resulting from a WP AJAX request (see attached screenshot). Upload it to your wp-content/plugins/ directory and activate it from your WordPress' Plugins admin page.

Tested in FF2, Safari3, Opera9, IE6/7

@mdawaffe
16 years ago

example output of attached plugin

#8 @Otto42
16 years ago

mod_security problem, perhaps?

#9 @helmi
16 years ago

having the same problem here (FF3b4, Safari 3.1, MaxOSX 10.5.2). When switching of Javascript i get "Category not added" instead without any other visible error/problem.
I switched off all plugins and still get the same error. Probably something server related. Can't say too much about installed modules as this server isn't my own. Will try another install on a local test machine.

#10 @ryan
16 years ago

Check error logs to see if anything is being output there, particularly database error related stuff.

#11 @ryan
16 years ago

  • Milestone set to 2.5

#12 @ryan
16 years ago

"Lost connection to MySQL server during query"

That error was reported on the testers list. Seems related to the "gone away" errors from #5951 that people worked around by using mysql_ping(). I'll create a mysql_ping() patch to wpdb to see if that helps.

@ryan
16 years ago

#13 @ryan
16 years ago

If a query errors out with a CR_SERVER_GONE_ERROR or CR_SERVER_LOST errno, two attempts are made to mysql_ping() and reconnect. If successful, the query is done again, otherwise we bail.

@ryan
16 years ago

#14 @ryan
16 years ago

Modified wp-db.php attached for those who don't have patch handy.

#15 @Viper007Bond
16 years ago

Seems to have worked, but it's REALLY slow (like 10-30 seconds).

Also:

Warning: mysql_ping() expects parameter 1 to be resource, boolean given in [...]

#16 @westi
16 years ago

Looking at the patch $this->dbh can only be a bool if the mysql_connect fails - I assume it's the reconnect that fails.

@westi
16 years ago

Update patch to not ping if the reconnect fails

@westi
16 years ago

Update wp-db.php to not ping if the reconnect fails

#17 @westi
16 years ago

I've attached a new patch (or wp-db.php) for people to try which won't ping if the reconnect fails.

#18 @Viper007Bond
16 years ago

Works, but still a horridly long page load. Takes exactly 30 seconds to get the AJAX response (same for non-AJAX). Seems some timeout is occurring and it takes 30 seconds before it gives up.

#19 @Viper007Bond
16 years ago

  • Severity changed from normal to major

#20 @ryan
16 years ago

(In [7481]) Make sure IDs are >= 0. see #6305

#21 @ryan
16 years ago

I looked at differences between how categories are created from Write->Post versus Manage->Categories. Manage->Categories allows parent IDs of -1 to be passed down. The commit above changes negative IDs to zero just in case negative IDs are somehow responsible.

#22 @ryan
16 years ago

(In [7483]) Make sure cat parents are >= 0. see #6305

#23 @Viper007Bond
16 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Indeed they were. Totally blazing fast as of the current SVN version. Woot!

#24 @Viper007Bond
16 years ago

Er, I probably shoulda waited for confirmation from others before closing. Someone reopen this if it didn't fix it for you.

Note: See TracTickets for help on using tickets.