Go to file
Trustin Lee 5f9090a7f0 Fix invalid memory access in AIO writes
To perform writes in AioSocketChannel, we get a ByteBuffer view of the
outbound buffer and specify it as a parameter when we call
AsynchronousSocketChannel.write().

In most cases, the write() operation is finished immediately.  However,
sometimes, it is scheduled for later execution.  In such a case, there's
a chance for a user's handler to append more data to the outbound
buffer.

When more data is appended to the outbound buffer, the outbound buffer
can expand its capacity by itself.  Changing the capacity of a buffer is
basically made of the following steps:

1. Allocate a larger new internal memory region.
2. Copy the current content of the buffer to the new memory region.
3. Rewire the buffer so that it refers to the new region.
4. Deallocate the old memory region.

Because the old memory region is deallocated at the step 4, the write
operation scheduled later will access the deallocated region, leading
all sort of data corruption or even segfaults.

To prevent this situation, I added suspendIntermediaryDeallocations()
and resumeIntermediaryDeallocations() to UnsafeByteBuf.

AioSocketChannel.doFlushByteBuf() now calls suspendIntermediaryDealloc()
to defer the deallocation of the old memory regions until the completion
handler is notified.
2012-12-02 21:50:33 +09:00
all Only generate OSGi manifest only at all-in-on sub module to reduce the complexity to the build 2012-11-19 06:27:18 +01:00
buffer Fix invalid memory access in AIO writes 2012-12-02 21:50:33 +09:00
codec Fix invalid memory access in AIO writes 2012-12-02 21:50:33 +09:00
codec-http ByteBufAllocator API w/ ByteBuf perf improvements 2012-11-22 15:10:59 +09:00
codec-socks Fix more inspector warnings introduced by recent mergences 2012-12-01 00:10:42 +09:00
common Fix all Xlint:unchecked warnings 2012-11-30 22:49:51 +09:00
example Fix more inspector warnings introduced by recent mergences 2012-12-01 00:10:42 +09:00
handler Fix inspector warnings introduced by recent mergences 2012-11-30 23:01:57 +09:00
license Added webbit license and credits 2011-10-27 10:34:37 +11:00
metrics-yammer Only generate OSGi manifest only at all-in-on sub module to reduce the complexity to the build 2012-11-19 06:27:18 +01:00
tarball [maven-release-plugin] prepare for next development iteration 2012-11-05 23:08:39 +01:00
testsuite Implement Bootstrap.toString() and use it in the testsuite 2012-11-26 16:14:24 +09:00
transport Fix invalid memory access in AIO writes 2012-12-02 21:50:33 +09:00
.fbfilter.xml Update license headers 2012-06-04 13:31:44 -07:00
.fbprefs Updated Find Bugs configuration 2009-03-04 10:33:09 +00:00
.gitignore ignore .idea/ folder 2012-01-16 16:01:00 +08:00
LICENSE.txt Relicensed to Apache License v2 2009-08-28 07:15:49 +00:00
NOTICE.txt More copyright updates 2011-12-09 14:28:48 +09:00
pom.xml Enable assertions only for Netty classes 2012-11-26 15:01:13 +09:00
README.md Fix README 2012-09-08 20:20:45 +02:00

The Netty Project

Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

Getting Netty

    <dependencies>
      ...
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty</artifactId>
        <version>X.Y.Z.Q</version>
        <scope>compile</scope>
      </dependency>
      ...
    </dependencies>

Developer Information

  • Netty is setup to build using Maven

  • You need JDK 7 to build Netty. Netty will run with JDK 5 (3.x) and JDK 6 (4).

  • master branch contains code for Netty 4.x

  • 3 branch contains code for Netty 3.x