Commit Graph

5693 Commits

Author SHA1 Message Date
Norman Maurer
6efac6179e [#1259] Add optimized queue for SCMP pattern and use it in NIO and native transport
This queue also produces less GC then CLQ when make use of OneTimeTask
2014-02-27 13:56:15 +01:00
Trustin Lee
b6aa032376 Fix checkstyle 2014-02-26 16:18:39 -08:00
Trustin Lee
c42570576e Fix a bug where HttpObjectDecoder generates two LastHttpContent consecutively
Motivation:
When an HttpResponseDecoder decodes an invalid chunk, a LastHttpContent instance is produced and the decoder enters the 'BAD_MESSAGE' state, which is not supposed to produce a message any further.  However, because HttpObjectDecoder.invalidChunk() did not clear this.message out to null, decodeLast() will produce another LastHttpContent message on a certain situation.

Modification:
Do not forget to null out HttpObjectDecoder.message in invalidChunk(), and add a test case for it.

Result:
No more consecutive LastHttpContent messages produced by HttpObjectDecoder.
2014-02-26 15:54:45 -08:00
Michael Nitschinger
3f53ba2e36 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-23 16:44:06 +01:00
Michael Nitschinger
64be9b2e4a Upgrade JMH to 0.4.1 and make use of @Params. 2014-02-23 16:39:15 +01:00
cmcmaugh
75bb6d075c Apply receive timeout to commPort when using RxtxChannel. Part of [#1390] 2014-02-23 16:35:35 +01:00
Norman Maurer
01cd5929da Fix check to clear READ_OP and EPOLLIN. Part of [#2254] 2014-02-22 20:06:21 +01:00
Norman Maurer
52535a12f8 [#2254] Correctly handle Channel.read() and ChannelHandlerContext.read()
This includes also when it is called from channelRead(...) and channelReadComplete(...) methods.
2014-02-22 18:54:03 +01:00
Norman Maurer
60b830ba89 Directly use memory addresses for gathering writes to reduce gc pressure. Part of [#2239]
This also does factor out some logic of ChannelOutboundBuffer. Mainly we not need nioBuffers() for many
transports and also not need to copy from heap to direct buffer. So this functionality was moved to
NioSocketChannelOutboundBuffer. Also introduce a EpollChannelOutboundBuffer which makes use of
memory addresses for all the writes to reduce GC pressure
2014-02-21 14:16:37 +01:00
Norman Maurer
bea810707c [#2254] Fix regression in handling autoRead and Channel.read()
This regression was introduced by e0b39159657c9eb711047bc32367537c4870d467
2014-02-21 09:46:28 +01:00
Trustin Lee
3f2d3c9f1d Avoid unnecessary IllegalStateException in ChunkedWriteHandler
Motivation:
ChunkedWriteHandler can sometimes fail to write the last chunk of a ChunkedInput due to an I/O error.  Subsequently, the ChunkedInput's associated promise is marked as failure and the connection is closed.  When the connection is closed, ChunkedWriteHandler attempts to clean up its message queue and to mark their promises as success or failure.  However, because the promise of the ChunkedInput, which was consumed completely yet failed to be written, is already marked as failure, the attempt to mark it as success fails, leading a WARN level log.

Modification:
Use trySuccess() instead of setSuccess() so that the attempt to mark a ChunkedInput as success does not raise an exception even if the promise is already done.

Result:
Fixes #2249
2014-02-20 17:15:02 -08:00
Jeff Pinner
97f120330b SPDY: remove SPDY/3 support 2014-02-20 15:02:16 -08:00
Trustin Lee
ff8df41541 Fix another leak in HttpObjectAggregatorTest by removing redundant code 2014-02-20 14:30:42 -08:00
Trustin Lee
2e6918c21a Fix a memory leak in HttpObjectAggregatorTest 2014-02-20 13:49:56 -08:00
Trustin Lee
f4b9aaaf18 Add an operation that resets the state of HttpObjectDecoder
Motivation:

Currently, it is impossible to give a user the full control over what to do in response to the request with 'Expect: 100-continue' header.  Currently, a user have to do one of the following:

- Accept the request and respond with 100 Continue, or
- Send the reject response and close the connection.

.. which means it is impossible to send the reject response and keep the connection alive so that the client sends additional requests.

Modification:

Added a public method called 'reset()' to HttpObjectDecoder so that a user can reset the state of the decoder easily.  Once called, the decoder will assume the next input will be the beginning of a new request.

HttpObjectAggregator now calls `reset()`right after calling 'handleOversizedMessage()' so that the decoder can continue to decode the subsequent request even after the request with 'Expect: 100-continue' header is rejected.

Added relevant unit tests / Minor clean-up

Result:

This commit completes the fix of #2211
2014-02-20 13:42:58 -08:00
Trustin Lee
7d238aaf45 Added a test for oversized HTTP responses 2014-02-20 11:47:19 -08:00
Trustin Lee
5f62821b84 Remove the deprecated constant field
Exposing the constant as a public static final field is usually not a
good idea because it gives less flexibility to us when we happen to
change our internal implementation.
2014-02-20 11:38:49 -08:00
Trustin Lee
b2174fccc1 Overall clean-up of HttpObjectAggregator / Handle oversized response differently
- Related: #2211
2014-02-20 11:37:35 -08:00
Chris Mowforth
84946b617b Expose a callback in HttpObjectAggregator to handle oversized messages
- Related: #2211
2014-02-20 11:37:35 -08:00
Norman Maurer
ecc8fb1b89 Fix a regression which could lead to GenericFutureListeners never been notifed. Part of [#2186].
This regression was introduced by commit c97f2d2de00ad74835067cb6f5a62cd4651d1161
2014-02-20 15:12:58 +01:00
Trustin Lee
97662a6c94 Fix a bug where HttpObjectAggregator doesn't always produce FullHttpMessage
- Fixes #2182
- Always convert an unfull invalid message to a full message
2014-02-19 15:33:53 -08:00
Trustin Lee
acc781ba1b Ensure that the last bad chunk is LastHttpChunk 2014-02-19 15:20:58 -08:00
Trustin Lee
18d91b8bf6 HttpObjectDecoder.invalidChunk() should return LastHttpChunk
because the decoder will enter 'BAD_MESSAGE' state and will not produce any chunk since then.
2014-02-19 14:59:26 -08:00
Norman Maurer
f9238d1c15 Correctly handle remove from epoll and EPOLLRDHUP. Also fix a bug with removing EPOLLIN and EPOLLOUT 2014-02-19 16:34:45 +01:00
Norman Maurer
0b3e10ed40 Ensure native transport is included in all and tarball 2014-02-17 22:46:33 +01:00
Norman Maurer
55d0f36a61 Use optimized write and read calls if memoryAddress is present. Part of [#2239] 2014-02-17 17:29:11 +01:00
Norman Maurer
b49490e239 Move marking ChannelPromise for writes uncancellable to addFlush for keep things simple 2014-02-17 16:15:49 +01:00
Trustin Lee
31c24bc981 Fix an inspector warning 2014-02-17 05:27:52 -08:00
Trustin Lee
2a74378d01 Overall clean-up in EpollSocketChannel
- Extract writev part from doWrite() for simplicity
- Clearer comments
2014-02-17 05:21:49 -08:00
Norman Maurer
52050796e7 [#2238] Fix bug which caused a SIGSEGV when calling remoteAddress() or localAddress() 2014-02-17 12:00:12 +01:00
Norman Maurer
e0669522a3 Correctly update the ByteBuffers position on write and writev 2014-02-17 07:29:33 +01:00
Trustin Lee
0b1acf35c9 Fix resource leaks in ByteArrayEncoderTest 2014-02-16 11:51:27 -08:00
Norman Maurer
b1e7cefe32 Use correct writerIndex when read for channel 2014-02-16 20:44:06 +01:00
Norman Maurer
49cbf1d6b9 Fix compile error in test 2014-02-15 23:05:26 +01:00
Norman Maurer
e0299e1222 Introduce a native transport for linux using epoll ET
This transport use JNI (C) to directly make use of epoll in Edge-Triggered mode for maximal performance on Linux. Beside this it also support using TCP_CORK and produce less GC then the NIO transport using JDK NIO.
It only builds on linux and skip the build if linux is not used. The transport produce a jar which contains all needed .so files for 32bit and 64 bit. The user only need to include the jar as dependency as usually
to make use of it and use the correct classes.

This includes also some cleanup of @trustin
2014-02-15 22:42:07 +01:00
Trustin Lee
c73e1e3c1e Fix inefficient loop in QueryStringDecoder.decodeComponent()
- Fixes #2228
- There's no point of looping until the end of the component if at least one '%' or '+' is found.
2014-02-14 13:27:08 -08:00
Michael Nitschinger
6c02e19d10 Update JMH to 0.3.2 2014-02-14 13:15:49 -08:00
Trustin Lee
d5e897bba2 Determine the default allocator from system property
- Add ByteBufAllocator.DEFAULT
- The default allocator is now 'pooled'
2014-02-14 13:04:48 -08:00
Trustin Lee
bf0ae49c4f Do not warn about Unsafe in Android 2014-02-14 12:07:07 -08:00
Trustin Lee
e8c672d6c4 Fix wiki link 2014-02-14 12:03:51 -08:00
Trustin Lee
072b6eaa0f Fix a compilation error 2014-02-13 19:59:20 -08:00
Trustin Lee
ce9403cc3a Do not use String.format() for log message generation
- It's slow.
2014-02-13 19:31:45 -08:00
Norman Maurer
657af70576 Prettify exception message 2014-02-13 06:47:40 +01:00
Norman Maurer
0ad029bf96 Allow to set IoRatio to 100% 2014-02-12 19:30:57 +01:00
Norman Maurer
4dc337a717 Correctly respect isAutoRead() and make it consistent across OIO/NIO 2014-02-11 20:46:58 +01:00
Norman Maurer
a96eb96646 Allow to cancel non-flushed writes 2014-02-11 20:00:56 +01:00
Trustin Lee
6c094237e5 Do not warn if failed to mark a void promise as success
- it's always supposed to fail.
2014-02-10 15:04:03 -08:00
Trustin Lee
fee1d9e75c Make most outbound operations cancellable / More robust promise update
- Inspired by #2214 by @normanmaurer
- Call setUncancellable() before performing an outbound operation
- Add safeSetSuccess/Failure() and use them wherever
2014-02-10 14:52:24 -08:00
Trustin Lee
5395e263ad Make the build not fail in JDK8 until we fix Javadoc 2014-02-10 14:12:19 -08:00
Trustin Lee
a34d5baad2 Make most outbound operations are cancellable
- Inspired by #2214
- It actually reduces the chance of trying to marking a cancelled promise as success again, which raises an IllegalStateException.
2014-02-10 14:05:29 -08:00