WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 18 months ago

#18239 new defect (bug)

wp_ob_end_flush_all() hangs the output buffering, during plugin update/install

Reported by: mamborambo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 3.2.1
Component: Upgrade/Install Keywords: output hangs
Focuses: Cc:

Description

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 (6)

comment:2 Tom Braider3 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();
		}
}

comment:3 kurtpayne3 years ago

  • Cc kpayne@… added

@Tom Braider, can you try the patch on #18525 and let me know if that works for you?

comment:4 Tom Braider2 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.

Last edited 2 years ago by Tom Braider (previous) (diff)

comment:5 Tom Braider21 months 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();
}

comment:6 pbaylies18 months 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.

Note: See TracTickets for help on using tickets.