8000 OAS-9996 Better panic handling by jwierzbo · Pull Request #1706 · arangodb/kube-arangodb · GitHub
[go: up one dir, main page]

Skip to content

OAS-9996 Better panic handling #1706

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

Merged
merged 2 commits into from
Aug 27, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- (Feature) Gateway config loader
- (Feature) ConfigV1 Integration Service
- (Feature) Integration Service Authentication
- (Improvement) Better panic handling

## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries
Expand Down
12 changes: 7 additions & 5 deletions pkg/util/k8sutil/informer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,8 @@
package k8sutil

import (
"runtime/debug"

"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/cache"
Expand All @@ -29,7 +31,7 @@ import (
)

var (
informerLogger = logging.Global().Get("kubernetes-informer")
informerLogger = logging.Global().RegisterAndGetLogger("kubernetes-informer", logging.Info)
)

// ResourceWatcher is a helper to watch for events in a specific type
Expand All @@ -52,7 +54,7 @@ func NewResourceWatcher(getter cache.Getter, resource, namespace string,
AddFunc: func(obj interface{}) {
defer func() {
if err := recover(); err != nil {
informerLogger.Interface("error", err).Error("Recovered from panic")
informerLogger.Interface("error", err).Error("Recovered from panic. Stack trace:", string(debug.Stack()))
}
}()
if h.AddFunc != nil {
Expand All @@ -62,7 +64,7 @@ func NewResourceWatcher(getter cache.Getter, resource, namespace string,
UpdateFunc: func(oldObj, newObj interface{}) {
defer func() {
if err := recover(); err != nil {
informerLogger.Interface("error", err).Error("Recovered from panic")
informerLogger.Interface("error", err).Error("Recovered from panic. Stack trace:", string(debug.Stack()))
}
}()
if h.UpdateFunc != nil {
Expand All @@ -72,7 +74,7 @@ func NewResourceWatcher(getter cache.Getter, resource, namespace string,
DeleteFunc: func(obj interface{}) {
defer func() {
if err := recover(); err != nil {
informerLogger.Interface("error", err).Error("Recovered from panic")
informerLogger.Interface("error", err).Error("Recovered from panic. Stack trace:", string(debug.Stack()))
}
}()
if h.DeleteFunc != nil {
Expand Down
0