Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@bmoyles0117
Copy link
Contributor

No description provided.

callback(std::move(result_vector));
} catch (const json::Exception& e) {
LOG(ERROR) << e.what();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions:

  1. Why is the error not being caught + logged by the try-catch block around the Watchmaster (L1077)?
  2. For parity, please add a try-catch block in the NodeCallback too

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. This should have been logged in WatchMaster. I think the issue here is that the thread dies, but the right fix is to restart the watch, not to swallow the error.

@@ -1049,9 +1049,13 @@ void KubernetesReader::PodCallback(
MetadataUpdater::UpdateCallback callback,
const json::Object* pod, Timestamp collected_at, bool is_deleted) const
throw(json::Exception) {
Copy link
Contributor

@supriyagarg supriyagarg Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the method signature - since the exception is being caught and logged, the throw(..) can be dropped.

std::vector<MetadataUpdater::ResourceMetadata> result_vector =
GetPodAndContainerMetadata(pod, collected_at, is_deleted);
callback(std::move(result_vector));
} catch (const json::Exception& e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right fix for the situation -- this will simply ignore a JSON error. The assumption here is that if we got an invalid hunk of JSON, the rest of the hunks will also be garbage, so we shouldn't bother with the current connection -- it's better to re-establish the watch.

callback(std::move(result_vector));
} catch (const json::Exception& e) {
LOG(ERROR) << e.what();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. This should have been logged in WatchMaster. I think the issue here is that the thread dies, but the right fix is to restart the watch, not to swallow the error.

@igorpeshansky
Copy link
Contributor

Superseded by #79.

@bmoyles0117 bmoyles0117 deleted the bmoyles0117-fix-pod-callback branch November 15, 2018 22:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants