Skip to content

Empty Payload Response treated as Complete frame #206

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

Merged
merged 2 commits into from
Dec 14, 2016

Conversation

NiteshKant
Copy link
Contributor

Problem

FrameHeaderFlyweight resolves the frame type as NEXT_COMPLETE only if the payload is not empty. Otherwise, the frame is treated as COMPLETE.
This is a problem for request-response as this means the response publisher will complete without emitting a response, if the response does not have any data. Such a condition is a failure as request-response should have exaclty one response.

Modification

Eliminated the check for data length and always emit NEXT_COMPLETE if the complete flag is set.
According to the protocol:

A Response is generally referred to as a NEXT.

So, this behavior would not be a violation of the protocol but will produce empty onNext before onComplete

Result

Better behavior with empty responses.

#### Problem

`FrameHeaderFlyweight` resolves the frame type as `NEXT_COMPLETE` only if the payload is not empty. Otherwise, the frame is treated as `COMPLETE`.
This is a problem for request-response as this means the response publisher will complete without emitting a response, if the response does not have any data. Such a condition is a failure as request-response should have exaclty one response.

 #### Modification

 Eliminated the check for data length and always emit `NEXT_COMPLETE` if the complete flag is set.
 According to the [protocol](https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md#response-frame):

 ```
 A Response is generally referred to as a NEXT.
 ```

 So, this behavior would not be a violation of the protocol but will produce empty `onNext` before `onComplete`

 #### Result

 Better behavior with empty responses.
Copy link
Member

@stevegury stevegury left a comment

Choose a reason for hiding this comment

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

👍

@NiteshKant NiteshKant merged commit b8fd58a into rsocket:0.5.x Dec 14, 2016
@NiteshKant NiteshKant deleted the 0.5.x-next-complete branch December 14, 2016 17:47
NiteshKant added a commit to NiteshKant/reactivesocket-java that referenced this pull request Dec 14, 2016
#### Problem

`FrameHeaderFlyweight` resolves the frame type as `NEXT_COMPLETE` only if the payload is not empty. Otherwise, the frame is treated as `COMPLETE`.
This is a problem for request-response as this means the response publisher will complete without emitting a response, if the response does not have any data. Such a condition is a failure as request-response should have exaclty one response.

 #### Modification

 Eliminated the check for data length and always emit `NEXT_COMPLETE` if the complete flag is set.
 According to the [protocol](https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md#response-frame):

 ```
 A Response is generally referred to as a NEXT.
 ```

 So, this behavior would not be a violation of the protocol but will produce empty `onNext` before `onComplete`

 #### Result

 Better behavior with empty responses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants