2ce8c7dc18
Motivation: We were seeing rare test failures where a cleaner had raced to close a memory segment we were using or closing. The cause was that a single MemorySegment ended up used in multiple Buf instances. When the SizeClassedMemoryPool was closed, the memory segments could be disposed without closing the gate in the NativeMemoryCleanerDrop. The gate is important because it prevents double-frees of the memory segment. Modification: The fix is to change how the SizeClassedMemoryPool is closed, such that it always releases memory by calling `close()` on its buffers, which in turn will close the gate. The program will then proceed through the SizeClassedMemoryPool.drop implementation, which in turn will observe that the allocator is closed, and *then* dispose of the memory. Result: We should hopefully not see any more random test failures, but if we do, they would at least indicate a different bug. This particular one was mostly showing up inside the cleaner threads, which were ignoring the exception, but occasionally I think the race went the other way, causing a test failure. |
||
---|---|---|
.github/workflows | ||
src | ||
.dockerignore | ||
.gitignore | ||
Dockerfile | ||
Makefile | ||
pom.xml | ||
README.md |
Netty Incubator Buffer API
This repository is incubating a new buffer API proposed for Netty 5.
Building and Testing
Short version: just run make
.
The project currently relies on snapshot versions of the Panama Foreign fork of OpenJDK.
This allows us to test out the must recent version of the jdk.incubator.foreign
APIs, but also make building and local development more involved.
To simplify things, we have a Docker based build, controlled via a Makefile with the following commands:
image
– build the docker image. This includes building a snapshot of OpenJDK, and download all relevant Maven dependencies.test
– run all tests in a docker container. This impliesimage
. The container is automatically deleted afterwards.dbg
– drop into a shell in the build container, without running the build itself. The debugging container is not deleted afterwards.clean
– remote the debugging container created bydbg
.build
– build binaries and run all tests in a container, and copy thetarget
directory out of the container afterwards. This is the default build target.