r84728 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84727‎ | r84728 | r84729 >
Date:03:30, 25 March 2011
Author:tstarling
Status:ok
Tags:
Comment:
Committing live patch to log memcached timeout errors
Modified paths:
  • /branches/wmf/1.17wmf1/includes/objectcache/MemcachedClient.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/objectcache/MemcachedClient.php
@@ -865,7 +865,17 @@
866866 function _load_items( $sock, &$ret ) {
867867 while ( 1 ) {
868868 $decl = fgets( $sock );
869 - if ( $decl == "END\r\n" ) {
 869+ if ( $decl === false ) {
 870+ // PATCH: log timeout errors -- TS
 871+ $info = stream_get_meta_data( $sock );
 872+ if ( $info['timed_out'] ) {
 873+ wfDebugLog( 'memcached', "timeout\n" );
 874+ } else {
 875+ wfDebugLog( 'memcached', "read error\n" );
 876+ }
 877+ $this->_close_sock( $sock );
 878+ return false;
 879+ } elseif ( $decl == "END\r\n" ) {
870880 return true;
871881 } elseif ( preg_match( '/^VALUE (\S+) (\d+) (\d+)\r\n$/', $decl, $match ) ) {
872882 list( $rkey, $flags, $len ) = array( $match[1], $match[2], $match[3] );

Status & tagging log