Skip to content

Commit 7120c6e

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop expedited
Accepted Public Pull Requests: - magento#22795: fixed issue magento#22736 - Cursor position not in right side of search keyword in mobile (by @sanjaychouhan-webkul) - magento#22876: Fixed issue magento#22875 Billing Agreements page title need to be improved (by @amitvishvakarma) - magento#22607: Implement Better Error Handling and Fix Waits on Null PIDs in Parallel SCD Execution (by @davidalger) Fixed GitHub Issues: - magento#22736: Cursor position not in right side of search keyword in search box when click on search again (Mobile issue) (reported by @bhavik43) has been fixed in magento#22795 by @sanjaychouhan-webkul in 2.3-develop branch Related commits: 1. 5621c44 2. 3ca7c02 3. 3c8dcea 4. c79e1ff - magento#22875: Billing Agreements page title need to be improved (reported by @amitvishvakarma) has been fixed in magento#22876 by @amitvishvakarma in 2.3-develop branch Related commits: 1. 3fb72ae 2. ed84c8d - magento#21852: Random Error while waiting for package deployed (reported by @talset) has been fixed in magento#22607 by @davidalger in 2.3-develop branch Related commits: 1. 49b3c72 2. 7631cbc 3. e1525a8 4. 8d0a3d8 5. 2be3105 - magento#22563: Parallelised execution of static content deploy is broken on 2.3-develop (reported by @hostep) has been fixed in magento#22607 by @davidalger in 2.3-develop branch Related commits: 1. 49b3c72 2. 7631cbc 3. e1525a8 4. 8d0a3d8 5. 2be3105
2 parents baa23de + 52a5bde commit 7120c6e

File tree

3 files changed

+63
-14
lines changed

3 files changed

+63
-14
lines changed

app/code/Magento/Deploy/Process/Queue.php

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use Magento\Deploy\Package\Package;
1111
use Magento\Deploy\Service\DeployPackage;
1212
use Magento\Framework\App\ResourceConnection;
13-
use Psr\Log\LoggerInterface;
1413
use Magento\Framework\App\State as AppState;
1514
use Magento\Framework\Locale\ResolverInterface as LocaleResolver;
15+
use Psr\Log\LoggerInterface;
1616

1717
/**
1818
* Deployment Queue
@@ -165,6 +165,7 @@ public function process()
165165
$packages = $this->packages;
166166
while (count($packages) && $this->checkTimeout()) {
167167
foreach ($packages as $name => $packageJob) {
168+
// Unsets each member of $packages array (passed by reference) as each is executed
168169
$this->assertAndExecute($name, $packages, $packageJob);
169170
}
170171
$this->logger->info('.');
@@ -224,12 +225,8 @@ private function assertAndExecute($name, array & $packages, array $packageJob)
224225
* @param bool $dependenciesNotFinished
225226
* @return void
226227
*/
227-
private function executePackage(
228-
Package $package,
229-
string $name,
230-
array &$packages,
231-
bool $dependenciesNotFinished
232-
) {
228+
private function executePackage(Package $package, string $name, array &$packages, bool $dependenciesNotFinished)
229+
{
233230
if (!$dependenciesNotFinished
234231
&& !$this->isDeployed($package)
235232
&& ($this->maxProcesses < 2 || (count($this->inProgress) < $this->maxProcesses))
@@ -338,14 +335,41 @@ private function isDeployed(Package $package)
338335
{
339336
if ($this->isCanBeParalleled()) {
340337
if ($package->getState() === null) {
338+
$pid = $this->getPid($package);
339+
340+
// When $pid comes back as null the child process for this package has not yet started; prevents both
341+
// hanging until timeout expires (which was behaviour in 2.2.x) and the type error from strict_types
342+
if ($pid === null) {
343+
return false;
344+
}
345+
341346
// phpcs:ignore Magento2.Functions.DiscouragedFunction
342-
$pid = pcntl_waitpid($this->getPid($package), $status, WNOHANG);
343-
if ($pid === $this->getPid($package)) {
347+
$result = pcntl_waitpid($pid, $status, WNOHANG);
348+
if ($result === $pid) {
344349
$package->setState(Package::STATE_COMPLETED);
350+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
351+
$exitStatus = pcntl_wexitstatus($status);
352+
353+
$this->logger->info(
354+
"Exited: " . $package->getPath() . "(status: $exitStatus)",
355+
[
356+
'process' => $package->getPath(),
357+
'status' => $exitStatus,
358+
]
359+
);
345360

346361
unset($this->inProgress[$package->getPath()]);
347362
// phpcs:ignore Magento2.Functions.DiscouragedFunction
348363
return pcntl_wexitstatus($status) === 0;
364+
} elseif ($result === -1) {
365+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
366+
$errno = pcntl_errno();
367+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
368+
$strerror = pcntl_strerror($errno);
369+
370+
throw new \RuntimeException(
371+
"Error encountered checking child process status (PID: $pid): $strerror (errno: $errno)"
372+
);
349373
}
350374
return false;
351375
}
@@ -361,7 +385,7 @@ private function isDeployed(Package $package)
361385
*/
362386
private function getPid(Package $package)
363387
{
364-
return isset($this->processIds[$package->getPath()]) ?? null;
388+
return $this->processIds[$package->getPath()] ?? null;
365389
}
366390

367391
/**
@@ -380,15 +404,30 @@ private function checkTimeout()
380404
* Protect against zombie process
381405
*
382406
* @throws \RuntimeException
407+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
383408
* @return void
384409
*/
385410
public function __destruct()
386411
{
387412
foreach ($this->inProgress as $package) {
413+
$pid = $this->getPid($package);
414+
$this->logger->info(
415+
"Reaping child process: {$package->getPath()} (PID: $pid)",
416+
[
417+
'process' => $package->getPath(),
418+
'pid' => $pid,
419+
]
420+
);
421+
388422
// phpcs:ignore Magento2.Functions.DiscouragedFunction
389-
if (pcntl_waitpid($this->getPid($package), $status) === -1) {
423+
if (pcntl_waitpid($pid, $status) === -1) {
424+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
425+
$errno = pcntl_errno();
426+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
427+
$strerror = pcntl_strerror($errno);
428+
390429
throw new \RuntimeException(
391-
'Error while waiting for package deployed: ' . $this->getPid($package) . '; Status: ' . $status
430+
"Error encountered waiting for child process (PID: $pid): $strerror (errno: $errno)"
392431
);
393432
}
394433
}

app/code/Magento/Paypal/Controller/Billing/Agreement/Index.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
*/
77
namespace Magento\Paypal\Controller\Billing\Agreement;
88

9-
class Index extends \Magento\Paypal\Controller\Billing\Agreement
9+
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
10+
11+
/**
12+
* Index Controller.
13+
*/
14+
class Index extends \Magento\Paypal\Controller\Billing\Agreement implements HttpGetActionInterface
1015
{
1116
/**
1217
* View billing agreements
@@ -16,7 +21,7 @@ class Index extends \Magento\Paypal\Controller\Billing\Agreement
1621
public function execute()
1722
{
1823
$this->_view->loadLayout();
19-
$this->_view->getPage()->getConfig()->getTitle()->prepend(__('Billing Agreements'));
24+
$this->_view->getPage()->getConfig()->getTitle()->set(__('Billing Agreements'));
2025
$this->_view->renderLayout();
2126
}
2227
}

app/code/Magento/Search/view/frontend/web/js/form-mini.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,16 @@ define([
128128
* @param {Boolean} isActive
129129
*/
130130
setActiveState: function (isActive) {
131+
var searchValue;
132+
131133
this.searchForm.toggleClass('active', isActive);
132134
this.searchLabel.toggleClass('active', isActive);
133135

134136
if (this.isExpandable) {
135137
this.element.attr('aria-expanded', isActive);
138+
searchValue = this.element.val();
139+
this.element.val('');
140+
this.element.val(searchValue);
136141
}
137142
},
138143

0 commit comments

Comments
 (0)