jenkins-bot has submitted this change and it was merged. ( 
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(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: I34dd1034590779ab51f197762177ad03291e3581
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Zhuyifei1999 <zhuyifei1...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to