Opened 14 years ago
Closed 4 years ago
#18239 closed defect (bug) (duplicate)
wp_ob_end_flush_all() hangs the output buffering, during plugin update/install
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.2.1 |
Component: | Upgrade/Install | Keywords: | output hangs |
Focuses: | Cc: |
Description (last modified by )
Symptom: During plugin update process, the screen displays "Downloading {plugin}" then appears to hang.
System: Apache2 on LinuxMint-11
I traced the fault to the following function:
send_message() in /wp-admin/includes/misc.php
this function writes out the message, then tries to flush
the buffers by calling wp_ob_end_flush_all()
the mechanism of the ob_flush is to repeatedly call ob_end_flush until there is no more levels.
On the default configuration of LinuxMint / Debian, zlib.output_compression is ON, and this interferes with ob_end_flush
Based on notes from php.net, ob flushing is not necessary.
SOLUTION:
1) Either change php.ini to set zlib.output_compression to OFF, or
2) shortcircuit the wp_ob_end_flush_all() by adding an immediate return to the first line.
RECOMMENDATION:
In future versions of WordPress, the interaction between ob and zlib should be studied carefully to derive the most universal solution.
Change History (10)
#2
@
13 years ago
no solution this time?
this works for me on plugin update page.
changed misc.php from
function show_message($message) { ... echo "<p>$message</p>\n"; wp_ob_end_flush_all(); flush(); }
to
function show_message($message) { ... ob_start(); echo "<p>$message</p>\n"; wp_ob_end_flush_all(); ob_start(); }
changes functions.php from
function wp_ob_end_flush_all() { $levels = ob_get_level(); for ($i=0; $i<=$levels; $i++) ob_end_flush(); }
to
function wp_ob_end_flush_all() { $levels = ob_get_level(); for ($i=0; $i<=$levels; $i++) if (ob_get_length()) { @ob_end_flush(); @ob_flush(); @flush(); } }
#3
@
13 years ago
- Cc kpayne@… added
@Tom Braider, can you try the patch on #18525 and let me know if that works for you?
#4
@
13 years ago
Sorry for very late answer.
This patch works for me partially.
While update 2 plugins they will updated successfully but there are no messages after the first plugin. The second plugin was updated and activated too.
http://gyazo.com/685fcdfe356310a90154e1ae338f1995
Just tested the core update but i hangs after download. No unzip or installation.
#5
@
13 years ago
Maybe some new informations.
Flush zlib compressed buffer stops site creation at this point. So i don't flush it an the update site will show normal.
Also chr(0) instead of [SPACE] don't work for me to fill the buffer.
function wp_ob_end_flush_all() { echo "\n<!--".str_repeat(' ', 4100)."-->\n"; $levels = ob_get_level(); for ( $i = 0; $i < $levels; $i++ ) { $b = ob_get_status(); if ( strpos($b['name'], 'zlib') === false ) { @ob_end_flush(); @ob_flush(); @flush(); } } @ob_start(); }
#6
@
12 years ago
- Cc pbaylies added
See also another solution to this (not mine); I was seeing occasional error log entries (possibly wp-cron?) for this issue on a site that uses the WP HTTP Compression plugin, so again, looks like an issue that pops up sometimes when ob_gzhandler is used for output buffering.
#7
@
11 years ago
I'm curious to know why the wp_ob_end_flush_all is necessary? It seems to be breaking in combination with Nextgen 2 sometimes, probably due to its output-buffering. There's a note about PHP 5.2, is this an old workaround?
#8
@
10 years ago
Topic is DISCUSSED here - https://core.trac.wordpress.org/ticket/18525
Related: #11588