Skip to content

Commit d83a0ae

Browse files
committed
MC-32427: Sign locks in order to prevent unlock from parallel request
1 parent e29e3af commit d83a0ae

File tree

1 file changed

+6
-1
lines changed
  • lib/internal/Magento/Framework/Lock/Backend

1 file changed

+6
-1
lines changed

lib/internal/Magento/Framework/Lock/Backend/Cache.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ public function __construct(FrontendInterface $cache)
4545
public function lock(string $name, int $timeout = -1): bool
4646
{
4747
if (empty($this->lockSign)) {
48-
$this->lockSign = \bin2hex(\random_bytes(8));
48+
$this->lockSign = implode(
49+
'-',
50+
[
51+
\getmypid(), \crc32(\gethostname()), \bin2hex(\random_bytes(4))
52+
]
53+
);
4954
}
5055

5156
$data = $this->cache->load($this->getIdentifier($name));

0 commit comments

Comments
 (0)