Skip to content

fix sporadic failures to load DLLs by lazy loading them#74

Open
tgummerer wants to merge 1 commit into
atotto:masterfrom
tgummerer:tg/lazy-load-dll
Open

fix sporadic failures to load DLLs by lazy loading them#74
tgummerer wants to merge 1 commit into
atotto:masterfrom
tgummerer:tg/lazy-load-dll

Conversation

@tgummerer

Copy link
Copy Markdown

On Windows DLL loading sometimes fails for spurious reasons. The panic is always in the following form:

syscall.MustLoadDLL(...)
	/opt/hostedtoolcache/go/1.21.1/x64/src/syscall/dll_windows.go:94
github.com/atotto/clipboard.init()
	/home/runner/go/pkg/mod/github.com/atotto/clipboard@v0.1.4/clipboard_windows.go:22 +0x347

This appears to be happening while loading the application, and was a frequent issue in CI tests in github.com/pulumi/pulumi. We can fix this by lazy loading the DLLs instead. We've been using this fix in our go.mod, using a replace statement (see pulumi/pulumi#17410), but would love to get this upstreamed, so we can remove that replace, and hopefully it helps others as well.

@tgummerer

Copy link
Copy Markdown
Author

Friendly ping @atotto. Any interest?

tgummerer added a commit to pulumi/pulumi that referenced this pull request Jul 16, 2026
atotto/clipboard suffers from unfortunate crashes on windows because
of DLL loading. Unfortunately upstream doesn't seem to accept my PR
atotto/clipboard#74.

We are currently using replace statements for this, but those don't
apply to downstream dependencies.  Instead of trying to fix all
downstream dependencies manually, let's vendor
charmbracelet/bubbles/textinput, and make it use the fixed
atotto/clipboard (also vendored).  This way downstream
dependencies (for example pulumi-random, which currently causes flakes
in CI, see #23958) will get the
correct version automatically.

As a new version of the dependency gets released, it'll pull in the fix.
pulumi-bot pushed a commit to pulumi/pulumi that referenced this pull request Jul 16, 2026
atotto/clipboard suffers from unfortunate crashes on windows because
of DLL loading. Unfortunately upstream doesn't seem to accept my PR
atotto/clipboard#74.

We are currently using replace statements for this, but those don't
apply to downstream dependencies.  Instead of trying to fix all
downstream dependencies manually, let's vendor
charmbracelet/bubbles/textinput, and make it use the fixed
atotto/clipboard (also vendored).  This way downstream
dependencies (for example pulumi-random, which currently causes flakes
in CI, see #23958) will get the
correct version automatically.

As a new version of the dependency gets released, it'll pull in the fix.
pull Bot pushed a commit to nebula-aac/pulumi that referenced this pull request Jul 16, 2026
atotto/clipboard suffers from unfortunate crashes on windows because of
DLL loading. Unfortunately upstream doesn't seem to accept my PR
atotto/clipboard#74.

We are currently using replace statements for this, but those don't
apply to downstream dependencies. Instead of trying to fix all
downstream dependencies manually, let's vendor
charmbracelet/bubbles/textinput, and make it use the fixed
atotto/clipboard (also vendored). This way downstream dependencies (for
example pulumi-random, which currently causes flakes in CI, see
pulumi#23958) will get the correct
version automatically.

As a new version of the dependency gets released, it'll pull in the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant