diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-11-19 12:12:10 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-11-19 12:12:10 +0100 |
| commit | 2994ea09810a461d7a6334cdc4867179d46a08e2 (patch) | |
| tree | e800eda9bb7c6c4487ab2eae12be9420e81e141c | |
| parent | 2da09f3c79431a1709c8b9a27e63be94e20b2e9b (diff) | |
dashboard/app: gracefully handle large error text in emails
Build error output and failing VM boot log can be way too long to inline.
Inline a part of it and attach full text instead.
| -rw-r--r-- | dashboard/app/jobs_test.go | 1 | ||||
| -rw-r--r-- | dashboard/app/mail_test_result.txt | 3 | ||||
| -rw-r--r-- | dashboard/app/reporting_email.go | 15 |
3 files changed, 18 insertions, 1 deletions
diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go index 674423201..af997f69b 100644 --- a/dashboard/app/jobs_test.go +++ b/dashboard/app/jobs_test.go @@ -149,6 +149,7 @@ syzbot tried to test the proposed patch but build failed: failed to apply patch + Tested on commit kernel_commit1 repo1/branch1 compiler: compiler1 diff --git a/dashboard/app/mail_test_result.txt b/dashboard/app/mail_test_result.txt index a11442f9a..83009298a 100644 --- a/dashboard/app/mail_test_result.txt +++ b/dashboard/app/mail_test_result.txt @@ -8,6 +8,9 @@ syzbot has tested the proposed patch but the reproducer still triggered crash: syzbot tried to test the proposed patch but build failed: {{printf "%s" .Error}} +{{if .ErrorTruncated}} +Error text is too large and was truncated, full error text is attached. +{{end}} {{else}} syzbot has tested the proposed patch and the reproducer did not trigger crash: diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index fcafd1e9f..ff4bec167 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -164,6 +164,17 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error Data: rep.ReproC, }) } + // Build error output and failing VM boot log can be way too long to inline. + const maxInlineError = 16 << 10 + errorText, errorTruncated := rep.Error, false + if len(errorText) > maxInlineError { + errorTruncated = true + attachments = append(attachments, aemail.Attachment{ + Name: "error.txt", + Data: errorText, + }) + errorText = errorText[:len(errorText)-maxInlineError] + } from, err := email.AddAddrContext(fromAddr(c), rep.ID) if err != nil { return err @@ -180,6 +191,7 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error CrashTitle string Report []byte Error []byte + ErrorTruncated bool HasLog bool HasKernelConfig bool ReproSyz bool @@ -195,7 +207,8 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error KernelCommit: rep.KernelCommit, CrashTitle: rep.CrashTitle, Report: rep.Report, - Error: rep.Error, + Error: errorText, + ErrorTruncated: errorTruncated, HasLog: len(rep.Log) != 0, HasKernelConfig: len(rep.KernelConfig) != 0, ReproSyz: len(rep.ReproSyz) != 0, |
