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

Ensure the correct wrapped buffer is released in AbstractPooledDerive… #5347

Closed
wants to merge 1 commit into from

Conversation

normanmaurer
Copy link
Member

…dByteBuf.deallocate()

Motivation:

We need to first store a reference to the wrapped buffer before recycle the AbstractPooledDerivedByteBuf instance. This is needed as otherwise it is possible that the same AbstractPooledDerivedByteBuf is again obtained and init(...) is called before we actually have a chance to call release(). This leads to call release() on the wrong buffer.

Modifications:

Store a reference to the wrapped buffer before call recycle and call release on the previous stored reference.

Result:

Always release the correct wrapped buffer when deallocate the AbstractPooledDerivedByteBuf.

…dByteBuf.deallocate()

Motivation:

We need to first store a reference to the wrapped buffer before recycle the AbstractPooledDerivedByteBuf instance. This is needed as otherwise it is possible that the same AbstractPooledDerivedByteBuf is again obtained and init(...) is called before we actually have a chance to call release(). This leads to call release() on the wrong buffer.

Modifications:

Store a reference to the wrapped buffer before call recycle and call release on the previous stored reference.

Result:

Always release the correct wrapped buffer when deallocate the AbstractPooledDerivedByteBuf.
@normanmaurer normanmaurer added this to the 4.1.1.Final milestone Jun 3, 2016
@normanmaurer normanmaurer self-assigned this Jun 3, 2016
@normanmaurer
Copy link
Member Author

@Scottmitch @trustin PTAL

@Scottmitch
Copy link
Member

lgtm ... tough to create a unit test for this race condition I guess?

@normanmaurer
Copy link
Member Author

@Scottmitch yeah I tried without any luck 😞

@normanmaurer
Copy link
Member Author

Cherry-picked into 4.1 (7137d22)

@normanmaurer normanmaurer deleted the pooled_derived_deallocate_fix branch June 6, 2016 07:50
@trustin
Copy link
Member

trustin commented Jun 8, 2016

Doh! Thank you so much for reproducing and fixing this issue, @normanmaurer !

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.

None yet

3 participants