From dc2bfb09019a2df09df55ee5a76a0e461fb1e600 Mon Sep 17 00:00:00 2001 From: Xiaofan <83447078+xiaofan-luan@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:53:35 +0800 Subject: [PATCH] Add stack trace for core dump (#21555) Signed-off-by: xiaofan-luan --- cmd/roles/roles.go | 1 + go.mod | 4 ++- go.sum | 4 +++ .../util/indexcgowrapper/codec_index_test.go | 3 --- internal/util/indexcgowrapper/index_test.go | 3 --- internal/util/symbolizer/symbolizer.go | 27 +++++++++++++++++++ 6 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 internal/util/symbolizer/symbolizer.go diff --git a/cmd/roles/roles.go b/cmd/roles/roles.go index ceb799db27..926ab078a4 100644 --- a/cmd/roles/roles.go +++ b/cmd/roles/roles.go @@ -39,6 +39,7 @@ import ( "github.com/milvus-io/milvus/internal/util/logutil" "github.com/milvus-io/milvus/internal/util/metricsinfo" "github.com/milvus-io/milvus/internal/util/paramtable" + _ "github.com/milvus-io/milvus/internal/util/symbolizer" // support symbolizer and crash dump "github.com/milvus-io/milvus/internal/util/trace" "github.com/milvus-io/milvus/internal/util/typeutil" "github.com/prometheus/client_golang/prometheus" diff --git a/go.mod b/go.mod index fbf1844cce..b554a7a4ad 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/apache/arrow/go/v8 v8.0.0-20220322092137-778b1772fd20 github.com/apache/pulsar-client-go v0.6.1-0.20210728062540-29414db801a7 github.com/apache/thrift v0.15.0 // indirect + github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b github.com/bits-and-blooms/bloom/v3 v3.0.1 github.com/casbin/casbin/v2 v2.44.2 github.com/casbin/json-adapter/v2 v2.0.0 @@ -98,6 +99,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/godbus/dbus/v5 v5.0.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect @@ -186,7 +188,7 @@ require ( sigs.k8s.io/yaml v1.2.0 // indirect ) -require github.com/golang-jwt/jwt v3.2.1+incompatible // indirect +require github.com/ianlancetaylor/cgosymbolizer v0.0.0-20221217025313-27d3c9f66b6a // indirect replace ( github.com/apache/pulsar-client-go => github.com/milvus-io/pulsar-client-go v0.6.10 diff --git a/go.sum b/go.sum index 80d7a8bcdd..aa2b3b7e34 100644 --- a/go.sum +++ b/go.sum @@ -91,6 +91,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/aws/aws-sdk-go v1.32.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= +github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b h1:5JgaFtHFRnOPReItxvhMDXbvuBkjSWE+9glJyF466yw= +github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b/go.mod h1:eMD2XUcPsHYbakFEocKrWZp47G0MRJYoC60qFblGjpA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -380,6 +382,8 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/heetch/avro v0.3.1/go.mod h1:4xn38Oz/+hiEUTpbVfGVLfvOg0yKLlRP7Q9+gJJILgA= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= +github.com/ianlancetaylor/cgosymbolizer v0.0.0-20221217025313-27d3c9f66b6a h1:2pDHS5ciC7EKulVtDBD2J+9X9Eypl1K60q4EJyHvvxY= +github.com/ianlancetaylor/cgosymbolizer v0.0.0-20221217025313-27d3c9f66b6a/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= diff --git a/internal/util/indexcgowrapper/codec_index_test.go b/internal/util/indexcgowrapper/codec_index_test.go index d722382670..732aad11b8 100644 --- a/internal/util/indexcgowrapper/codec_index_test.go +++ b/internal/util/indexcgowrapper/codec_index_test.go @@ -1,6 +1,3 @@ -//go:build linux -// +build linux - package indexcgowrapper import ( diff --git a/internal/util/indexcgowrapper/index_test.go b/internal/util/indexcgowrapper/index_test.go index 632361eac6..a18386132b 100644 --- a/internal/util/indexcgowrapper/index_test.go +++ b/internal/util/indexcgowrapper/index_test.go @@ -1,6 +1,3 @@ -//go:build linux -// +build linux - package indexcgowrapper import ( diff --git a/internal/util/symbolizer/symbolizer.go b/internal/util/symbolizer/symbolizer.go new file mode 100644 index 0000000000..384eecf391 --- /dev/null +++ b/internal/util/symbolizer/symbolizer.go @@ -0,0 +1,27 @@ +// Licensed to the LF AI & Data foundation under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package symbolizer + +import ( + "runtime/debug" + + _ "github.com/benesch/cgosymbolizer" // enable cpp stack +) + +func init() { + debug.SetTraceback("crash") +}