Skip to content

symbolize regularly to accelarate cover page loading #6005

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/manager/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ func (serv *HTTPServer) Serve(ctx context.Context) error {
// Browsers like to request this, without special handler this goes to / handler.
handle("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {})

go func() {
webAddr := mgrconfig.PublicWebAddr(serv.Cfg.HTTP)
urlStr := fmt.Sprintf("%v/subsystemcover", webAddr)
timer := time.NewTicker(10 * time.Minute)
defer timer.Stop()
for range timer.C {
log.Logf(2, "accessing %v to symbolize regularly", urlStr)
http.Get(urlStr)
}
}()

log.Logf(0, "serving http on http://%v", serv.Cfg.HTTP)
server := &http.Server{Addr: serv.Cfg.HTTP}
go func() {
Expand Down
18 changes: 18 additions & 0 deletions pkg/mgrconfig/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ package mgrconfig
import (
"bytes"
"fmt"
"net"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"

"github.com/google/syzkaller/pkg/config"
"github.com/google/syzkaller/pkg/gce"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/vminfo"
"github.com/google/syzkaller/prog"
Expand Down Expand Up @@ -499,3 +501,19 @@ func MatchSyscall(name, pattern string) bool {
}
return false
}

func PublicWebAddr(addr string) string {
if addr == "" {
return ""
}
_, port, err := net.SplitHostPort(addr)
if err == nil && port != "" {
if host, err := os.Hostname(); err == nil {
addr = net.JoinHostPort(host, port)
}
if GCE, err := gce.NewContext(""); err == nil {
addr = net.JoinHostPort(GCE.ExternalIP, port)
}
}
return "http://" + addr
}
2 changes: 1 addition & 1 deletion syz-manager/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (hc *HubConnector) connect(corpus []*corpus.Item) (*rpctype.RPCClient, erro
if err != nil {
return nil, err
}
http := publicWebAddr(hc.cfg.HTTP)
http := mgrconfig.PublicWebAddr(hc.cfg.HTTP)
a := &rpctype.HubConnectArgs{
Client: hc.cfg.HubClient,
Key: key,
Expand Down
19 changes: 1 addition & 18 deletions syz-manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/google/syzkaller/pkg/flatrpc"
"github.com/google/syzkaller/pkg/fuzzer"
"github.com/google/syzkaller/pkg/fuzzer/queue"
"github.com/google/syzkaller/pkg/gce"
"github.com/google/syzkaller/pkg/ifaceprobe"
"github.com/google/syzkaller/pkg/image"
"github.com/google/syzkaller/pkg/log"
Expand Down Expand Up @@ -1376,7 +1375,7 @@ func (mgr *Manager) trackUsedFiles() {
}

func (mgr *Manager) dashboardReporter() {
webAddr := publicWebAddr(mgr.cfg.HTTP)
webAddr := mgrconfig.PublicWebAddr(mgr.cfg.HTTP)
triageInfoSent := false
var lastFuzzingTime time.Duration
var lastCrashes, lastSuppressedCrashes, lastExecs uint64
Expand Down Expand Up @@ -1463,19 +1462,3 @@ func (mgr *Manager) CoverageFilter(modules []*vminfo.KernelModule) ([]uint64, er
}
return pcs, nil
}

func publicWebAddr(addr string) string {
if addr == "" {
return ""
}
_, port, err := net.SplitHostPort(addr)
if err == nil && port != "" {
if host, err := os.Hostname(); err == nil {
addr = net.JoinHostPort(host, port)
}
if GCE, err := gce.NewContext(""); err == nil {
addr = net.JoinHostPort(GCE.ExternalIP, port)
}
}
return "http://" + addr
}
Loading