mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: push down systemstack requirement for tracer where possible
Currently lots of functions require systemstack because the trace buffer might get flushed, but that will already switch to the systemstack for the most critical bits (grabbing trace.lock). That means a lot of this code is non-preemptible when it doesn't need to be. We've seen this cause problems at scale, when dumping very large numbers of stacks at once, for example. This is a re-land of CL 572095 which was reverted in CL 577376. This re-land includes a fix of the test that broke on the longtest builders. Change-Id: Ia8d7cbe3aaa8398cf4a1818bac66c3415a399348 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/577377 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
236fe24ed5
commit
73981695a2
5 changed files with 42 additions and 42 deletions
|
|
@ -909,18 +909,22 @@ func TestCrashWhileTracing(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("could not create trace.NewReader: %v", err)
|
||||
}
|
||||
var seen bool
|
||||
var seen, seenSync bool
|
||||
i := 1
|
||||
loop:
|
||||
for ; ; i++ {
|
||||
ev, err := r.ReadEvent()
|
||||
if err != nil {
|
||||
// We may have a broken tail to the trace -- that's OK.
|
||||
// We'll make sure we saw at least one complete generation.
|
||||
if err != io.EOF {
|
||||
t.Errorf("error at event %d: %v", i, err)
|
||||
t.Logf("error at event %d: %v", i, err)
|
||||
}
|
||||
break loop
|
||||
}
|
||||
switch ev.Kind() {
|
||||
case tracev2.EventSync:
|
||||
seenSync = true
|
||||
case tracev2.EventLog:
|
||||
v := ev.Log()
|
||||
if v.Category == "xyzzy-cat" && v.Message == "xyzzy-msg" {
|
||||
|
|
@ -934,6 +938,9 @@ loop:
|
|||
if err := cmd.Wait(); err == nil {
|
||||
t.Error("the process should have panicked")
|
||||
}
|
||||
if !seenSync {
|
||||
t.Errorf("expected at least one full generation to have been emitted before the trace was considered broken")
|
||||
}
|
||||
if !seen {
|
||||
t.Errorf("expected one matching log event matching, but none of the %d received trace events match", i)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue