WordPress y lentitudes

Carajo!

Bien emocionado porque ya tenía mi blog con WordPress instalado. Todo se veía súper bien, configuré el título del blog y recordé que tenía un blog en blogger. Por mi mente pasó la idea de mudar los pocos posts que tenía ahí a este sitio…. tan trivial como copiar y pegar no?

Pues NO!!!! empiezo con el primero y pues normal, el segundo fue lento, el tercero más lento aún, los siguientes fueron una pesadilla!!! qué coño pasa? algo le sucede a mi SO? me propongo arreglarlo a pesar de que son las 2:15am….

Dado que el maldito bloqueó la máquina tuve que reiniciar el servidor!!!!

Acto seguido realicé lo siguiente:

1. Ver el log de errores de apache…

tail /var/log/httpd/error_log

Vi que aparecían ciertas líneas sospechosas:

[Mon Aug 24 01:49:43 2009] [notice] Apache/2.2.3 (CentOS) configured — resuming normal operations

[root@homeserver ~]# tail /var/log/httpd/error_log

[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzinflate() [<a href=’function.gzinflate’>function.gzinflate</a>]: buffer error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1787

[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzuncompress() [<a href=’function.gzuncompress’>function.gzuncompress</a>]: data error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1792

[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzinflate() [<a href=’function.gzinflate’>function.gzinflate</a>]: buffer error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1787

[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzuncompress() [<a href=’function.gzuncompress’>function.gzuncompress</a>]: data error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1792

[Mon Aug 24 01:49:40 2009] [notice] core dump file size limit raised to 4294967295 bytes

2. Qué hay en esas líneas?

/**

* Decompression of deflated string.

*

* Will attempt to decompress using the RFC 1950 standard, and if that fails

* then the RFC 1951 standard deflate will be attempted. Finally, the RFC

* 1952 standard gzip decode will be attempted. If all fail, then the

* original compressed string will be returned.

*

* @since 2.8

*

* @param string $compressed String to decompress.

* @param int $length The optional length of the compressed data.

* @return string|bool False on failure.

*/

function decompress( $compressed, $length = null ) {

$decompressed = gzinflate( $compressed );

if ( false !== $decompressed )

return $decompressed;

$decompressed = gzuncompress( $compressed );

if ( false !== $decompressed )

return $decompressed;

if ( function_exists(‘gzdecode’) ) {

$decompressed = gzdecode( $compressed );

if ( false !== $decompressed )

return $decompressed;

}

return $compressed;

}

3. Cómo se arregla? Pues busqué en google y encontré muchas soluciones que decían que borrara la función, que le pusiera el “return $compressed;” al principio pero la verdad no me parecía lógico…. más adelante algún ser razonable (MartyThornley) mencionó lo siguiente (la fuente de la información es esta):

Just tried a quick fix and it seemed to work for now:

Changed line 1787 from

$decompressed = gzinflate( $compressed );

to:

if (false !== $compressed) $decompressed = gzinflate( $compressed );

The idea being that the error said it was a data error, so that line must not like whatever is coming through in that $compressed variable.

This might be a better solution than just deleting. That way if some other functions need to use that $compressed variable, it should still work. Right?

Lo que comenta me pareció coherente aunque la solución fue burda. La definición de la función indica que se va a recibir un string pero nunca se valida si el string está vacío y al parecer las funciones de descompresión se “atontan” si el string está vacío. Para no hacer el cuento largo la función finalmente quedó así y funciona ok.

/**

* Decompression of deflated string.

*

* Will attempt to decompress using the RFC 1950 standard, and if that fails

* then the RFC 1951 standard deflate will be attempted. Finally, the RFC

* 1952 standard gzip decode will be attempted. If all fail, then the

* original compressed string will be returned.

*

* @since 2.8

*

* @param string $compressed String to decompress.

* @param int $length The optional length of the compressed data.

* @return string|bool False on failure.

*/

function decompress( $compressed, $length = null ) {

if(!empty($compressed) and !is_null($compressed)){ //added this line to avoid error

$decompressed = gzinflate( $compressed );

if ( false !== $decompressed )

return $decompressed;

$decompressed = gzuncompress( $compressed );

if ( false !== $decompressed )

return $decompressed;

if ( function_exists(‘gzdecode’) ) {

$decompressed = gzdecode( $compressed );

if ( false !== $decompressed )

return $decompressed;

}

}

return $compressed;

}

[Mon Aug 24 01:49:43 2009] [notice] Apache/2.2.3 (CentOS) configured — resuming normal operations
[root@homeserver ~]# tail /var/log/httpd/error_log
[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzinflate() [<a href=’function.gzinflate’>function.gzinflate</a>]: buffer error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1787
[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzuncompress() [<a href=’function.gzuncompress’>function.gzuncompress</a>]: data error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1792
[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzinflate() [<a href=’function.gzinflate’>function.gzinflate</a>]: buffer error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1787
[Mon Aug 24 01:08:24 2009] [error] [client 189.141.246.93] PHP Warning:  gzuncompress() [<a href=’function.gzuncompress’>function.gzuncompress</a>]: data error in /var/www/html/lamp-ios.com/blog/wp-includes/http.php on line 1792
[Mon Aug 24 01:49:40 2009] [notice] core dump file size limit raised to 4294967295 bytes

Tags: ,

Comments are closed.