I see at least one potential (and very serious) bug:
The constructor UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity) takes a potentially non-direct-buffer as input, doesn't verify that it's actually a direct buffer, extracts it's address using PlatformDependent.directBufferAddress(buffer), which eventually gets the address via a getLong(buffer, ADDRESS_FIELD_OFFSET), and then later uses that address for direct addressing via unsafe.GetX() methods. The ones intended to never be used on heap objects.
The Unpooled class has a public static ByteBuf wrappedBuffer(ByteBuffer buffer) method that can accept (from end-user code) a non-direct byte buffer, and (if unsafe is supported) create an UnpooledUnsafeDirectByteBuf around it without ever making sure it's really a direct buffer. So now we have unsafe operating on something that is either a random address or a constant heap address (which is just as random over time).
I *think* that this combination makes things go Boom. Unfortunately it will probably be a very latent boom. Not one of those nice SEGV things. Also may not hit you unless timing is just right. More likely to result in psot-QA heap corruption and fun debugging trips with heap dumps coming in from the field.
Is Netty making my point for me in our separate Unsafe related threads?
-- Gil.