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

Change subject: FileRepo: create output buffer and set ob_implicit_flush for 
file streaming
......................................................................

FileRepo: create output buffer and set ob_implicit_flush for file streaming

HHVM does not flush automatically until the output is done, unless
flush() is called. We create an output buffer so that PHP is aware
of the amount of data in the output buffer; we set ob_implicit_flush
so that, when output buffer is full and being flushed, it flushes
HHVM's buffer as well, emptying the OOM culprit.

Bug: T172851
Change-Id: I34dd1034590779ab51f197762177ad03291e3581
---
M includes/filerepo/FileRepo.php
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/92/370792/1

diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index f89d96b..dc36e50 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -1602,9 +1602,15 @@
                $path = $this->resolveToStoragePath( $virtualUrl );
                $params = [ 'src' => $path, 'headers' => $headers, 'options' => 
$optHeaders ];
 
+               // T172851: HHVM does not flush the output properly, causing OOM
+               ob_start( NULL, 1048576 );
+               ob_implicit_flush( true );
+
                $status = $this->newGood();
                $status->merge( $this->backend->streamFile( $params ) );
 
+               ob_end_flush();
+
                return $status;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34dd1034590779ab51f197762177ad03291e3581
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Zhuyifei1999 <zhuyifei1...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to