Repository navigation
fix(libkernel): return EWOULDBLOCK from a contended LOCK_NB flock - #1764
Conversation
|
Current-main check: this branch is 21 commits behind |
|
Current-base update: this dependent branch is 30 commits behind |
7954f31 to
28f74c1
Compare
|
Linux run, since the description says it wasn't run there: Ubuntu 24.04, GCC 13.3.0, glibc 2.39, Release. The two commits apply as one clean diff onto current main ( I also compared the Windows tracking with FreeBSD's |
28f74c1 to
a61c879
Compare
|
@nauroth Thanks for the Linux run and the @MarcZX100 Rebased onto |
|
Tested on Windows with Palworld (PPSA23126, v01.102.999). Windows 11 22621, GCC 15.2.0 UCRT Release, this PR (a61c879) merged onto main 1f0c9fe plus local unimplemented-export declarations the title needs to start. Before (main): start-up aborts in sentry-native's lock handling: a second open of After: no flock error; start-up continues (engine threads, GPU init, settings file written) and stops later on unrelated problems. ctest: 0 failed of 559, 3 skipped, same as main. Limits: one title; that the call uses |
a61c879 to
dc84f28
Compare
|
Rebased onto |
flock_nid_postfix threw on every failure, so a LOCK_NB request on a lock held through another descriptor ended the process. FreeBSD flock(2) returns -1 with EWOULDBLOCK there. Return guest errno 35 when LOCK_NB is set and the host reports the lock as held: ERROR_LOCK_VIOLATION on Windows, EWOULDBLOCK on Linux. Other failures still throw.
dc84f28 to
6d7d4b0
Compare
|
#1755 is merged, so this is rebased onto |
…-contention fix(libkernel): return EWOULDBLOCK from a contended LOCK_NB flock
What
Fixes #1763.
flock_nid_postfixreturns -1 with guest errno 35 (EWOULDBLOCK) whenLOCK_NBis set and the host reports the lock as held:ERROR_LOCK_VIOLATIONon Windows,EWOULDBLOCKon Linux. This follows FreeBSDflock(2). Other failures still throw. As on FreeBSD, a failedLOCK_NBconversion leaves the descriptor without a lock.Builds on #1755 (merged): on Windows its per-descriptor lock state is what makes a contended request fail with
ERROR_LOCK_VIOLATIONand not with a stacked-lock error.Tested
Windows 11 (10.0.26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 4070 Laptop:
guest_filesystemgains contention cases on two descriptors of one file:LOCK_EX | LOCK_NBandLOCK_SH | LOCK_NBagainst an exclusive lock,LOCK_EX | LOCK_NBagainst a shared lock (all -1 with errno 35), shared locks on both descriptors, an exclusive lock once the other descriptor unlocks, andLOCK_SH | LOCK_EX | LOCK_NB | 0x10taking an exclusive lock (decoded as FreeBSD does in fix(libkernel): give flock BSD semantics on Windows #1755), so a sharedLOCK_NBrequest from the other descriptor fails with errno 35.error=33); with it the cases pass.ctestwithANYPS5_REQUIRE_VULKAN=1 --repeat until-fail:3: 610/611 passed on6635c7ab.libstarget builds. The failure,pr_overlap_encoding, also fails on main locally: it patchessubprocess._text_encoding, which Python 3.10 does not have.guest_filesystemon Ubuntu 24.04 (comment below) before the combined-operation case was added.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)