Skip to content
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

Log ErrUnexpectedEOF from watches as warnings #2767

Merged
merged 1 commit into from
Dec 5, 2014
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/client/cache/reflector.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package cache
import (
"errors"
"fmt"
"io"
"reflect"
"time"

Expand Down Expand Up @@ -99,7 +100,14 @@ func (r *Reflector) listAndWatch() {
for {
w, err := r.listerWatcher.Watch(resourceVersion)
if err != nil {
glog.Errorf("failed to watch %v: %v", r.expectedType, err)
switch err {
case io.EOF:
// watch closed normally
case io.ErrUnexpectedEOF:
glog.V(1).Infof("Watch for %v closed with unexpected EOF: %v", r.expectedType, err)
default:
glog.Errorf("Failed to watch %v: %v", r.expectedType, err)
}
return
}
if err := r.watchHandler(w, &resourceVersion); err != nil {
Expand Down Expand Up @@ -167,6 +175,6 @@ func (r *Reflector) watchHandler(w watch.Interface, resourceVersion *string) err
glog.Errorf("unexpected watch close - watch lasted less than a second and no items received")
return errors.New("very short watch")
}
glog.V(4).Infof("watch close - %v total items received", eventCount)
glog.V(4).Infof("Watch close - %v total %v items received", r.expectedType, eventCount)
return nil
}
7 changes: 6 additions & 1 deletion pkg/watch/iowatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ func (sw *StreamWatcher) receive() {
for {
action, obj, err := sw.source.Decode()
if err != nil {
if err != io.EOF {
switch err {
case io.EOF:
// watch closed normally
case io.ErrUnexpectedEOF:
glog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err)
default:
glog.Errorf("Unable to decode an event from the watch stream: %v", err)
}
return
Expand Down