Open SovereignRemedy opened 1 year ago
这个和文件后缀应该没啥关系,只要是生成的压缩文件的内容符合谷歌pprof pb格式的要求,就可以被 go pprof工具正常解析。
我起了个demo,import了holmes的master分支代码。并没有复现你的问题。
方便提供一下可复现的case吗,我们在一起调查下。
GCHeap.heap-3.20230131112906.390.log mem.20230131112506.312.log 提供两个dumpdump出来的文件 如果需要别的可以再提供
GCHeap.heap-3.20230131112906.390.log mem.20230131112506.312.log 提供两个dumpdump出来的文件 如果需要别的可以再提供
两个profile里的metric指向的函数都是
GCHeap.heap-3.20230131112906.390.log mem.20230131112506.312.log 提供两个dumpdump出来的文件 如果需要别的可以再提供
两个profile里的metric指向的函数都是,应该是add2line的时候找不到函数名和地址。能提供下demo吗
因为是公司的服务感觉不太好直接全贴出来..需要哪些关键的地方我可以节选出来。 ` func systemInit() { err := service.Init() if err != nil { glog.Fatalf("system fatal err:%s", err) } configs.InitDb() appstore.Init() appdev.Init() //authcheck.Init()
r := &ReporterImpl{}
h, _ := holmes.New(
holmes.WithProfileReporter(r),
holmes.WithCollectInterval("5s"),
holmes.WithDumpPath("/tmp"),
holmes.WithTextDump(),
holmes.WithCPUDump(10, 25, 80, time.Minute),
holmes.WithMemDump(30, 25, 80, time.Minute),
holmes.WithGCHeapDump(10, 20, 40, time.Minute),
holmes.WithGoroutineDump(500, 25, 20000, 0, time.Minute),
holmes.WithCGroup(true), // set cgroup to true
)
h.EnableCPUDump().
EnableGoroutineDump().
EnableMemDump().
EnableGCHeapDump().Start()
}
type ReporterImpl struct{}
func (r *ReporterImpl) Report(pType string, filename string, reason holmes.ReasonType, eventID string, sampleTime time.Time, pprofBytes []byte, scene holmes.Scene) error { // do something glog.Infof("report to minio reporter %s", filename) fr := bytes.NewReader(pprofBytes) minioClient := configs.Get().MinioClientPool.Get() _, err := minioClient.PutObject(context.Background(), configs.Get().DownloadBucket, filepath.Join("wxtest", filename), fr, int64(len(pprofBytes)), minio.PutObjectOptions{ContentType: pType}) if err != nil { glog.Errorf("Reporter holmes.Report error %v", err) } return err }
func main() { systemInit() //appdev.Get().TestPublish("./data/com.liuli.app-store.tar") //service.Get().Run() for true { time.Sleep(1 * time.Minute) } }
`
这部分就是集成holmes的地方 剩下就是请求一个文件上传的业务接口
GCHeap.heap-3.20230131112906.390.log mem.20230131112506.312.log 提供两个dumpdump出来的文件 如果需要别的可以再提供
两个profile里的metric指向的函数都是,应该是add2line的时候找不到函数名和地址。能提供下demo吗
因为是公司的服务感觉不太好直接全贴出来..需要哪些关键的地方我可以节选出来。 ` func systemInit() { err := service.Init() if err != nil { glog.Fatalf("system fatal err:%s", err) } configs.InitDb() appstore.Init() appdev.Init() //authcheck.Init()
r := &ReporterImpl{} h, _ := holmes.New( holmes.WithProfileReporter(r), holmes.WithCollectInterval("5s"), holmes.WithDumpPath("/tmp"), holmes.WithTextDump(), holmes.WithCPUDump(10, 25, 80, time.Minute), holmes.WithMemDump(30, 25, 80, time.Minute), holmes.WithGCHeapDump(10, 20, 40, time.Minute), holmes.WithGoroutineDump(500, 25, 20000, 0, time.Minute), holmes.WithCGroup(true), // set cgroup to true ) h.EnableCPUDump(). EnableGoroutineDump(). EnableMemDump(). EnableGCHeapDump().Start()
}
type ReporterImpl struct{}
func (r *ReporterImpl) Report(pType string, filename string, reason holmes.ReasonType, eventID string, sampleTime time.Time, pprofBytes []byte, scene holmes.Scene) error { // do something glog.Infof("report to minio reporter %s", filename) fr := bytes.NewReader(pprofBytes) minioClient := configs.Get().MinioClientPool.Get() _, err := minioClient.PutObject(context.Background(), configs.Get().DownloadBucket, filepath.Join("wxtest", filename), fr, int64(len(pprofBytes)), minio.PutObjectOptions{ContentType: pType}) if err != nil { glog.Errorf("Reporter holmes.Report error %v", err) } return err }
func main() { systemInit() //appdev.Get().TestPublish("./data/com.liuli.app-store.tar") //service.Get().Run() for true { time.Sleep(1 * time.Minute) } }
`
这部分就是集成holmes的地方 剩下就是请求一个文件上传的业务接口
你方便运行下 这里的case吗?看看能否正常解析。 我想排除是不是项目依赖的第三库导致的问题,有些库会对runtime分配下来的资源进行二次分配,给profile增加了很多噪音,比如goid。
GCHeap.heap-3.20230131112906.390.log mem.20230131112506.312.log 提供两个dumpdump出来的文件 如果需要别的可以再提供
两个profile里的metric指向的函数都是,应该是add2line的时候找不到函数名和地址。能提供下demo吗
因为是公司的服务感觉不太好直接全贴出来..需要哪些关键的地方我可以节选出来。 ` func systemInit() { err := service.Init() if err != nil { glog.Fatalf("system fatal err:%s", err) } configs.InitDb() appstore.Init() appdev.Init() //authcheck.Init()
r := &ReporterImpl{} h, _ := holmes.New( holmes.WithProfileReporter(r), holmes.WithCollectInterval("5s"), holmes.WithDumpPath("/tmp"), holmes.WithTextDump(), holmes.WithCPUDump(10, 25, 80, time.Minute), holmes.WithMemDump(30, 25, 80, time.Minute), holmes.WithGCHeapDump(10, 20, 40, time.Minute), holmes.WithGoroutineDump(500, 25, 20000, 0, time.Minute), holmes.WithCGroup(true), // set cgroup to true ) h.EnableCPUDump(). EnableGoroutineDump(). EnableMemDump(). EnableGCHeapDump().Start()
} type ReporterImpl struct{} func (r ReporterImpl) Report(pType string, filename string, reason holmes.ReasonType, eventID string, sampleTime time.Time, pprofBytes []byte, scene holmes.Scene) error { // do something glog.Infof("report to minio reporter %s", filename) fr := bytes.NewReader(pprofBytes) minioClient := configs.Get().MinioClientPool.Get() _, err := minioClient.PutObject(context.Background(), configs.Get().DownloadBucket, filepath.Join("wxtest", filename), fr, int64(len(pprofBytes)), minio.PutObjectOptions{ContentType: pType}) if err != nil { glog.Errorf("Reporter holmes.Report error %v", err) } return err } func main() { systemInit() //appdev.Get().TestPublish("./data/com.liuli.app-store.tar") //service.Get().Run() for true { time.Sleep(1 time.Minute) } } ` 这部分就是集成holmes的地方 剩下就是请求一个文件上传的业务接口
你方便运行下 这里的case吗?看看能否正常解析。 我想排除是不是项目依赖的第三库导 致的问题,有些库会对runtime分配下来的资源进行二次分配,给profile增加了很多噪音,比如goid。
本地运行demo可以正常解析。 运行自己的服务确实仍然会出现上述问题。 mem.20230201183949.552.log go.mod.txt
/needInvestigate
环境 rancher v2.4.4 holmes v1.1.0
holmes.WithTextDump(), holmes.WIthMemDump(20,50,70,5*time.Minute)
导出的 heap 会出现 unknown 的情况
@z760087139
导出的 heap 会出现 unknown 的情况
这个具体是什么情况呢?文件内容是 unknown 么?
@z760087139
- 最好单独搞个 issue,看起来不是同一个问题
导出的 heap 会出现 unknown 的情况
这个具体是什么情况呢?文件内容是 unknown 么?
与 issue 截图的内容一样,heap 内容能够被 profile 工具解读,但是指向 unknown。 不过因为公司使用的内网无法把 profile 拿出来展示,我只是想提供一个曾经复现的场景
使用的是官方的 Deadlock 例子,复现了相同的场景,其他的 demo 也有相同的问题。
Deadlock Demo 包含了 debug log, profile, etc..
生成的文件都是.log结尾的 使用linux和mac都尝试go tool pprof 都有一样的问题
`func systemInit() { err := service.Init() if err != nil { glog.Fatalf("system fatal err:%s", err) } configs.InitDb() appstore.Init() appdev.Init() //authcheck.Init()
}
type ReporterImpl struct{}
func (r *ReporterImpl) Report(pType string, filename string, reason holmes.ReasonType, eventID string, sampleTime time.Time, pprofBytes []byte, scene holmes.Scene) error { // do something glog.Infof("report to minio reporter %s", filename) fr := bytes.NewReader(pprofBytes) minioClient := configs.Get().MinioClientPool.Get() _, err := minioClient.PutObject(context.Background(), configs.Get().DownloadBucket, filepath.Join("wxtest", filename), fr, int64(len(pprofBytes)), minio.PutObjectOptions{ContentType: pType}) if err != nil { glog.Errorf("Reporter holmes.Report error %v", err) } return err }`