BUG: locks not working as expected
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
$arquivo_lock = fopen("test.txt","a");
if (flock($arquivo_lock,LOCK_EX|LOCK_NB)) {
echo "Yes";
} else {
echo "No";
}
sleep(10);
fclose($arquivo_lock);
?>
Save the simple code above to the file test.php, for example. Now, in less than 10 seconds apart, open 2 (or more) tabs on your browser calling the file test.php and you will see every tab will show you Yes after some seconds. It should show Yes only on the first tab, all the other should return immediatly with No because I am using LOCK_NB flag.
This bug is pretty simple to reproduce and other people also confirmed it on Stackoverflow when I reported there.
PHP Version
8.x
Operating System
Confirmed at least on centos 9 stream and windows 11
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告された CentOS 9 Stream と Windows 11 の環境で、PHP 8.x を使用して test.php の 2 タブによる再現を実行し、LOCK_EX|LOCK_NB を指定した flock に焦点を当てます。flock のエントリポイントとプラットフォーム固有のロック動作を追跡します。完了の条件は、最初のリクエストが Yes を報告し、重複するリクエストが直ちに No を返すことを、確認済みの環境でカバーできることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100