What version of Go are you using (go version)?
$ go version
go version go1.18.4 freebsd/amd64
Does this issue reproduce with the latest release?
Yes, but it's dependent on the FreeBSD release. i.e. issue present on FreeBSD 13.1 and greater.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-mod=vendor"
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go118"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go118/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="cc"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/usr/local/poudriere/ports/default/net/rclone/work/github.com/rclone/[email protected]/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3160769938=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.18.4 freebsd/amd64
GOROOT/bin/go tool compile -V: compile version go1.18.4
uname -v: FreeBSD 14.0-CURRENT #3 main-n256462-79e1500276a-dirty: Thu Jun 30 19:37:24 EDT 2022 root@e6220:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG
lldb --version: lldb version 14.0.5 (https://github.com/llvm/llvm-project.git revision llvmorg-14.0.5-0-gc12386ae247c)
clang revision llvmorg-14.0.5-0-gc12386ae247c
llvm revision llvmorg-14.0.5-0-gc12386ae247c
What did you do?
Tried to use the rclone program https://github.com/rclone/rclone to mount a remote filesystem. (rclone uses fuse behind the scenes.)
# rclone mount ~ /mnt
What did you expect to see?
(nothing) the rclone mount command should complete without error.
What did you see instead?
# rclone mount ~ /mnt
2022/07/27 17:57:57 ERROR : /mnt: Unmounted rclone mount
2022/07/27 17:57:57 Fatal error: failed to umount FUSE fs: resource temporarily unavailable
Discussion
The issue is discussed in FreeBSD bug 258056 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258056
That *BSD does not map regular files to polling is covered here #19093
Possible patch
Patch below adds "/dev/fuse" as another pollable = false exception.
--- src/os/file_unix.go.orig 2022-07-12 11:22:57.000000000 -0400
+++ src/os/file_unix.go 2022-07-27 08:35:28.234028000 -0400
@@ -165,6 +165,10 @@
if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && typ == syscall.S_IFIFO {
pollable = false
}
+
+ if runtime.GOOS == "freebsd" && name == "/dev/fuse" { // /dev/fuse always reports ready for writing
+ pollable = false
+ }
}
}
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes, but it's dependent on the FreeBSD release. i.e. issue present on FreeBSD 13.1 and greater.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Tried to use the rclone program https://github.com/rclone/rclone to mount a remote filesystem. (rclone uses fuse behind the scenes.)
What did you expect to see?
(nothing) the rclone mount command should complete without error.
What did you see instead?
Discussion
The issue is discussed in FreeBSD bug 258056 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258056
That *BSD does not map regular files to polling is covered here #19093
Possible patch
Patch below adds "/dev/fuse" as another pollable = false exception.
--- src/os/file_unix.go.orig 2022-07-12 11:22:57.000000000 -0400 +++ src/os/file_unix.go 2022-07-27 08:35:28.234028000 -0400 @@ -165,6 +165,10 @@ if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && typ == syscall.S_IFIFO { pollable = false } + + if runtime.GOOS == "freebsd" && name == "/dev/fuse" { // /dev/fuse always reports ready for writing + pollable = false + } } }