flock flag LOCK_NB is not working.
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
### HHVM Version
HipHop VM 3.30.5 (rel)
Compiler: 1554316314_252213575
Repo schema: 112d96bbb2e176e245869696e84e48f2841d7e4e
### Operating System and Version
Debian GNU/Linux 8
Linux 1a8a6e1e1cf8 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux
> For example, 'Debian Squeeze', 'Ubuntu 16.04', 'MacOS High Sierra'. Please
> also mention if you are using Docker or similar images.
### Standalone code, or other way to reproduce the problem
```
$filename = "itx-lock-".\md5($seed);
$fp = \fopen("/tmp/{$filename}", "w");
$s = \flock($fp, \LOCK_EX | \LOCK_NB );
```
The issue here is the process keep waiting for the lock, but the flag LOCK_NB indicate no wait.
Contributor guide
Research direction
Start by running the standalone flock reproduction on HHVM 3.30.5 under Debian GNU/Linux 8 and verify whether LOCK_NB waits instead of returning immediately. Trace the flock entry point and its lock implementation; done means a contended LOCK_EX | LOCK_NB call no longer blocks and the reported behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, php
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100