Commit Graph

640 Commits

Author SHA1 Message Date
Norman Maurer
ad6e4fcb10 [maven-release-plugin] prepare for next development iteration 2018-02-05 14:31:57 +00:00
Norman Maurer
a15dd48862 [maven-release-plugin] prepare release netty-4.0.56.Final 2018-02-05 14:31:39 +00:00
Norman Maurer
3b57a73602 Use FastThreadLocal for CodecOutputList
Motivation:

We used Recycler for the CodecOutputList which is not optimized for the use-case of access only from the same Thread all the time.

Modifications:

- Use FastThreadLocal for CodecOutputList
- Add benchmark

Result:

Less overhead in our codecs.
2018-01-23 11:34:52 +01:00
Norman Maurer
db6f9f4f26 [maven-release-plugin] prepare for next development iteration 2018-01-21 18:02:00 +00:00
Norman Maurer
8a4654ae9f [maven-release-plugin] prepare release netty-4.0.55.Final 2018-01-21 18:01:42 +00:00
Abhijit Sarkar
c870dbf3a7 Fixes #7566 by handling concatenated GZIP streams.
Motivation:
According to RFC 1952, concatenation of valid gzip streams is also a valid gzip stream. JdkZlibDecoder only processed the first and discarded the rest.

Modifications:
- Introduced a constructor argument decompressConcatenated that if true, JdkZlibDecoder would continue to process the stream.

Result:
- If 'decompressConcatenated = true', concatenated streams would be processed in
compliance to RFC 1952.
- If 'decompressConcatenated = false' (default), existing behavior would remain.
2018-01-17 06:17:42 +01:00
Norman Maurer
692ce0c288 [maven-release-plugin] prepare for next development iteration 2017-12-08 14:30:35 +00:00
Norman Maurer
ae43640088 [maven-release-plugin] prepare release netty-4.0.54.Final 2017-12-08 14:30:20 +00:00
Norman Maurer
d23feba2fa [maven-release-plugin] prepare for next development iteration 2017-11-09 00:08:30 +00:00
Norman Maurer
f571151794 [maven-release-plugin] prepare release netty-4.0.53.Final 2017-11-09 00:05:39 +00:00
Idel Pivnitskiy
eb548b8667 Update links for actual Protobuf repo and documentation
Motivation:

Use actual links to new locations of Protobuf repo and documentation to
avoid problems when redirect will not work.

Modification:

Links in comments and all/pom.xml

Result:

Correct links to Protobuf resources
2017-10-23 08:48:04 +02:00
Idel Pivnitskiy
e9fe258081 Add missed 'serialVersionUID' field for Serializable classes
Motivation:

Without a 'serialVersionUID' field, any change to a class will make
previously serialized versions unreadable.

Modifications:

Add missed 'serialVersionUID' field for all Serializable
classes.

Result:

Proper deserialization of previously serialized objects.
2017-10-21 14:42:09 +02:00
Jason Tedor
b5b53daf91 Do not treat errors as decoder exception (redux)
Motivation: Today when Netty encounters a general error while decoding
it treats this as a decoder exception. However, for fatal causes this
should not be treated as such, instead the fatal error should be carried
up the stack without the callee having to unwind causes. This was
probably done for byte to byte message decoder but is now done for all
decoders.

Modifications: Instead of translating any error to a decoder exception,
we let those unwind out the stack (note that finally blocks still
execute) except in places where an event needs to fire where we fire
with the error instead of wrapping in a decoder exception.

Result: Fatal errors will not be treated as innocent decoder exceptions.
2017-10-07 20:18:02 +02:00
Jason Tedor
4ad6ed17eb Do not treat errors as decoder exception
Motivation: Today when Netty encounters a general error while decoding
it treats this as a decoder exception. However, for fatal causes this
should not be treated as such, instead the fatal error should be carried
up the stack without the callee having to unwind causes.

Modifications: Instead of translating any error to a decoder exception,
we let those unwind out the stack (note that finally blocks still
execute).

Result: Fatal errors will not be treated as innocent decoder exceptions.
2017-10-05 08:27:01 +02:00
Norman Maurer
b30d73e013 [maven-release-plugin] prepare for next development iteration 2017-09-21 19:47:23 +00:00
Norman Maurer
4e9a6e5ab6 [maven-release-plugin] prepare release netty-4.0.52.Final 2017-09-21 19:47:02 +00:00
Norman Maurer
a0701b2243 Fix compilation error introduced by 70684c2247 2017-09-18 14:58:59 -07:00
Jackie.Meng
70684c2247 Use offset finding eol avoid repeated scaning.
Motivation:

A large frame will be componsed by many packages. Every time the package
arrived, findEndOfLine will be called from the start of the buffer. It
will cause the complexity of reading frame equal to  O(n^2). This can be
eliminated by using a offset to mark the last scan position, when new
package arrived, just find the delimter from the mark. The complexity
will be O(n).

Modification:

Add a offset to mark the last scan position.

Result:

Better performance for read large frame.
2017-09-17 09:19:26 -07:00
Francesco Nigro
ff22b6573d Makes LengthFieldBasedFrameDecoder::decode inlineable
Motivation:

The decode method is too large to be inlined with default compiler settings, hence the uncommon paths need to be packed and moved away form the common one.

Modifications:

The uncommon paths of the decode call (eg failures with thrown exceptions) are packed and moved in private methods in order to reduce the size of the common one
and let it being inlined.

Result:

The decode method is being inlined if the stack depth allows it.
2017-08-28 09:09:00 +02:00
Norman Maurer
a27624a77b [maven-release-plugin] prepare for next development iteration 2017-08-24 12:47:31 +00:00
Norman Maurer
cf89fb78b8 [maven-release-plugin] prepare release netty-4.0.51.Final 2017-08-24 12:46:31 +00:00
Derek Perez
b4e5d3bf63 various errorprone fixes.
Motivation:

Continuing to make netty happy when compiling through errorprone.

Modification:

Mostly comments, some minor switch statement changes.

Result:

No more compiler errors!
2017-08-23 13:45:15 +02:00
Norman Maurer
703dc8c95d Revert "Only call ctx.fireChannelReadComplete() if ByteToMessageDecoder decoded at least one message."
This reverts commit d63bb4811e as this not covered correctly all cases and so could lead to missing fireChannelReadComplete() calls. We will re-evalute d63bb4811e and resbumit a pr once we are sure all is handled correctly
2017-08-18 09:14:24 +02:00
Norman Maurer
29d5bac7ac Only call ctx.fireChannelReadComplete() if ByteToMessageDecoder decoded at least one message.
Motivation:

Its wasteful and also confusing that channelReadComplete() is called even if there was no message forwarded to the next handler.

Modifications:

- Only call ctx.fireChannelReadComplete() if at least one message was decoded
- Add unit test

Result:

Less confusing behavior. Fixes [#4312].
2017-08-04 11:19:50 +02:00
Norman Maurer
d0d1105e45 [maven-release-plugin] prepare for next development iteration 2017-08-02 20:29:15 +02:00
Norman Maurer
5d304e9521 [maven-release-plugin] prepare release netty-4.0.50.Final 2017-08-02 20:28:37 +02:00
Nikolay Fedorovskikh
287e147395 Fix hash function and hash table size in Snappy
Motivation:

1. Hash function in the Snappy encoding is wrong probably: used '+' instead of '*'. See the reference implementation [1].
2. Size of the hash table is calculated, but not applied.

Modifications:

1. Fix hash function: replace addition by multiplication.
2. Allocate hash table with calculated size.
3. Use an `Integer.numberOfLeadingZeros` trick for calculate log2.
4. Release buffers in tests.

Result:

1. Better compression. In the test `encodeAndDecodeLongTextUsesCopy` now compressed size is 175 instead of 180 before this change.
2. No redundant allocations for hash table.
3. A bit faster the calc of shift (less an expensive math operations).

[1] 513df5fb5a/snappy.cc (L67)
2017-08-01 07:13:13 +02:00
Norman Maurer
dde14d2a65 [maven-release-plugin] prepare for next development iteration 2017-07-06 07:37:47 +02:00
Norman Maurer
1e50efb615 [maven-release-plugin] prepare release netty-4.0.49.Final 2017-07-06 07:37:30 +02:00
Norman Maurer
7aa8ad1841 [maven-release-plugin] prepare for next development iteration 2017-06-09 11:23:06 +02:00
Norman Maurer
b6be3a77bc [maven-release-plugin] prepare release netty-4.0.48.Final 2017-06-09 11:22:25 +02:00
Scott Mitchell
19be3fe5f2 JdkZlibDecoder and JZlibDecoder consistency
Motivation:
JdkZlibDecoder will allocate a new buffer when the previous buffer is filled with inflated data, but JZlibDecoder will attempt to use the same buffer by resizing. This leads to inconsistent results when these two decoders that are intended to be functionality equivalent.

Modifications:
- JdkZlibDecoder should attempt to resize and reuse the existing buffer instead of creating multiple buffers

Result:
Fixes https://github.com/netty/netty/issues/6804
2017-06-06 14:19:09 -07:00
Norman Maurer
c9b5415c91 [maven-release-plugin] prepare for next development iteration 2017-05-11 12:26:35 +02:00
Norman Maurer
9c432f8ae1 [maven-release-plugin] prepare release netty-4.0.47.Final 2017-05-11 12:26:15 +02:00
Scott Mitchell
23fc5d7af7 ByteToMessageDecoder#handlerRemoved may release cumulation buffer prematurely
Motivation:
ByteToMessageDecoder#handlerRemoved will immediately release the cumulation buffer, but it is possible that a child class may still be using this buffer, and therefore use a dereferenced buffer.

Modifications:
- ByteToMessageDecoder#handlerRemoved and ByteToMessageDecoder#decode should coordinate to avoid the case where a child class is using the cumulation buffer but ByteToMessageDecoder releases that buffer.

Result:
Child classes of ByteToMessageDecoder are less likely to reference a released buffer.
2017-05-10 11:19:20 -07:00
Norman Maurer
8d73e2637a [maven-release-plugin] prepare for next development iteration 2017-04-29 15:21:48 +02:00
Norman Maurer
cdc6671828 [maven-release-plugin] prepare release netty-4.0.46.Final 2017-04-29 15:21:21 +02:00
Norman Maurer
ae5dba5393 Fix possible overflow when calculate in the size of the out buffer in Base64
Motivation:

We not correctly guarded against overflow and so call Base64.encode(...) with a big buffer may lead to an overflow when calculate the size of the out buffer.

Modifications:

Correctly guard against overflow.

Result:

Fixes [#6620].
2017-04-21 08:19:47 +02:00
Nikolay Fedorovskikh
0444d4e165 fix the typos 2017-04-20 05:19:06 +02:00
Norman Maurer
32aa8f980d Correctly handle read-only ByteBuf in ByteToMessageDecoder
Motivation:

If a read-only ByteBuf is passed to the ByteToMessageDecoder.channelRead(...) method we need to make a copy of it once we try to merge buffers for cumulation. This usually is not the case but can for example happen if the local transport is used. This was the cause of the leak report we sometimes saw during the codec-http2 tests, as we are using the local transport and write a read-only buffer. This buffer will then be passed to the peer channel and fired through the pipeline and so end up as the cumulation buffer in the ByteToMessageDecoder. Once the next fragement is received we tried to merge these and failed with a ReadOnlyBufferException which then produced a leak.

Modifications:

Ensure we copy the buffer if its read-only.

Result:

No more exceptions and so leak when a read-only buffer is passed to ByteToMessageDecoder.channelRead(...)
2017-04-19 07:40:24 +02:00
Norman Maurer
577757198b [maven-release-plugin] prepare for next development iteration 2017-03-10 09:37:31 +01:00
Norman Maurer
f994184afd [maven-release-plugin] prepare release netty-4.0.45.Final 2017-03-10 09:02:39 +01:00
Scott Mitchell
ac6e6cb2d4 Correct ProtobufDecoder backport issues from d1865406ed 2017-03-07 16:05:34 -08:00
Scott Mitchell
74d18dbc67 Restore ProtobufDecoder which was removed by d1865406ed 2017-03-07 15:38:40 -08:00
ulinnuha
d1865406ed Update links from code.google.com to github.com
Motivation:

This pull request does not solve any problem but we find that several links in the code refer to project websites under the domain of http://code.google.com which are either moved to github or not maintained anymore.

Modification:

Update the project links from code.google.com to the relevant project in github.com
2017-03-07 10:22:20 +01:00
Scott Mitchell
492ba62b9d Base64 reduce byte manipulation operations
Motivation:
Base64#decode4to3 generally calculates an int value where the contents of the decodabet straddle bytes, and then uses a byte shifting or a full byte swapping operation to get the resulting contents. We can directly calculate the contents and avoid any intermediate int values and full byte swap operations. This will reduce the number of operations required during the decode operation.

Modifications:
- remove the intermediate int in the Base64#decond4to3 method.
- manually do the byte shifting since we are already doing bit/byte manipulations here anyways.

Result:
Base64#decode4to3 requires less operations to compute the end result.
2017-02-22 21:34:20 -08:00
Norman Maurer
6db59cc97e Improve performance of Base64.decode and encode methods.
Motivation:

The decode and encode method uses getByte(...) and setByte(...) in loops which can be very expensive because of bounds / reference-count checking. Beside this it also slows-down a lot when paranoid leak-detection is enabled as it will track each access.

Modifications:

- Pack bytes into int / short and so reduce operations on the ByteBuf
- Use ByteBufProcessor to reduce getByte calls.

Result:

Better performance in general. Also when you run the build with -Pleak the handler module will build in 1/4 of the time it took before.
2017-02-22 20:17:17 +01:00
Nikolay Fedorovskikh
1ff8c762cd Fix javadoc issues
Motivation:

Invalid javadoc in project

Modifications:

Fix it

Result:

More correct javadoc
2017-02-22 07:53:53 +01:00
Norman Maurer
da94a908ad Prefer JDK ThreadLocalRandom implementation over ours.
Motivation:

We have our own ThreadLocalRandom implementation to support older JDKs . That said we should prefer the JDK provided when running on JDK >= 7

Modification:

Using ThreadLocalRandom implementation of the JDK when possible.

Result:

Make use of JDK implementations when possible.
2017-02-17 07:36:11 +01:00
Norman Maurer
0a7cce243c Ensure CombinedChannelDuplexHandler can not be shared.
Motivation:

CombinedChannelDuplexHandler must not be shared as it contains state.

Modifications:

Enforce that it is not shared.

Result:

Fixes [#6333]
2017-02-14 08:42:45 +01:00