Skip to content

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

Merged
normanmaurer merged 1 commit into
4.1from
relative_access_multiple_threads
May 23, 2024
Merged

normanmaurer merged 1 commit into
4.1from
relative_access_multiple_threads

Conversation

@normanmaurer

Copy link
Copy Markdown
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
Copy Markdown
Member Author

PTAL @lhotari

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

@lhotari lhotari left a comment

Copy link
Copy Markdown
Contributor

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 .

@chrisvest chrisvest left a comment

Copy link
Copy Markdown
Member

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
@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
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