Repository navigation
Closed
Labels
Description
After initial diagnosis of gohugoio/hugo#1772, I discovered that fsnotify is using some syscalls that are unavailable on the Linux for ARM64 platform. Here is the result of go test -v ./... run:
=== RUN TestPollerWithBadFd
--- PASS: TestPollerWithBadFd (0.00s)
=== RUN TestPollerWithData
--- FAIL: TestPollerWithData (0.13s)
inotify_poller_test.go:82: poller failed: function not implemented
=== RUN TestPollerWithWakeup
--- FAIL: TestPollerWithWakeup (0.13s)
inotify_poller_test.go:101: poller failed: function not implemented
=== RUN TestPollerWithClose
--- FAIL: TestPollerWithClose (0.13s)
inotify_poller_test.go:116: poller failed: function not implemented
=== RUN TestPollerWithWakeupAndData
--- FAIL: TestPollerWithWakeupAndData (0.13s)
inotify_poller_test.go:137: poller failed: function not implemented
=== RUN TestPollerConcurrent
--- FAIL: TestPollerConcurrent (0.13s)
inotify_poller_test.go:180: poller failed: function not implemented
inotify_poller_test.go:197: expected true
=== RUN TestInotifyCloseRightAway
--- PASS: TestInotifyCloseRightAway (0.05s)
=== RUN TestInotifyCloseSlightlyLater
--- PASS: TestInotifyCloseSlightlyLater (0.18s)
=== RUN TestInotifyCloseSlightlyLaterWithWatch
--- PASS: TestInotifyCloseSlightlyLaterWithWatch (0.18s)
=== RUN TestInotifyCloseAfterRead
--- PASS: TestInotifyCloseAfterRead (0.18s)
=== RUN TestInotifyCloseCreate
--- FAIL: TestInotifyCloseCreate (0.13s)
inotify_test.go:136: Took too long to wait for event
=== RUN TestInotifyStress
--- FAIL: TestInotifyStress (0.13s)
inotify_test.go:242: Got an error from watcher: function not implemented
=== RUN TestInotifyRemoveTwice
--- PASS: TestInotifyRemoveTwice (0.00s)
=== RUN TestInotifyInnerMapLength
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
testing.RunTests(0x234a50, 0x2d23e0, 0x1e, 0x1e, 0x482000e600)
/usr/lib/go/src/testing/testing.go:562 +0x680
testing.(*M).Run(0x4820043ef0, 0x1e63b0)
/usr/lib/go/src/testing/testing.go:494 +0x84
main.main()
github.com/go-fsnotify/fsnotify/_test/_testmain.go:114 +0x118
goroutine 37 [chan receive]:
github.com/go-fsnotify/fsnotify.TestInotifyInnerMapLength(0x48200ca120)
/home/foka/go/src/github.com/go-fsnotify/fsnotify/inotify_test.go:332 +0x524
testing.tRunner(0x48200ca120, 0x2d2518)
/usr/lib/go/src/testing/testing.go:456 +0xbc
created by testing.RunTests
/usr/lib/go/src/testing/testing.go:561 +0x654
goroutine 38 [select]:
github.com/go-fsnotify/fsnotify.(*Watcher).readEvents(0x48200fc230)
/home/foka/go/src/github.com/go-fsnotify/fsnotify/inotify.go:193 +0x368
created by github.com/go-fsnotify/fsnotify.NewWatcher
/home/foka/go/src/github.com/go-fsnotify/fsnotify/inotify.go:60 +0x3c4
exit status 2
FAIL github.com/go-fsnotify/fsnotify 6.358s
Tested on Debian sid (arm64), Linux kernel 3.16.0-4-arm64, go1.5.2 linux/arm64, on Debian "porterbox" test machine asachi.debian.org running on an APM X-Gene Mustang board.
Activity
anthonyfok commentedon Jan 13, 2016
It turns out that all of the "function not implemented" (ENOSYS) errors from
go test ./...originated from Line 85 in inotify_poller.go:It turns out that epoll_wait is deprecated according to a slideshow by Linaro who ported Linux to ARM64, and therefore, only the newer epoll_pwait is provided on Linux/arm64.
Problem is, Go has not yet implemented the corresponding EpollPwait, see the "Unimplemented" section of go/src/syscall/syscall_linux.go:948 and golang.org/x/sys/unix/syscall_linux.go:971.
It seems that the Go developers are aware of the issue, see golang/go#10235, though the milestone there changed from Go1.5 to Go1.6Early, and now Unplanned... Hmm...
anthonyfok commentedon Jan 13, 2016
By the way, for completeness sake,
syscall.InotifyInit()should probably be changed tosyscall.InotifyInit1(0)too in inotify.go.inotify_initis a "system call without flags parameter" according to this slide and /usr/include/asm-generic/unistd.h, soinotify_initis again not available on ARM64 though Go has a wrapper for it. ;-)Last but not least, the following links were very helpful in teaching me to understand
epoll_waitandepoll_pwaitbetter:__NR_epoll_wait: Julia fails to build on arm64 due to missing __NR_epoll_wait JuliaLang/julia#14373nathany commentedon Jan 14, 2016
Thanks for researching all this Anthony. So in summary:
We can switch to InotifyInit1 at anytime, which I believe is available in the standard library sys package. It may require a slightly newer Linux kernel, but that's fine so long as the README indicates the requirements. Feel free to prepare a pull request for that if you like.
[-]"go test" fails on Linux/arm64 (aarch64) with "function not implemented" errors[/-][+]Add support for Linux/arm64 (aarch64)[/+]anthonyfok commentedon Jan 14, 2016
Thank you for such a wonderful plan of action that you have summarized.
About adding EpollPwait to x/sys, I don't think I am currently up to the challenge due to a lack of experience in this area and a lack of time (will be very busy in the next week). That said, if no one else has fixed it in a month or two, I would be interested to experiment with it and see if I could come up with a preliminary patch. :-)
You have a good point there about InotifyInit1(). Since it would require a newer kernel (Linux 2.6.27?), and it is working fine for all architectures anyway, I think I've better leave it alone, as in "if it ain't broke, don't fix it". 😉
nathany commentedon Jan 21, 2016
Ok.
anthonyfok commentedon Apr 18, 2016
Related to #130.
And looks like it has been fixed in golang.org/x/sys/unix, thanks to Riku Voipio (@suihkulokki) in commit golang/sys@324e137, and the upstream golang/go#10235 has closed accordingly.
If it is okay with you, I would like to do some final testing, namely, to refresh relevant Go packages in Debian and make sure it is all working properly on arm64 test machine, before coming back and close this issue. :-)
Many thanks!
nathany commentedon Apr 18, 2016
Thanks Anthony. If you could do some testing with #135, it would be much appreciated.
anthonyfok commentedon Apr 20, 2016
Fixed by Riku Voipio (golang/sys@324e137 and #135).
fsnotify v1.3.0 works great on Linux/arm64 (aarch64). 👍
Thank you all!
fix TestLogsFollowGoroutinesWithStdout in arm64
fix TestLogsFollowGoroutinesWithStdout in arm64
Merge branch 'fix_TestLogsFollowGoroutinesWithStdout' into 'huawei-1.…
fix TestLogsFollowGoroutinesWithStdout in arm64