winwatchprobe

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: BSD-3-Clause Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command winwatchprobe is the live-verify harness for belluikit/bellui#68 — intermittent Go runtime fatals (runtime.semawakeup / runtime.semasleep / netpoll failed, all errno=6 = ERROR_INVALID_HANDLE) in internal/repository on windows/arm64.

The cause was a double CloseHandle in fsnotify's Windows backend: a completion packet queued before a watch was torn down still carries that watch's address, and the unconditional re-arm at the end of readEvents closed its already-closed handle a second time. Windows reissues a closed handle's value to the next caller, which in a Go program is most often the runtime's own CreateEvent for a new M — so the stray close destroys a handle the runtime believes it owns and the process aborts somewhere unrelated. Fixed in github.com/belluikit/fsnotify; see that repo's FORK.md.

This probe reports the two numbers that track the fix, neither of which needs an instrumented build:

  • Bail-out rate. A watcher Close that hangs is the second, causally linked defect (fsnotify's sendError swallowed Close's handshake token, which the failing CancelIo of a double-closed handle is what triggers). bellui's closeWatcher gives up after 5s and leaks the reader, so a Destroy taking that long is a bail-out. Was 4 per 200 rounds; expected 0.

  • Handle drift. Each bail-out leaks the reader's OS handles, so the process handle count creeps up. This is also what refuted the original theory in #68, which blamed the crash on handle *exhaustion*: the count never grows anywhere near far enough, and ERROR_INVALID_HANDLE on a handle the runtime already owns is a stray close, not a failure to allocate. Expected flat.

Run on a Windows box (the windows/arm64 runner is where this reproduces):

go run ./hack/winwatchprobe -rounds 200

Exit status is non-zero if any bail-out is seen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL