-
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
testing: bad formatting in "Log in goroutine after" panic message #29388
Comments
The panic message is definitely wrong, and I don't think this should be a panic at all. #26720 makes t.Log log to t's parent if t is done. If t is a subtest, this promotes the log message to the parent test. If t is not a subtest, then the parent of t is a per-cpu T created by So #26720 adds a panic in the narrow window between all tests completing and the process exiting. This does not seem useful; if logging after panic completion is worthwhile, then it should happen for any log after the test has completed. In addition, I do not see a case for having different panic behavior for logging after top-level test completion and logging after subtest completion. These should behave the same. On a related note, #26720 includes a comment: "If this test has already finished try and log this message with our parent with this test name tagged so we know where it came from." However, there is no such tagging. The comment should be dropped or the tagging added. |
CC @wselwood |
There is clearly a bug here but I don't follow the logic for why there shouldn't be a panic. The most important guideline should be that we never lose a log message. Currently we are losing log messages. That is a bug. For the cases where we are losing log messages today, we should probably panic. But at this point in the release we should perhaps push this back to 1.13. |
Change https://golang.org/cl/157617 mentions this issue: |
I think it would be fine to panic where we lose log messages today, but that's going to be an upgrade in the number of situations where we panic from the current state of affairs. I think that change needs to be pushed back to 1.13. I also suspect that panicking in all situations where a log is lost might trigger too many failures to be feasible. I'd be delighted to be proven wrong. |
The current code panics on a few cases where log messages are lost, and that code has been in the tree since October 10, 2018. I don't think we need to roll that back at this point. I agree that we shouldn't add additional panic cases until 1.13. |
The only two cases I know of since the original change went in are #28169 which tripped the race detector on a test in a the std lib, and this one. @neild Re: Your related note a few comments back. Fair spot. I stopped pre-pending the name after a review comment from @ianlancetaylor looks like I forgot to take out the comment. https://go-review.googlesource.com/c/go/+/127596/5/src/testing/testing.go#607 |
Updates #29388 Change-Id: Icb0e6048d05fde7a5486b923ff62147edb5c8dac Reviewed-on: https://go-review.googlesource.com/c/157617 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Is this still considered a release blocker for 1.12? |
This is not a release blocker for 1.12. |
In fact, the core of this issue is fixed. Opening the remaining portion as a separate issue in #30389. |
Avoid logging in the `watch` function as much as possible, since it is not waited on during a server shutdown. When the logger logs after a test passes, it may or may not cause the testing framework to panic. More info in: golang/go#29388 (comment)
Avoid logging in the `watch` function as much as possible, since it is not waited on during a server shutdown. When the logger logs after a test passes, it may or may not cause the testing framework to panic. More info in: golang/go#29388 (comment)
On
go1.11
, the following test silently drops a log message: https://play.golang.org/p/2gLqWOYcREvOn
go1.12beta1
, as a result of https://golang.org/cl/127596 (#26720), it instead prints:Note the lack of test name in the log message: for some reason,
c.name
is no longer populated at that point.The text was updated successfully, but these errors were encountered: