Commit Graph

165 Commits

Author SHA1 Message Date
Xiaoyan Lin
17df8171b3 Use AbstractReferenceCounted to clean up the codes for codec-memcache
Motivation:

Some duplicated methods in message types of codec-memcache can be cleaned using AbstractReferenceCounted.

Modifications:

Use AbstractReferenceCounted to avoid duplicated methods.

Result:

Duplicated methods are cleaned.
2016-02-01 15:51:08 +01:00
Xiaoyan Lin
501c35afff Retain ByteBuf extras when aggregating
Motivation:

BinaryMemcacheObjectAggregator doesn't retain ByteBuf `extras`. So `io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1` will be thrown when aggregating a message containing `extras`. See the unit test for an example.

Modifications:

`ratain` extras to fix IllegalReferenceCountException.

Result:

`extras` is retained.
2016-01-29 22:24:07 +01:00
Xiaoyan Lin
4606890513 Retain AbstractBinaryMemcacheDecoder.currentMessage when sending it out and release it when it's not used.
Motivation:

AbstractBinaryMemcacheDecoder.currentMessage is not retained after sending it out. Hence, if a message contains `extras`, `io.netty.util.IllegalReferenceCountException` will be thrown in `channelInactive`.

Modifications:

Retain AbstractBinaryMemcacheDecoder.currentMessage After putting it to `out` and release it when it's not used.

Result:

No IllegalReferenceCountException or leak.
2016-01-29 14:15:49 +01:00
Michael Nitschinger
af4f70ba28 More efficiently allocate header buffer.
Motivation
----------
Currently, only the fixed 24 bytes are allocated for the header and
then all the params as well as the optional extras and key are written
into the header section.

It is very likely that the buffer needs to expand at least two times
if either the extras and/or the key take up more space.

Modifications
-------------
Since at the point of allocation we know the key and extras length,
the buffer can be preallocated with the exact size, avoiding unnecessary
resizing and even allocating too much (since it uses power of two
internally).

Result
------
Less buffer resizing needed when encoding a memcache operation.
2016-01-26 10:14:51 +01:00
Norman Maurer
1c417e5f82 [maven-release-plugin] prepare for next development iteration 2016-01-21 15:35:55 +01:00
Norman Maurer
c681a40a78 [maven-release-plugin] prepare release netty-4.1.0.CR1 2016-01-21 15:28:21 +01:00
Norman Maurer
e969b6917c Let CombinedChannelDuplexHandler correctly handle exceptionCaught. Related to [#4528]
Motivation:

ChannelInboundHandler and ChannelOutboundHandler both can implement exceptionCaught(...) method and so we need to dispatch to both of them.

Modifications:

- Correctly first dispatch exceptionCaught to the ChannelInboundHandler but also make sure the next handler it will be dispatched to will be the ChannelOutboundHandler
- Add removeInboundHandler() and removeOutboundHandler() which allows to remove one of the combined handlers
- Let *Codec extends it and not ChannelHandlerAppender
- Remove ChannelHandlerAppender

Result:

Correctly handle events and also have same behavior as in 4.0
2016-01-18 09:54:48 +01:00
Norman Maurer
2ecce8fa56 [maven-release-plugin] prepare for next development iteration 2015-11-10 22:59:33 +01:00
Norman Maurer
6a93f331d3 [maven-release-plugin] prepare release netty-4.1.0.Beta8 2015-11-10 22:50:57 +01:00
Norman Maurer
2ff2806ada [maven-release-plugin] prepare for next development iteration 2015-10-02 09:03:29 +02:00
Norman Maurer
5a43de10f7 [maven-release-plugin] prepare release netty-4.1.0.Beta7 2015-10-02 09:02:58 +02:00
Norman Maurer
34de2667c7 [maven-release-plugin] prepare for next development iteration 2015-09-02 11:45:20 +02:00
Norman Maurer
2eb444ec1d [maven-release-plugin] prepare release netty-4.1.0.Beta6 2015-09-02 11:36:11 +02:00
Trustin Lee
e556958abc Fix a buffer leak in BinaryMemcacheEncoderTest
BinaryMemcacheEncoderTest.shouldEncodeContent() did not release one of
the three buffers.
2015-08-29 11:54:01 +09:00
Scott Mitchell
beab89bec5 Remove Erroneous imports
Motivation:
As part of merging / cherry-picking there were some Erroneous imports added to AbstractMemcacheObjectAggregator.

Modifications:
- Remove Imports from AbstractMemcacheObjectAggregator.

Result:
Code now builds.
2015-08-17 10:12:43 -07:00
Scott Mitchell
a7135e8677 HttpObjectAggregator doesn't check content-length header
Motivation:
The HttpObjectAggregator always responds with a 100-continue response. It should check the Content-Length header to see if the content length is OK, and if not responds with a 417.

Modifications:
- HttpObjectAggregator checks the Content-Length header in the case of a 100-continue.

Result:
HttpObjectAggregator responds with 417 if content is known to be too big.
2015-08-17 09:26:50 -07:00
Norman Maurer
f23b7b4efd [maven-release-plugin] prepare for next development iteration 2015-05-07 14:21:08 -04:00
Norman Maurer
871ce43b1f [maven-release-plugin] prepare release netty-4.1.0.Beta5 2015-05-07 14:20:38 -04:00
JongYoonLim
3405aee2ab Returns after encoding each message not do check following instance types
Motivation:
Current AbstractMemcacheObjectEncoder does unnecessary message type checking if the message is MemcacheMessage type.

Modifications:
Returns after encoding MemcacheMessage message.

Result:
Small performance improvement for this encoder.
2015-03-19 20:43:59 +01:00
JongYoonLim
d5e67032b5 fix typo 2015-03-19 20:41:11 +01:00
Norman Maurer
fce0989844 [maven-release-plugin] prepare for next development iteration 2015-03-03 02:06:47 -05:00
Norman Maurer
ca3b1bc4b7 [maven-release-plugin] prepare release netty-4.1.0.Beta4 2015-03-03 02:05:52 -05:00
Trustin Lee
2309a75d15 Add proxy support for client socket connections
Related issue: #1133

Motivation:

There is no support for client socket connections via a proxy server in
Netty.

Modifications:

- Add a new module 'handler-proxy'
- Add ProxyHandler and its subclasses to support SOCKS 4a/5 and HTTP(S)
  proxy connections
- Add a full parameterized test for most scenarios
- Clean up pom.xml

Result:

A user can make an outgoing connection via proxy servers with only
trivial effort.
2014-10-14 12:29:08 +09:00
Trustin Lee
b5f61d0de5 [maven-release-plugin] prepare for next development iteration 2014-08-16 03:27:42 +09:00
Trustin Lee
76ac3b21a5 [maven-release-plugin] prepare release netty-4.1.0.Beta3 2014-08-16 03:27:37 +09:00
Trustin Lee
b3c1904cc9 [maven-release-plugin] prepare for next development iteration 2014-08-15 09:31:03 +09:00
Trustin Lee
e013b2400f [maven-release-plugin] prepare release netty-4.1.0.Beta2 2014-08-15 09:30:59 +09:00
Trustin Lee
e167b02d52 [maven-release-plugin] prepare for next development iteration 2014-07-04 17:26:02 +09:00
Trustin Lee
ba50cb829b [maven-release-plugin] prepare release netty-4.1.0.Beta1 2014-07-04 17:25:54 +09:00
Trustin Lee
787663a644 [maven-release-plugin] rollback the release of netty-4.1.0.Beta1 2014-07-04 17:11:14 +09:00
Trustin Lee
83eae705e1 [maven-release-plugin] prepare release netty-4.1.0.Beta1 2014-07-04 17:02:17 +09:00
Trustin Lee
d0912f2709 Fix most inspector warnings
Motivation:

It's good to minimize potentially broken windows.

Modifications:

Fix most inspector warnings from our profile
Update IntObjectHashMap

Result:

Cleaner code
2014-07-02 19:55:07 +09:00
Trustin Lee
33b9bc02ed Fix potential buffer leak in AbstractBinaryMemcacheDecoder
If a connection is closed unexpectedly while
AbstractBinaryMemcacheDecoder decodes a message, the half-constructed
message's content might not be released.
2014-06-24 16:25:40 +09:00
Trustin Lee
cde319dabd Adhere to our getter/setter naming rules
Motivation:

Persuit for consistent method naming across all classes

Modifications:

Remove 'get' prefix for the getter methods in codec-memcache

Result:

More consistent method naming
2014-06-24 16:10:32 +09:00
Trustin Lee
3c21b1cc43 Fix buffer leak in DefaultFullBinaryMemcacheRequest/Response
Motivation:

DefaultFullBinaryMemcacheRequest/Response overrides release(), retain(),
and touch() methods without calling its super, resulting in a leak of
the extras.

Modifications:

When overriding release(), retain(), and touch(), ensure to call super.

Result:

Fixes #2533 by fixing the buffer leak
2014-06-24 15:07:33 +09:00
Trustin Lee
8b0a0f9a8f Introduce MessageAggregator and DecoderResultProvider
Motivation:

We have different message aggregator implementations for different
protocols, but they are very similar with each other.  They all stems
from HttpObjectAggregator.  If we provide an abstract class that provide
generic message aggregation functionality, we will remove their code
duplication.

Modifications:

- Add MessageAggregator which provides generic message aggregation
- Reimplement all existing aggregators using MessageAggregator
- Add DecoderResultProvider interface and extend it wherever possible so
  that MessageAggregator respects the state of the decoded message

Result:

Less code duplication
2014-06-05 16:51:14 +09:00
Trustin Lee
d765f6b870 Synchronized between 4.1 and master (part 3)
Motivation:

4 and 5 were diverged long time ago and we recently reverted some of the
early commits in master.  We must make sure 4.1 and master are not very
different now.

Modification:

Fix found differences

Result:

4.1 and master got closer.
2014-04-25 16:17:59 +09:00
Michael Nitschinger
65ee10fbd0 [codec-memcache] Avoid NPE on channelInactive.
Motivation:
When no currentMessage has been set and the channel is inactive, a NPE is raised.

Modification:
Make sure that a currentMessage is available before checking the extras.

Result:
No more NPE raised potentially.
2014-04-23 11:41:44 +02:00
Michael Nitschinger
37ee6ef79a [codec-memcache] Simplify object hierachy and remove Headers.
This changeset removes the separate message headers and merges the
field directly into the messages. This greatly simplifies the
object hierachy and also saves header allocations in the pipeline.
2014-03-04 13:05:30 +01:00
Michael Nitschinger
cd6b5def8d Always upstream full memcache messages.
This changeset is related to #2182, which exposes the failure in
the http codec, but the memcache codec works very similar. In addition,
better failure handling in the decoder has been added.
2014-02-24 10:42:17 +01:00
Trustin Lee
7e1db4feb7 Deprecate CombinedChannelDuplexHandler in favor of ChannelHandlerAppender
- Fixes #2233
2014-02-13 19:20:25 -08:00
Trustin Lee
ac70dc4546 Update the version to 4.1.0.Alpha1-SNAPSHOT 2014-02-13 18:32:26 -08:00
Trustin Lee
8837afddf8 Enable a user specify an arbitrary information with ReferenceCounted.touch()
- Related: #2163
- Add ResourceLeakHint to allow a user to provide a meaningful information about the leak when touching it
- DefaultChannelHandlerContext now implements ResourceLeakHint to tell where the message is going.
- Cleaner resource leak report by excluding noisy stack trace elements
2014-02-13 18:16:25 -08:00
Trustin Lee
45e70d9935 Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163
- Inspector warnings
2014-02-13 18:10:11 -08:00
Trustin Lee
df346a023b Change the return type of EmbeddedChannel.read*() from Object to an ad-hoc type parameter
.. so that there's no need to explicitly down-cast.

Fixes #2067
2014-02-13 17:19:26 -08:00
Michael Nitschinger
b17a765615 codec-memcache: prefix abstract classes with Abstract. 2014-02-13 17:09:21 -08:00
Michael Nitschinger
fcb32a77b9 codec-memcache: No need to allocate a buffer if no extra is used. 2014-02-13 17:09:13 -08:00
Trustin Lee
9840de82f0 Fix another buffer leak in BinaryMemcacheDecoderTest 2014-02-13 17:05:25 -08:00
Trustin Lee
b592a18cd1 Fix buffer leaks in BinaryMemcacheDecoderTest 2014-02-13 17:05:19 -08:00
Trustin Lee
ccd231b8f4 Fix a buffer leak in BinaryMemcacheDecoder 2014-02-13 17:05:05 -08:00
Trustin Lee
acf7dbf811 Fix buffer leaks in BinaryMemcacheEncoderTest 2014-02-13 17:04:58 -08:00
Trustin Lee
fab56bae94 Fix a buffer leak in BinaryMemcacheObjectAggregatorTest 2014-02-13 17:03:05 -08:00
Trustin Lee
d417e3dbd0 Fix a buffer leak in BinaryMemcacheObjectAggregatorTest 2014-02-13 17:02:58 -08:00
Trustin Lee
0ff98c98e2 readableBytes() ==0 -> !isReadable() 2014-02-13 16:56:35 -08:00
Trustin Lee
d31a3e4120 Hide protocol detail from users 2014-02-13 16:56:22 -08:00
Michael Nitschinger
215e75c7d9 codec-memcache: increase default buffer size and only encode extras if set. 2014-02-13 16:55:46 -08:00
Michael Nitschinger
f03c32e137 [codec-memcache] encode key directly, no need to use unpooled. 2014-02-13 16:51:51 -08:00
Michael Nitschinger
a1526bedd3 codec-memcache: removed println in test case. 2014-02-13 16:51:45 -08:00
Michael Nitschinger
183bfe8f9f codec-memcache: fix decoding issue for value parts.
This changeset fixes an issue when decoding would stop if the value
comes separated in two or more packets, leading to invalid bytes read.
2014-02-13 16:51:37 -08:00
Michael Nitschinger
c78544cfaa Avoid memory leak when encoding the key 2014-02-13 16:36:09 -08:00
Trustin Lee
d748113c7d Abstract classes' names should start with 'Abstract' 2014-02-13 15:39:05 -08:00
Trustin Lee
71b6439c66 Fixed various inspector warnings 2014-02-13 15:38:52 -08:00
Trustin Lee
3dd7fba320 Moved constant classes out of util 2014-02-13 15:38:20 -08:00
Trustin Lee
a327a25a6c Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2014-02-13 15:37:16 -08:00
Michael Nitschinger
20f6f7e018 Implementing the Binary Memcache protocol
This changeset implements the full memcache binary protocol spec, including
a first batch of tests. Ascii protocol and more coverage and helper classes
will follow.
2014-02-13 15:29:38 -08:00