Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 106 for HandleCrash (0.28 sec)

  1. staging/src/k8s.io/apimachinery/pkg/util/runtime/runtime.go

    	if r := recover(); r != nil {
    		handleCrash(ctx, r, additionalHandlers...)
    	}
    }
    
    // handleCrash is the common implementation of HandleCrash and HandleCrash.
    // Having those call a common implementation ensures that the stack depth
    // is the same regardless through which path the handlers get invoked.
    func handleCrash(ctx context.Context, r any, additionalHandlers ...func(context.Context, interface{})) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 26 16:28:45 UTC 2024
    - 9.9K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/util/runtime/runtime_test.go

    	"strings"
    	"sync"
    	"testing"
    	"time"
    )
    
    func TestHandleCrash(t *testing.T) {
    	defer func() {
    		if x := recover(); x == nil {
    			t.Errorf("Expected a panic to recover from")
    		}
    	}()
    	defer HandleCrash()
    	panic("Test Panic")
    }
    
    func TestCustomHandleCrash(t *testing.T) {
    	old := PanicHandlers
    	defer func() { PanicHandlers = old }()
    	var result interface{}
    	PanicHandlers = []func(context.Context, interface{}){
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 26 16:28:45 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  3. pilot/pkg/util/runtime/runtime.go

    	stacktrace := make([]byte, size)
    	stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
    	log.Errorf("Observed a panic: %#v (%v)\n%s", r, r, stacktrace)
    }
    
    // HandleCrash catches the crash and calls additional handlers.
    func HandleCrash(handlers ...func(any)) {
    	if r := recover(); r != nil {
    		for _, handler := range handlers {
    			handler(r)
    		}
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 1.2K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream.go

    func NewReader(r io.Reader, ping bool, protocols map[string]ReaderProtocolConfig) *Reader {
    	return &Reader{
    		r:           r,
    		err:         make(chan error),
    		ping:        ping,
    		protocols:   protocols,
    		handleCrash: runtime.HandleCrash,
    	}
    }
    
    // SetIdleTimeout sets the interval for both reads and writes before timeout. If not specified,
    // there is no timeout on the reader.
    func (r *Reader) SetIdleTimeout(duration time.Duration) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jun 07 18:21:43 UTC 2023
    - 5.2K bytes
    - Viewed (0)
  5. pilot/pkg/util/runtime/runtime_test.go

    			t.Errorf("Expected no panic ")
    		}
    	}()
    
    	defer HandleCrash()
    	panic("test")
    }
    
    func TestCustomHandleCrash(t *testing.T) {
    	ch := make(chan struct{}, 1)
    	defer func() {
    		select {
    		case <-ch:
    			t.Logf("crash handler called")
    		case <-time.After(1 * time.Second):
    			t.Errorf("Custom handler not called")
    		}
    	}()
    
    	defer HandleCrash(func(any) {
    		ch <- struct{}{}
    	})
    
    	panic("test")
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 1.1K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/server/filters/wrap.go

    			// RST_STREAM, depending on the HTTP protocol. To abort a handler so
    			// the client sees an interrupted response but the server doesn't log
    			// an error, panic with the value ErrAbortHandler.
    			//
    			// Note that HandleCrash function is actually crashing, after calling the handlers
    			if info, err := resolver.NewRequestInfo(req); err != nil {
    				metrics.RecordRequestAbort(req, nil)
    			} else {
    				metrics.RecordRequestAbort(req, info)
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 26 16:28:45 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/util/wait/loop.go

    	// if immediate is true the condition is
    	// guaranteed to be executed at least once,
    	// if we haven't requested immediate execution, delay once
    	if immediate {
    		if ok, err := func() (bool, error) {
    			defer runtime.HandleCrash()
    			return condition(ctx)
    		}(); err != nil || ok {
    			return err
    		}
    	}
    
    	if sliding {
    		timeCh = t.C()
    	}
    
    	for {
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Oct 19 02:47:00 UTC 2023
    - 2.8K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/server/options/encryptionconfig/controller/controller.go

    func (d *DynamicEncryptionConfigContent) Run(ctx context.Context) {
    	defer utilruntime.HandleCrash()
    
    	klog.InfoS("Starting controller", "name", d.name)
    	defer klog.InfoS("Shutting down controller", "name", d.name)
    
    	var wg sync.WaitGroup
    
    	wg.Add(1)
    	go func() {
    		defer utilruntime.HandleCrash()
    		defer wg.Done()
    		defer d.queue.ShutDown()
    		<-ctx.Done()
    	}()
    
    	wg.Add(1)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat May 04 18:33:12 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/plugin/pkg/audit/buffered/buffered.go

    		b.wg.Add(1)
    		go func() {
    			defer b.wg.Done()
    			defer runtime.HandleCrash()
    
    			// Execute the real processing in a goroutine to keep it from blocking.
    			// This lets the batching routine continue draining the queue immediately.
    			b.delegateBackend.ProcessEvents(events...)
    		}()
    	} else {
    		func() {
    			defer runtime.HandleCrash()
    
    			// Execute the real processing in a goroutine to keep it from blocking.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 9.1K bytes
    - Viewed (0)
  10. pkg/kubelet/oom/oom_watcher_linux.go

    func (ow *realWatcher) Start(ref *v1.ObjectReference) error {
    	outStream := make(chan *oomparser.OomInstance, 10)
    	go ow.oomStreamer.StreamOoms(outStream)
    
    	go func() {
    		defer runtime.HandleCrash()
    
    		for event := range outStream {
    			if event.VictimContainerName == recordEventContainerName {
    				klog.V(1).InfoS("Got sys oom event", "event", event)
    				eventMsg := "System OOM encountered"
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Nov 08 23:17:05 UTC 2022
    - 2.3K bytes
    - Viewed (0)
Back to top