-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime: use WER for GOTRACEBACK=wer on Windows #57441
Comments
CC @zx2c4 @zhizheng052 @bhiggins @alexbrainman @aarzilli @aclements @golang/windows |
Wasn't this already discussed and rejected in an earlier proposal? The privacy concerns seem real, especially given how hard opting out has become on Windows, and how little trust exists on the user side these days... |
This is my personal summary: The earlier attempt was removed due to privacy concerns (which you raised on https://go.dev/cl/307372 -- thanks). Then we decided to adopt minidump in #49471. However, the actual implementation of minidump (https://go.dev/cl/458955) turns out to have some problems (see #49471 (comment)). So this proposal suggests that we reconsider WER despite the privacy issues. That is, I don't think we made a clear decision that we could not live with the privacy issues, because it seemed that minidump was a viable alternative. Now that we have learned more, it's possible that minidump is not a viable alternative. So let's consider whether we can live with the privacy issues. I don't have an opinion myself. |
IMO, it would be nice to have (and simple to implement) an opt-in only means for Go programs on Windows to work with WER. In addition to being opt-in only, there could be a warning in documentation that states that it's possible for WER to be configured to send crash dumps to Microsoft. |
If this proposal is approved, WER would still be opt-in, so only users that need it would have it. Opting out is just one PS command, Disable-WindowsErrorReporting, so I wouldn't say its hard. Additionally, the previous command only disables uploading dumps to the server, one can still use WER to generate local dumps. |
@qmuntal Thank you for creating this proposal. I agree with your sentiment. I always supported this functionality #49471 (comment) . And it looks silly that Delve supports Go Windows minidumps, but Go tools do not provide tools to generate these dumps (see #49471 (comment) ). Alex |
My process address space can contain private keys. I can't put those in special memory regions because Go's GC. Ordinary users use my software who can't be fiddling around with powershell. Sometimes my software crashes. When this happens, uploading private keys to some error reporting server is a nonstarter. It must not happen. I can't imagine I'm the only one writing software with this situation, and I wouldn't want to choose the dangerous thing for other developers who might not even be aware that their private keys are sensitive - like casual users of TLS/HTTPS. |
My opinion remains as in #49471 (comment) (i.e. in favor of this). |
Can we go with an explicit opt-in method to crash in a WER-compatible way
(which really just means not swallowing the error)? This could involve a
new GOTRACEBACK=crash-wer option and/or a runtime function. I’m concerned
we’re just going to talk about blanket policies that don’t work for
everyone.
…On Sun, Dec 25, 2022 at 8:37 AM Alessandro Arzilli ***@***.***> wrote:
My opinion remains as in #49471 (comment)
<#49471 (comment)>
—
Reply to this email directly, view it on GitHub
<#57441 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI4V3PCPEDFQIATT4OVCL3WPBZ5PANCNFSM6AAAAAATGONT4Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
We could, but I don't see how @zx2c4 ordinary users will not disable WER using a PS command, but neitheir will set Additionally, by default WER does not upload the full virtual memory, just the data segment, which can contain global variables, but not the heap nor the stack. |
Thank you @qmuntal again for bring it forward again. I would actually argue that the proposal title is a bit misnomer and least as far as intent of the proposal is concerned. The proposal effectively intends to implement Go documented behavior “crashes in an operating system-specific manner”. No more nor less (never mind that this is on par with other platforms). On Windows it means either WER, custom crash handling, debugger activation, documented and used report entry in Windows Event log and usage of built-in and 3rd party tools. Another word, it is expected behavior for bazillion of applications running on Windows for many decades. Besides, it is a Go-runtime debugging and troubleshooting feature. If one is concerned with some side-effects for whatever reasons, do not activate it. |
I got to this topic from #20498 and I've spend the last hour or so trying to catch up with all the back and forths, so I'm sorry if I'm missing the point, but I just wanted to give my 2 cents. As @qmuntal expressed in their opening statement, the documentation on GOTRACEBACK=crash is very opinionated:
Based on that, IMHO, whether the SO sends or sends not the crash information to Microsoft is out of context from a Go program perspective. Microsoft says in their documentation:
Then they further elaborate:
First impression is that the decision to send or not send WER data to MS is in the scope of the system admin, not the developers. It is a bit old, but they document the controls of this feature in this article here. Also, it is not clear to me if the way runtime is currently treating error is effectively "handling fatal exceptions" from a Windows perspective and that's why we are losing this functionality. If that's the case, GOTRACEBACK=crash should only disable any special treatment we do and let the application... er... crash. :) [By that I mean I wouldn't try to add any side effects like generating different types of dumps other than the default] Another concern is that we are not generating Event Log ID 1000, as previously mentioned by @iglendd in #49471 (comment). This was the main reason why I got into this rabbit hole. Finally, I'm more than happy to help with any coding if needed. I'm way too invested in this now :) |
Wanted to chime in with some additional support for this proposal. I think it is worth considering the value of Windows local crash dump handling with WER, which is somewhat separate from uploading of reports to Microsoft (and the latter can be disabled, as @qmuntal points out).
As mentioned above, the current approach of calling |
This proposal has been added to the active column of the proposals project |
GOTRACEBACK=crash does not upload things on any system today. It sounds like we should preserve that property, even if it's not the default privacy profile on Microsoft systems. It's also the case that code might contain debug.SetTraceback("crash") intending core dumps on Unix and then accidentally get reports to Microsoft on Windows. Is there some way to force the WER code to write the local crash but not upload? If not, then adding GOTRACEBACK=wer seems OK and very clear. Worth noting that debug.SetTraceback("wer") in a library would be interesting and maybe unexpected, but libraries are unlikely to do that. |
It is possible with admin permissions either running a PS script or modifying the registry, but AFAIK not possible within a process.
I'm not particularly attached to |
Regarding Regarding privacy and upload concerns I would argue that this is a completely orthogonal issue. Semantically and conceptually we are following exactly the same logic and behavior as on Unix - allowing system to decide what to do. And we would follow Go documentation literally (https://pkg.go.dev/runtime)
In addition, it is not something a Go process would normally do. A user (or rather a developer) would set it up only for troubleshooting just to get their hands on a crash dump to find out a root cause. There are, by the way, more than a few ways to capture crash dump on Windows. In addition to WER one can also use external application like procdump or Dr.Watson, one can attach register post-mortem or debugger (and all of them are based on the existence of unhandled exception). And so, IMHO, the term |
We can always take additional steps later, but for now it seems like the simplest, most minimal step is to make On non-Windows systems, Do I have that right? |
It turns out |
Yep.
I tried to understand how the effective traceback level is selected, and I was also stunned with its complexity. |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
I've updated https://go.dev/cl/474915 so it implements final version of this proposal. |
To clarify, will this be part of Go 1.21? |
Yep, support for |
@qmuntal: Wow that was a quick response, thanks! Sorry for the probably stupid question, I couldn't fully grasp all the information I found regarding this, but is there currently a way to automatically create mini dumps of crashing Go applications on Windows? |
You can build go 1.21 from source and use it. |
Change https://go.dev/cl/499515 mentions this issue: |
While here, I've removed the CL 472195 TODO, which I marked as RELNOTE=yes by mistake. For #57441 For #57302 Change-Id: I7563140bf307f8d732f0154d02b8fa0735527323 Reviewed-on: https://go-review.googlesource.com/c/go/+/499515 Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Run-TryBot: Quim Muntal <[email protected]>
GOTRACEBACK=wer is a new traceback level that acts as "crash" and also enables WER. The same effect can be achieved using debug.SetTraceback("wer"). The Go runtime currently crashes using exit(2), which bypasses WER even if it is enabled. To best way to trigger WER is calling RaiseFailFastException [1] instead, which internally launches the WER machinery. This CL also changes how GOTRACEBACK=crash crashes, so both "wer" and "crash" crash using RaiseFailFastException, which simplifies the implementation and resolves a longstanding TODO. Fixes golang#57441 Fixes golang#20498 [1] https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-raisefailfastexception Change-Id: I45669d619fbbd2f6413ce5e5f08425ed1d9aeb64 Reviewed-on: https://go-review.googlesource.com/c/go/+/474915 Reviewed-by: Davis Goodin <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Reviewed-by: Alex Brainman <[email protected]> Run-TryBot: Quim Muntal <[email protected]>
Edit: proposal shifted to enable WER using
GOTRACEBACK=wer
. See #57441 (comment) and #57441 (comment) for more context.WER is a Windows built-in infrastructure provided by Microsoft that helps troubleshooting hardware and software problems. Many systems rely on the core dumps generated by WER for post-mortem analyses. These dumps are collected by a dedicated process running on the host and uploaded to the WER server and\or stored locally (see Collecting User-Mode Dumps).
#20498 added support for WER when setting
GOTRACEBACK=crash
, but was reverted and replaced by #49471. The reason to revert it was because WER uploads dumps to Microsoft by default, and this bit was not discussed in the original issue. See this comment #49471 (comment) to understand why I'm counterproposing #49471 after implementing it.Here I'm proposing to revert the revert, enabling WER when
GOTRACEBACK=crash
is set. The arguments come next, but first the definition of thecrash
mode:I have two simple arguments in favor of WER:
WER is the Windows specific manner to crash applications. It is the default experience and many production systems rely on WER to do post-mortem analysis, not only from within Microsoft.
WER can be used for collecting user-mode dumps without adding any complexity to the Go runtime.
It's true that some users might not want their diagnosis data to be uploaded to Microsoft servers, but my point is that they already have enough knobs to turn it off or limit what's uploaded:
GOTRACEBACK=crash
is not the default runtime behavior, one have to manually set via environment variable or programmatically via debug.SetTraceback. We can inform about the WER gotchas in the release notes and in theGOTRACEBACK
docs.GOTRACEBACK=crash
does nothing overGOTRACEBACK=system
. If this proposal is approved, the only reason to setGOTRACEBACK=crash
would be to opt into WER.Disable-WindowsErrorReporting
on PowerShell. One can also disable just some applications using the system registry.Side note: #20498 is a bug report, not a proposal, so I think it makes sense to create this as a formal proposal.
The text was updated successfully, but these errors were encountered: