-
Notifications
You must be signed in to change notification settings - Fork 18k
syscall: add Flock implementation for Illumos #35618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It was my impression that the syscall package was effectively frozen at this stage. Is that just from an exposed API perspective? That is, is this OK because there's already Flock in there for other platforms? |
My personal view is that it's ok because:
(Either of those on its own might not justify extending the |
Yeah, it's okay to modify syscall for the reasons Bryan mentioned. (API already existing + for internal use) |
Change https://golang.org/cl/222277 mentions this issue: |
…IX and Solaris AIX, Solaris, and Illumos all appear to implement fcntl deadlock detection at the granularity of processes. However, we are acquiring and releasing file locks on individual goroutines running concurrently: our locking occurs at a much finer granularity. As a result, these platforms occasionally fail with EDEADLK errors, when they detect locks that would be _misordered_ in a single-threaded program but are safely _unordered_ in a multi-threaded context. To work around the spurious errors, we treat EDEADLK as always spurious, and retry the failing system call with a bounded exponential backoff. This approach may introduce substantial latency since we no longer benefit from kernel-scheduled wakeups in case of collisions, but high-latency operations seem better than spurious failures. Updates #33974 Updates #35618 Fixes #32817 Change-Id: I58b2c6a0f143bce55d6460fd4ddc3db83577ada7 Reviewed-on: https://go-review.googlesource.com/c/go/+/222277 Reviewed-by: Jay Conrod <[email protected]>
Change https://golang.org/cl/255377 mentions this issue: |
Change https://golang.org/cl/255258 mentions this issue: |
Change https://golang.org/cl/257940 mentions this issue: |
This was addressed by CL 255258. Updates #35618 Change-Id: I8dd5b30a846f2d16a3d4752304861d7d2178d1cf Reviewed-on: https://go-review.googlesource.com/c/go/+/257940 Trust: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
On most Unix and Unix-like platforms, the Go
syscall
package provides theFlock
function (and the associated constantsLOCK_EX
,LOCK_SH
,LOCK_UN
).That functionality is not provided for Solaris, because (as far as I am aware) Oracle Solaris still does not provide the corresponding system call (see also #24684). However, it appears that the Illumos kernel has supported
flock
since 2015 (https://www.illumos.org/issues/3252).We should update the
syscall
package to provideFlock
onillumos
. Then we can switchcmd/go/internal/lockedfile/internal/filelock
over to use it, and hopefully avoid apparent kernel bugs that affect the currentFcntl
implementation used on AIX and Solaris (#32817).CC @jclulow @gdamore @tklauser
The text was updated successfully, but these errors were encountered: