Skip to content

fix: Don't hide errors in destination server#529

Merged
kodiakhq[bot] merged 3 commits intomainfrom
fix/dont_hide_errors
Dec 27, 2022
Merged

fix: Don't hide errors in destination server#529
kodiakhq[bot] merged 3 commits intomainfrom
fix/dont_hide_errors

Conversation

@yevgenypats
Copy link
Copy Markdown
Contributor

@yevgenypats yevgenypats commented Dec 24, 2022

Copy link
Copy Markdown
Member

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @yevgenypats, added a few comments. Maybe we should sync on this to ensure I'm not missing anything with our error handling logic.

Also I'm not sure how this closes https://github.com/cloudquery/plugin-sdk/pull/463/files as it doesn't reduce the nesting.

Additionally #487 proposes a way to report multiple errors instead of using x and y failed

if err := eg.Wait(); err != nil {
s.Logger.Error().Err(err).Msg("got error. failed to wait for plugin")
if wgErr := eg.Wait(); wgErr != nil {
return status.Errorf(codes.Internal, "failed to receive msg: %v and wait for plugin: ", err, wgErr)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's not accurate to report failed to wait for plugin.
The error returned from the wait group is whatever returned from the wait group Go Routine, i.e. whatever returned from s.Plugin.Write(ctx, tables, sourceName, syncTime, resources), so if eg.Wait() != nil it means the write failed, not that the wait failed.

Please let me know if that makes sense

close(resources)
if err := eg.Wait(); err != nil {
s.Logger.Error().Err(err).Msg("failed to wait")
return status.Errorf(codes.Internal, "Context done: %v and failed to wait for plugin: %v",ctx.Err(), err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure we should report the context error if the write failed. If the write fails the context error is always context cancelled so it has no value. See https://github.com/cloudquery/plugin-sdk/pull/460/files#diff-1df6a94b537b58b0f652697d4a670466f1f889553d4a55b654e4a818ea16a02fR113 and #460 (comment)

return status.Errorf(codes.Internal, "Context done: %v and failed to wait for plugin: %v",ctx.Err(), err)
}
return ctx.Err()
return status.Errorf(codes.Internal, "Context done: %v", ctx.Err())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See https://github.com/cloudquery/plugin-sdk/pull/486/files for how to convert context errors to gRPC status codes

Co-authored-by: Erez Rokah <erezrokah@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 27, 2022

⏱️ Benchmark results

Comparing with 5590845

  • DefaultConcurrency-2 resources/s: 11,022 ⬇️ 2.89% decrease vs. 5590845
  • Glob-2 ns/op: 145 ⬇️ 28.62% decrease vs. 5590845
  • TablesWithChildrenDefaultConcurrency-2 resources/s: 29,172 ⬇️ 4.94% decrease vs. 5590845
  • BufferedScanner-2 ns/op: 10.03 ⬇️ 10.57% decrease vs. 5590845
  • LogReader-2 ns/op: 30.55 ⬇️ 16.01% decrease vs. 5590845

@kodiakhq kodiakhq bot merged commit d91f94f into main Dec 27, 2022
@kodiakhq kodiakhq bot deleted the fix/dont_hide_errors branch December 27, 2022 15:29
kodiakhq bot pushed a commit that referenced this pull request Dec 27, 2022
🤖 I have created a release *beep* *boop*
---


## [1.14.0](v1.13.1...v1.14.0) (2022-12-27)


### Features

* Add basic periodic metric INFO logger ([#496](#496)) ([8d1d32e](8d1d32e))


### Bug Fixes

* **destinations:** Stop writing resources when channel is closed ([#460](#460)) ([5590845](5590845))
* Don't hide errors in destination server ([#529](#529)) ([d91f94f](d91f94f))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants