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

ReadOnlyByteBufferBuf | ReadOnlyUnsafeDirectByteBuf get*, copy*, dupl… #14072

Merged
merged 1 commit into from
May 23, 2024

Conversation

normanmaurer
Copy link
Member

…icate*, slice* methods should be safe to be called from multiple threads.

Motivation:

Get* operations should always be safe to be used from different Threads.

Modifications:

  • Only use internalNioBuffer when one of the read* or write* mthods are used. This is neccessary to prevent races as those can happen when a slice or duplicate is shared between different Channels
  • Add unit tests

Result:

Fixes #14070. Related to #1865

…icate*, slice* methods should be safe to be called from multiple threads.

Motivation:

Get* operations should always be safe to be used from different Threads.

Modifications:

- Only use internalNioBuffer when one of the read* or write* mthods are used. This is neccessary to prevent races as those can happen when a slice or duplicate is shared between different Channels
- Add unit tests

Result:

Fixes #14070. Related to #1865
@normanmaurer
Copy link
Member Author

PTAL @lhotari

@normanmaurer normanmaurer added this to the 4.1.111.Final milestone May 23, 2024
Copy link
Contributor

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

Looks solid! Great work @normanmaurer .

Copy link
Contributor

@chrisvest chrisvest left a comment

Choose a reason for hiding this comment

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

Looks good.

@normanmaurer normanmaurer merged commit d19f902 into 4.1 May 23, 2024
17 checks passed
@normanmaurer normanmaurer deleted the relative_access_multiple_threads branch May 23, 2024 18:43
normanmaurer added a commit that referenced this pull request May 23, 2024
#14072)

…icate*, slice* methods should be safe to be called from multiple
threads.

Motivation:

Get* operations should always be safe to be used from different Threads.

Modifications:

- Only use internalNioBuffer when one of the read* or write* mthods are
used. This is neccessary to prevent races as those can happen when a
slice or duplicate is shared between different Channels
- Add unit tests

Result:

Fixes #14070. Related to
#1865
normanmaurer added a commit to yawkat/netty that referenced this pull request Jul 17, 2024
netty#14072)

…icate*, slice* methods should be safe to be called from multiple
threads.

Motivation:

Get* operations should always be safe to be used from different Threads.

Modifications:

- Only use internalNioBuffer when one of the read* or write* mthods are
used. This is neccessary to prevent races as those can happen when a
slice or duplicate is shared between different Channels
- Add unit tests

Result:

Fixes netty#14070. Related to
netty#1865
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.

Calling ReadOnlyByteBufferBuf.getBytes(int, byte[], int, int) concurrently from multiple threads will fail
3 participants