-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/link: binary failed to execute with "This version of %1 is not compatible with the version of Windows you're running." #44817
Comments
Very likely related to #34774. |
Is this a rare bug or is it happening all the time? |
Very rare. |
I don't have time even to look at the code. But the error message is, probably, because of executable is corrupted. Alex |
We're now up to four of these total, so far: |
|
This seems to reproduce most often (but not exclusively) when running
|
(CC @randall77 @griesemer for |
It's almost certainly the linker (or, perhaps, the host linker, because cgo?). If the compiler generated garbage instructions, say, it wouldn't make this kind of error. It would just be a SIGILL when running. |
Several cases are failing when running the (newly created) linker.
All cases are failing to run a newly created binary. I have a vague recollection that we've had trouble in the past running a newly created executable on Windows, but I couldn't pin it down. I wonder if it would be appropriate for cmd/link to call |
Seems like a promising idea. Testing such a change seems tricky given the infrequency of the problem. Documentation for FlushFileBuffers says: ... The caller must have administrative privileges. ... https://docs.microsoft.com/en-us/windows/win32/secbp/running-with-special-privileges Not sure if we can guarantee that? In any case, I can give it a try. |
I wrote a CL to do this at https://go-review.googlesource.com/c/go/+/406814 , but it doesn't seem to work (I must be holding something wrong). Fails bootstrap on windows with
If anyone can see where I went wrong, let me know. |
Issue #38440 is a previous issue about newly created executables and file mappings on Windows. I added FlushViewOfFile for that. Maybe it is not enough? |
@thanm I think FlushFileBuffers takes a file handle, not a file mapping handle. Perhaps |
Thanks, I suspected it was something like that. I'll try your suggestion. |
Change https://go.dev/cl/406814 mentions this issue: |
One more today. (Is CL 406814 still waiting on a gomote swarm?)
|
Swarm running last week generated a bunch of failures (mostly TestCallbackInAnotherThread) but nothing that matched this problem. Consensus seems to be that submitting CL 406814 would be a positive step, so I will go ahead and check in the CL but leave this issue open. |
In the windows version of OutBuf.munmap, call syscall.FlushFileBuffers after the call to syscall.FlushViewOfFile, on the theory that this will help flush all associated meta-data for the file the linker is writing. Updates #44817. Change-Id: Ibff7d05008a91eeed7634d2760153851e15e1c18 Reviewed-on: https://go-review.googlesource.com/c/go/+/406814 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
No new failures so far after CL 406814 ... of course it has only been a couple of weeks. Probably best to leave open for a few more. |
Found new dashboard test flakes for:
2022-09-26 14:16 windows-amd64-longtest go@1e91ffc8 (log)
|
2021-03-05T06:15:22-60b500d/windows-amd64-race
CC @alexbrainman @zx2c4 @jeremyfaller
The text was updated successfully, but these errors were encountered: