Skip to content
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

os: TestNetworkSymbolicLink failure with The network path was not found. #61467

Closed
qiulaidongfeng opened this issue Jul 20, 2023 · 24 comments
Closed
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@qiulaidongfeng
Copy link
Contributor

qiulaidongfeng commented Jul 20, 2023

What version of Go are you using (go version)?

$ go version
go version go1.21rc3 windows/amd64

Does this issue reproduce with the latest release?

yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=E:\gofile\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=E:\gofile
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct
set GOROOT=C:\Users\Administrator\.go\current
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\Administrator\.go\current\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21rc3
set GCCGO=gccgo
set GOAMD64=v2
set AR=ar
set CC=clang
set CXX=clang++
set CGO_ENABLED=0
set GOMOD=
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=D:\TEMP\go-build1363264525=/tmp/go-build -gno-record-gcc-switches
GOROOT/bin/go version: go version go1.21rc3 windows/amd64
GOROOT/bin/go tool compile -V: compile version go1.21rc3
lldb --version: lldb version 16.0.5
gdb --version: GNU gdb (GDB for MinGW-W64 x86_64, built by Brecht Sanders) 13.2

What did you do?

go test os

What did you expect to see?

Test passed.

What did you see instead?

--- FAIL: TestNetworkSymbolicLink (0.08s)
    os_windows_test.go:492: CreateFile \\localhost\GoSymbolicLinkTestShare\: The network path was not found.
FAIL
exit status 1
FAIL    os      6.903s
@bcmills
Copy link
Contributor

bcmills commented Jul 20, 2023

(attn @golang/windows)

Can you provide some more debugging detail?

If you modify the test to add a time.Sleep(10 * time.Minute) before that t.Fatal, can you see the GoSymbolicLinkTestShare share in, say, Windows Explorer?

@bcmills
Copy link
Contributor

bcmills commented Jul 20, 2023

Does the same test pass using go1.20.6?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 20, 2023
@bcmills bcmills added this to the Backlog milestone Jul 20, 2023
@bcmills bcmills changed the title os: TestNetworkSymbolicLink FAIL os: TestNetworkSymbolicLink failure with The network path was not found. Jul 20, 2023
@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 20, 2023
@qiulaidongfeng
Copy link
Contributor Author

qiulaidongfeng commented Jul 21, 2023

(attn @golang/windows)

Can you provide some more debugging detail?

If you modify the test to add a time.Sleep(10 * time.Minute) before that t.Fatal, can you see the GoSymbolicLinkTestShare share in, say, Windows Explorer?

Execute net share to see

GoSymbolicLinkTestShare
             D:\TEMP\TestNetworkSymbolicLink514216218\001\GoSymbolicLinkTestShare

@qiulaidongfeng
Copy link
Contributor Author

qiulaidongfeng commented Jul 21, 2023

add a time.Sleep(10 * time.Minute) before that t.Fatal.

go test -timeout=10000s
--- FAIL: TestNetworkSymbolicLink (600.13s)
    os_windows_test.go:494: CreateFile \\localhost\GoSymbolicLinkTestShare\: The network path was not found.
FAIL
exit status 1
FAIL    os      607.942s

@bcmills
Copy link
Contributor

bcmills commented Jul 21, 2023

Thanks. Does that test pass using go1.20.6 and go1.19.11 (or a build from source on their respective release branches)?

I wonder if this may be related to https://go.dev/cl/460595.

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 21, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 21, 2023

That error message comes from ERROR_BAD_NETPATH. Unfortunately I can't easily investigate the problem because this test does not run on the Go project's gomote servers:

gopher@GOLANG-BUILDLET C:\workdir\go\src>..\bin\go test os -run=TestNetworkSymbolicLink -v
=== RUN   TestNetworkSymbolicLink
    os_windows_test.go:473: The Server service is not started.
--- SKIP: TestNetworkSymbolicLink (0.00s)
PASS
ok      os      0.029s

@qmuntal, do you have the bandwidth to look into this?

@gopherbot
Copy link

Change https://go.dev/cl/512075 mentions this issue: os: fix TestNetworkSymbolicLink

@bcmills
Copy link
Contributor

bcmills commented Jul 21, 2023

@qiulaidongfeng, does anything about the test change if you patch in https://go.dev/cl/512075?

In particular I wonder if we need to set ACCESS_READ in the SHARE_INFO_2 struct at creation time in order for CreateFile to be able to access the share.

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 21, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 21, 2023

I'm not able to get the test to run without skipping even when running it as an administrator on a local device. 🤯

@bcmills
Copy link
Contributor

bcmills commented Jul 21, 2023

I finally got my settings sorted out so that the test will run. It passes at HEAD for me.
@qiulaidongfeng, perhaps you have some kind of firewall preventing the test from working?

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 21, 2023
@qiulaidongfeng
Copy link
Contributor Author

qiulaidongfeng commented Jul 22, 2023

@bcmills I obtained CL 512075 and found that https://github.com/golang/go/blob/master/src/os/os_windows_test.go#L484 Change to UNCPath:=shareName+"\" , and the test will pass on my computer.

@bcmills
Copy link
Contributor

bcmills commented Jul 23, 2023

That would not be a UNC path — it would no longer be testing the property it aims to test.

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 24, 2023
@bcmills bcmills modified the milestones: Backlog, Unplanned Jul 24, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 24, 2023

I still suspect that this has something to do with a system-specific firewall setting or network-security hook. Since neither I nor @qmuntal are able to reproduce this failure mode and we don't have a specific theory of what could cause it, I am not able to investigate further.

I wonder if it also depends on some specific combination of SMBv1, SMBv2, and/or SMBv3 support (see https://learn.microsoft.com/en-us/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3?tabs=server).

Moving to Unplanned since we don't have any apparent way to move forward, and since getting the test to run in the first place — let alone fail! — seems to require a lot of fairly unusual factors (running the test as an administrator, having the service running, and so on).

@qiulaidongfeng, please let us know if you figure out more about what may be causing this test to fail in your setup.

gopherbot pushed a commit that referenced this issue Jul 25, 2023
Also use a unique share name for each run of the test.

This may help with #61467, but since I couldn't reproduce the failure
in the first place I don't know. It passes locally for me.

For #61467.

Change-Id: Ie51e3cf381063e02e4849af5c1a1ed7441ce21c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/512075
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/512736 mentions this issue: os: fix test failure when SMB is not enabled

@qiulaidongfeng
Copy link
Contributor Author

After enabling SMB, the test passed, and I sent CL 512736 to fix the failure when SMB was not enabled.

@qmuntal
Copy link
Contributor

qmuntal commented Jul 25, 2023

After enabling SMB, the test passed, and I sent CL 512736 to fix the failure when SMB was not enabled.

There has to be something else. I disabled SMB1 by running Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol but I still can't reproduce the TestNetworkSymbolicLink failure.

@qiulaidongfeng
Copy link
Contributor Author

On my computer, execute Disable WindowsOptionalFeature Online FeatureName SMB1Protocol to turn off SMB and the test will fail. Execute Enable WindowsOptionalFeature Online FeatureName SMB1Protocol to turn on SMB and the test will succeed.

@qmuntal
Copy link
Contributor

qmuntal commented Jul 25, 2023

On my computer, execute Disable WindowsOptionalFeature Online FeatureName SMB1Protocol to turn off SMB and the test will fail. Execute Enable WindowsOptionalFeature Online FeatureName SMB1Protocol to turn on SMB and the test will succeed.

I'm not putting that in doubt. What I meant is that there should be another Windows capability or configuration that is missing in your computer that makes the test fail when SMB1Protocol is disabled, as I can pass the test with SMB1Protocol disabled. Therefore, if we skip the test when SMB1Protocol is disabled, we will be missing coverage from valid environments, like mine.

@bcmills
Copy link
Contributor

bcmills commented Jul 25, 2023

https://learn.microsoft.com/en-us/windows-server/storage/file-server/troubleshoot/smbv1-not-installed-by-default-in-windows says that SMBv1 is not installed by default on some Windows versions, including the version I tested on — and I did not install it explicitly.

But: @qiulaidongfeng, I do think you may be on to something with https://go.dev/cl/512736. If the SMB Server service is running but the client is disabled — or if the server is only serving SMBv2/SMBv3 but the client is only configured to use SMBv1 — then the call to NetShareAdd could succeed (because the server is able to set up the share) but the call to Stat would then fail (because the client is unavailable to connect to it).

@qiulaidongfeng
Copy link
Contributor Author

@qmuntal Thank you for telling me that disabling SMB can still pass the test. I have found that even if SMB is disabled, enabling the Workstation service on Windows will pass the test.

@bcmills I have updated CL 512736 to avoid testing failures when the Workstation service is not enabled.

@qmuntal
Copy link
Contributor

qmuntal commented Jul 26, 2023

@qmuntal Thank you for telling me that disabling SMB can still pass the test. I have found that even if SMB is disabled, enabling the Workstation service on Windows will pass the test.

Yay! I disabled the Workstation and got the The network path was not found error.

@qiulaidongfeng
Copy link
Contributor Author

Can the WaitingForInfo label be removed?

@qmuntal qmuntal removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 3, 2023
@qmuntal
Copy link
Contributor

qmuntal commented Aug 3, 2023

Label removed. @qiulaidongfeng mark all resolved CL 512736 comments as resolved, either using the Done button or checking the Resolved checkbox. This is normally done by the CL owner, not the reviewer. There are less chances to get reviews if there are unresolved comments.

@qiulaidongfeng
Copy link
Contributor Author

Label removed. @qiulaidongfeng mark all resolved CL 512736 comments as resolved, either using the Done button or checking the Resolved checkbox. This is normally done by the CL owner, not the reviewer. There are less chances to get reviews if there are unresolved comments.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants