Elukey has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/346695 )

Change subject: (DO NOT SUBMIT) monkey patch Redis to skip QUIT
......................................................................

(DO NOT SUBMIT) monkey patch Redis to skip QUIT

The HHVM implementation of the Redis class close the connection by
sending the 'QUIT' command and immediately close the socket. That
prevents the client from receiving the acknowledgement 'OK' from the
server resulting in extra TCP RST packets being emitted.

Extend the Redis class to rewrite the close method.
Update the object constructor to refer to the new class
RedisMonkeyPatched.

https://github.com/facebook/hhvm/issues/7757
Bug: T125735

Change-Id: I713984fb28d9280557b5ced5a7859ed210b54986
---
M includes/libs/redis/RedisConnectionPool.php
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/95/346695/1

diff --git a/includes/libs/redis/RedisConnectionPool.php 
b/includes/libs/redis/RedisConnectionPool.php
index 7f43436..8cd48bb 100644
--- a/includes/libs/redis/RedisConnectionPool.php
+++ b/includes/libs/redis/RedisConnectionPool.php
@@ -26,6 +26,19 @@
 use Psr\Log\LoggerInterface;
 
 /**
+ * Contacts: elukey || hashar
+ */
+class RedisMonkeyPatched extends Redis {
+       /**
+     * Skip sending QUIT and just close socket
+     */
+       public function close() {
+               fclose($this->connection);
+               $this->connection = null;
+       }
+}
+
+/**
  * Helper class to manage Redis connections.
  *
  * This can be used to get handle wrappers that free the handle when the 
wrapper
@@ -78,6 +91,9 @@
                        throw new RuntimeException(
                                __CLASS__ . ' requires a Redis client library. 
' .
                                'See 
https://www.mediawiki.org/wiki/Redis#Setup' );
+               }
+               if ( !class_exists( 'RedisMonkeyPatched' ) ) {
+                       die( "This jobrunner must be monkey patched. CC 
elukey,hashar\n" );
                }
                $this->logger = isset( $options['logger'] )
                        ? $options['logger']
@@ -227,7 +243,7 @@
                        }
                }
 
-               $conn = new Redis();
+               $conn = new RedisMonkeyPatched();
                try {
                        if ( $this->persistent ) {
                                $result = $conn->pconnect( $host, $port, 
$this->connectTimeout );

-- 
To view, visit https://gerrit.wikimedia.org/r/346695
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I713984fb28d9280557b5ced5a7859ed210b54986
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Elukey <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to