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

CompositeByteBuf.addComponent ownership clarification #4760

Closed
Scottmitch opened this issue Jan 26, 2016 · 2 comments
Closed

CompositeByteBuf.addComponent ownership clarification #4760

Scottmitch opened this issue Jan 26, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@Scottmitch
Copy link
Member

If all goes well CompositeByteBuf.addComponent will take "ownership" (will call release()) of the parameter. However there are cases where this is not the case. For example if the CompositeByteBuf has been released addComponent may throw an IllegalReferenceCountException and not release the parameter. At the very least the interface should be clarified so that the caller can understand expectations. However I would like see if there are any objections to CompositeByteBuf.addComponent always assuming "ownership" of the parameter. This would be analogous to a Channel.write always assuming responsibility of the parameter even if the underlying transport cannot actually support the write operation.

@Scottmitch
Copy link
Member Author

/cc @normanmaurer @nmittler @trustin

@Scottmitch Scottmitch self-assigned this Jan 26, 2016
Scottmitch added a commit to Scottmitch/netty that referenced this issue Jan 29, 2016
Motivation:
The current interface for CompositeByteBuf.addComponent is not clear under what conditions ownership is transferred when addComponent is called. There should be a well defined behavior so that users can ensure that no leaks occur.

Modifications:
- CompositeByteBuf.addComponent should always assume reference count ownership

Result:
Users that call CompositeByteBuf.addComponent do not have to independently check if the buffer's ownership has been transferred and if not independently release the buffer.
Fixes netty#4760
@normanmaurer
Copy link
Member

@trustin ping again

Scottmitch added a commit that referenced this issue Feb 2, 2016
Motivation:
The current interface for CompositeByteBuf.addComponent is not clear under what conditions ownership is transferred when addComponent is called. There should be a well defined behavior so that users can ensure that no leaks occur.

Modifications:
- CompositeByteBuf.addComponent should always assume reference count ownership

Result:
Users that call CompositeByteBuf.addComponent do not have to independently check if the buffer's ownership has been transferred and if not independently release the buffer.
Fixes #4760
@Scottmitch Scottmitch added this to the 4.0.35.Final milestone Feb 2, 2016
pulllock pushed a commit to pulllock/netty that referenced this issue Oct 19, 2023
Motivation:
The current interface for CompositeByteBuf.addComponent is not clear under what conditions ownership is transferred when addComponent is called. There should be a well defined behavior so that users can ensure that no leaks occur.

Modifications:
- CompositeByteBuf.addComponent should always assume reference count ownership

Result:
Users that call CompositeByteBuf.addComponent do not have to independently check if the buffer's ownership has been transferred and if not independently release the buffer.
Fixes netty#4760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants