Skip to content

Frame instance was referenced longer than required. #88

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 1 commit into from
Jun 3, 2016

Conversation

NiteshKant
Copy link
Contributor

Problem:

handleXXX methods in Responder were closing over the passed requestFrame and using it later in the lifecycle of request processing.
Frame objects and the underlying buffers are not designed to be retained after the scope of the parent method as these objects are threadlocal and reused. This causes issues when the frame object is referenced later in the request processing (eg: cleanup())

Solution:

The only reason frame object was retained was to get the stream Id. This change pre-fetches the streamId and uses that from within the processing closure.

Result:

No more issue with frame access.

Problem:

`handleXXX` methods in `Responder` were closing over the passed `requestFrame` and using it later in the lifecycle of request processing.
 `Frame` objects and the underlying buffers are not designed to be retained after the scope of the parent method as these objects are threadlocal and reused. This causes issues when the frame object is referenced later in the request processing (eg: `cleanup()`)

 Solution:

 The only reason frame object was retained was to get the stream Id. This change pre-fetches the `streamId` and uses that from within the processing closure.

 Result:

 No more issue with frame access.
@stevegury
Copy link
Member

👍 This looks good, thanks for the fix!

@stevegury stevegury merged commit f62e73d into rsocket:master Jun 3, 2016
@NiteshKant NiteshKant deleted the frame-ref branch June 19, 2016 05:05
ilayaperumalg pushed a commit to ilayaperumalg/rsocket-java that referenced this pull request Dec 26, 2017
US Typo and reword the frame length requirements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants