Repository navigation
provides set of fixes and test for tuple byte buffs - #739
OlegDokuka wants to merge 1 commit into
Conversation
Signed-off-by: Oleh Dokuka <shadowgun@i.ua>
|
|
||
| @Override | ||
| public ByteBuf unwrap() { | ||
| throw new UnsupportedOperationException(); |
There was a problem hiding this comment.
Looks like. Please see https://netty.io/4.0/api/io/netty/buffer/ByteBuf.html#unwrap--
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
Returns:
null if this buffer is not a wrapper
| import java.nio.channels.FileChannel; | ||
| import java.nio.channels.ScatteringByteChannel; | ||
|
|
||
| abstract class AbstractReadOnlyReferenceCountedByteBuf extends AbstractReferenceCountedByteBuf { |
There was a problem hiding this comment.
The netty docs deprecated similar classes and suggest using Unpooled.wrappedUnmodifiableBuffer. Also the docs call out slice as an issue, how is this handled?
There was a problem hiding this comment.
It is deprecated but there are no other options to extend. TupledByteBuf designed to be readOnly and I don't wanna create few more objects to runtime just in order to use what netty gives. therefore I mimic the same what readonly bytebuf does
|
Can you call out the fixes specifically? |
I added more explanation on the fixes I have done. In general, PR adopts netty bytebuf test-suite which ensures proper implementation of rsocket bytebuf. On the other hand, most of the fixes were discovered as the result of running adopted test-suit against the implementation /cc @yschimke @simonbasle |
mostroverkhov
left a comment
There was a problem hiding this comment.
TupleByteBuf was originally intended to reduce copying, but unfortunately with SSL handler on pipeline It can make performance worse: engine cant append Bytebufs (until fit single TLS record) because Tuple is not writable, so allocates new buffer and does copy anyways. Do you think It makes sense to optimise for plaintext over TLS?
Also AFAIK buggy TupleByteBuf implementation was one of the reasons (together with #709) any release after 0.12.2-RC4 (transitively current spring-boot and spring-integration) is unstable & unusable with TLS enabled transports. SSLHandler is the only one example - custom implementation of huge ByteBuf interface may easily have more bugs revealed with other netty handlers.
I suggest giving users choice between pragmatic and stable CompositeByteBuf and custom one, move TupleByteBuf out of core to project - there were enough issues with It.
I'm not sure this comment might ever be applicable to this PR since it's main intent is to provide a test suite for In general, I was thinking of making TupleByteBuf writable, counting the fact that right now we have issues with TLS |
|
This is follow up on Yurii request reqarding justification for 5k LOC bugfix. please do, but with an option for people to select implementation (CompositeByteBuf is pragmatic and stable one), and move |
|
FWIW I'm providing advisory drive-by reviews, not much code recently. There is a cautious balance between the need to write optimised code to avoid every allocation and keeping the code simple. I'm naturally inclined towards reuse of existing code from netty and reactor. So take my queries as mainly trying to keep that tension. |
|
As I said before, mainly, the justification for this PR is to provide a test-suit and subsequently bugfix incorrect behavior. Justification for |
|
Needs rethinking |
This PR provides tests and a couple of bugfixes for TupleByteBuf
Adopted default ByteBuf test suit for TupleByteBuf
Removes custom toString implementation in favor of built-in one https://github.com/rsocket/rsocket-java/pull/739/files#diff-639e901074347653a889b0c9c393f25dL364
Fixes readXXX for LittleEndian (https://github.com/rsocket/rsocket-java/pull/739/files#diff-183345d04c26e98d76cdd661694c7e8dL200)
Proper endiance switch support (https://github.com/rsocket/rsocket-java/pull/739/files#diff-183345d04c26e98d76cdd661694c7e8dR217) by default it should be BigEndian. On the other hand, I removed override method https://github.com/rsocket/rsocket-java/pull/739/files#diff-183345d04c26e98d76cdd661694c7e8dL232 which causes illegal behavior when netty tries to switch byte ordering in some cases
Fixes behaviors of unwrap method
Fixes behavior for setIndex(int, int) writerIndex(int) method (should change index for TupleByteBuf but should not let write data
Removes custom implementation of
slice()method since it created incorrect slice which violates the base test suitSigned-off-by: Oleh Dokuka shadowgun@i.ua