[wp-trac] [WordPress Trac] #11018: display_page_row loops forever

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 23 19:03:35 UTC 2009


#11018: display_page_row loops forever
--------------------------+-------------------------------------------------
 Reporter:  hailin        |       Owner:  hailin    
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:            
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 display_page_row() in wp-admin/includes/template.php  could loop forever,
 causing wp-admin/edit-pages.php not able to load at all.

 The root cause is that when a few pages are corrupted, such that they form
 a loop in a disconnected sub-graph. The disconnected sub-graph will be
 treated as orphans in page_rows since none of its elements points to a top
 level page.

 When one orphan page is passed to display_page_row( $op, 0 ),
 display_page_row will try to find out its ancestors.  It will hit an
 infinite loop, if the chain of ancestors pages form a loop.

 We should try to detect, break the loop, and fix the corrupted pages
 post_parent.

 The loop happens very rarely. But it does happen. We’ve seen it happening
 about once a week on a large scale WPMU installation.  I tried to
 reproduce it by editing and changing page parents with no avail.  Possible
 causes are cache pollution, and simultaneous operation by two admins,
 causing race condition in writing to DB.

 Nevertheless, it’s better to detect and fix the loops, otherwise, users
 can not access edit-pages.php.

 I further conclude that we only need to handle loop conditions in
 display_page_row.  Given our current algorithm, loops are only possible in
 disconnected sub-graphs, thus we don’t need to worry about it in page_rows
 or _page_rows.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11018>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list