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

Fixes issue where a CE response is truncated #6758

Merged
merged 2 commits into from
Feb 27, 2023

Conversation

gab-satchi
Copy link
Contributor

@gab-satchi gab-satchi commented Feb 15, 2023

Proposed Changes

  • 🐛 Fixes an issue where a Cloud Event in a response from a sink was truncated to 1024 bytes

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

🐛 Fixes an issue where a Cloud Event in a response from a sink was truncated to 1024 bytes

Before the changes in #6521, the response was being truncated when an error occurred. That felt wrong as well, so with these changes, response body isn't truncated regardless of status.

@knative-prow knative-prow bot requested review from aslom and lberk February 15, 2023 20:27
@knative-prow knative-prow bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 15, 2023
@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Base: 80.47% // Head: 80.47% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (52f5f71) compared to base (f022034).
Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6758      +/-   ##
==========================================
- Coverage   80.47%   80.47%   -0.01%     
==========================================
  Files         236      236              
  Lines       12164    12162       -2     
==========================================
- Hits         9789     9787       -2     
  Misses       1888     1888              
  Partials      487      487              
Impacted Files Coverage Δ
pkg/channel/message_dispatcher.go 76.65% <50.00%> (-0.21%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

It would be good to include an e2e broker conformance test that could be used to test the Kafka and RabbitMQ implementations as well.

execInfo.ResponseBody = []byte(fmt.Sprintf("dispatch error: %s", err.Error()))
} else {
execInfo.ResponseBody = body[:readLen]
execInfo.ResponseBody = body.Bytes()
Copy link
Member

Choose a reason for hiding this comment

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

Do you still want to truncate the payload here in error cases?

(I suspect the right thing to do may actually be to truncate the overall message, preferring to cut payload over other attributes.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't check if the response is a cloud event in error cases. The payload gets truncated in a later step by a transformer and then put in as a cloud event extension on the original message. It's then sent to the dead letter. So I think the truncation still happens, it's just no longer part of the executeRequest

I'll double check the above and add a conformance test

Copy link
Member

Choose a reason for hiding this comment

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

I'll double check the above and add a conformance test

@gab-satchi Did you add some conformance test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matzew, Just an e2e test right now. I can add one under here but if we're looking for one that could be reused by other implementations then that seems like a bigger effort.

I'm seeing all the delivery based ones just TODO-ed here

@matzew
Copy link
Member

matzew commented Feb 16, 2023

response from a sink!

I had a different test, added as e2e, for a "large" incoming request: https://github.com/knative/eventing/pull/6666/files

@gab-satchi wanna add a similar test for the respone?

And looks like we should backport this to 1.8+ (given the referenced PR landed after 1.7 release)

@knative-prow knative-prow bot added area/test-and-release Test infrastructure, tests or release size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 16, 2023
@gab-satchi
Copy link
Contributor Author

Thanks @matzew, added a similar test

@gab-satchi
Copy link
Contributor Author

/retest

@pierDipi pierDipi requested a review from matzew February 21, 2023 14:25
@matzew
Copy link
Member

matzew commented Feb 23, 2023

I'd like to get this, eventually, backported to 1.9 and 1.8 as well, @gab-satchi

thanks for looking at this

/lgtm
/hold b/c of conformance test question

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 23, 2023
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 23, 2023
Copy link
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow
Copy link

knative-prow bot commented Feb 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gab-satchi, matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2023
@matzew
Copy link
Member

matzew commented Feb 27, 2023

/cherry-pick release-1.9

@knative-prow-robot
Copy link
Contributor

@matzew: once the present PR merges, I will cherry-pick it on top of release-1.9 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@matzew
Copy link
Member

matzew commented Feb 27, 2023

/cherry-pick release-1.8

@knative-prow-robot
Copy link
Contributor

@matzew: once the present PR merges, I will cherry-pick it on top of release-1.8 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@matzew
Copy link
Member

matzew commented Feb 27, 2023

/unhold

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 27, 2023
@knative-prow knative-prow bot merged commit 52574ce into knative:main Feb 27, 2023
@knative-prow-robot
Copy link
Contributor

@matzew: new pull request created: #6781

In response to this:

/cherry-pick release-1.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot
Copy link
Contributor

@matzew: new pull request created: #6782

In response to this:

/cherry-pick release-1.8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

knative-prow bot pushed a commit that referenced this pull request Feb 28, 2023
cherry-pick of #6758 

```release-note
🐛 Fixes an issue where a Cloud Event in a response from a sink was truncated to 1024 bytes
```
matzew pushed a commit to matzew/eventing that referenced this pull request Feb 28, 2023
… (knative#6783)

cherry-pick of knative#6758 

```release-note
🐛 Fixes an issue where a Cloud Event in a response from a sink was truncated to 1024 bytes
```
openshift-merge-robot pushed a commit to openshift-knative/eventing that referenced this pull request Feb 28, 2023
… (knative#6783) (#141)

cherry-pick of knative#6758 

```release-note
🐛 Fixes an issue where a Cloud Event in a response from a sink was truncated to 1024 bytes
```

Co-authored-by: Gab Satchi <[email protected]>
vishal-chdhry pushed a commit to vishal-chdhry/eventing that referenced this pull request Mar 14, 2023
## Proposed Changes

- 🐛 Fixes an issue where a Cloud Event in a response from a sink was
truncated to 1024 bytes

### Pre-review Checklist

<!-- If these boxes are not checked, you will be asked to complete these
requirements or explain why they do not apply to your PR. -->

- [x] **At least 80% unit test coverage**
- [x] **E2E tests** for any new behavior
- [x] **Docs PR** for any user-facing impact
- [x] **Spec PR** for any new API feature
- [x] **Conformance test** for any change to the spec

**Release Note**

```release-note
🐛 Fixes an issue where a Cloud Event in a response from a sink was truncated to 1024 bytes
```

Before the changes in knative#6521, the response was being truncated when an
error occurred. That felt wrong as well, so with these changes, response
body isn't truncated regardless of status.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test-and-release Test infrastructure, tests or release lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants