-
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: call (*M).after on signal or internal-generated panic #19394
Comments
As I see it, running with a timeout set means "this shouldn't take more than 10 seconds, abort the program if it does". It's not meant to be used as a knob to control benchmarking duration; and you shouldn't use it this way. Your program was aborted because you started it with a flag set that means: "this should never take more than 10 seconds, please panic if it does". So the question here is: should we guarantee that partial profiles are written to file if the program is killed/aborted because an invalid condition / unrecoverable problem occurred? I don't think we should. |
The reason I would like to write partial profiles if the program is killed (at least internally) is that sometimes I start a large benchmarking run (e.g. |
@josharian to solve that problem maybe we could ignore the default timeout value (10m) when |
I've been bitten by this before. Having -count N multiply the timeout by N sounds like a good fix. |
@ALTree, nah, this program is just for the ease of reproduction. I discovered this issue in a context unrelated to benchmarking and thought that I should report it. How you resolve it is up to you guys. I, personally, would like to see that "partial" profile, because of the time wasted. Also, maybe, those profiles could help to resolve the issues with the code that led to this timeout. Just my 2 cents. |
Related: #12446. This just bit me again. The fix appears to be trivial: add |
We're deep in the freeze with no consensus about what should be done and no CL implementing generation of partial profiles, so I'm moving this to the go1.10 milestone. |
I don't see how to fix this without adding atexit, which we've worked hard to avoid. |
I see the argument for multiplying timeout by count but on the other hand -count=100 turning into 1000m timeout might not be what you want. |
If we only care about the specific case of a signal arriving, or the internal panic generated by a timeout - that is, the intersection of the two things I just replied to - then we could arrange to call m.after() carefully ourselves before exiting. That seems OK to try at least if anyone is interested in preparing a CL. |
CL https://golang.org/cl/48491 mentions this issue. |
My fix was only partial but bot closed this. I used |
What version of Go are you using (
go version
)?go version go1.8 windows/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
Ran
go test -cpuprofile cpu.pprof -memprofile mem.pprof -timeout 10s
in a folder with the following test file:What did you expect to see?
Tests to end with a panic and non-empty profiles in
cpu.pprof
andmem.pprof
.What did you see instead?
Tests ended with a panic, but
cpu.pprof
was empty andmem.pprof
wasn't created at all.Previous discussion on #golang-nuts: link.
/cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: