Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4dbe0e1

Browse filesBrowse files
committed
bug #11120 [2.3][Process] Reduce I/O load on Windows platform (romainneutron)
This PR was merged into the 2.3 branch. Discussion ---------- [2.3][Process] Reduce I/O load on Windows platform | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT When using file handles, no `stream_select` call is done. On linux platforms, `stream_select` introduce a sleep as it has 0.2s timeout, there is no such pause on Windows, producing lot's of disk I/Os when reading file handles Commits ------- ff0bb01 [Process] Reduce I/O load on Windows platform
2 parents 797d814 + ff0bb01 commit 4dbe0e1
Copy full SHA for 4dbe0e1

File tree

2 files changed

+10
-1
lines changed
Filter options

2 files changed

+10
-1
lines changed

‎src/Symfony/Component/Process/ProcessPipes.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/ProcessPipes.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ private function readFileHandles($close = false)
284284
private function readStreams($blocking, $close = false)
285285
{
286286
if (empty($this->pipes)) {
287+
usleep(Process::TIMEOUT_PRECISION * 1E4);
288+
287289
return array();
288290
}
289291

‎src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/AbstractProcessTest.php
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,14 @@ public function testRunProcessWithTimeout()
596596
}
597597
$duration = microtime(true) - $start;
598598

599-
$this->assertLessThan($timeout + Process::TIMEOUT_PRECISION, $duration);
599+
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
600+
// Windows is a bit slower as it read file handles, then allow twice the precision
601+
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
602+
} else {
603+
$maxDuration = $timeout + Process::TIMEOUT_PRECISION;
604+
}
605+
606+
$this->assertLessThan($maxDuration, $duration);
600607
}
601608

602609
public function testCheckTimeoutOnNonStartedProcess()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.