GeezerVison is showing github.com — AdaptiveByteBufAllocator.newDirectBuffer throws BlockingOperationError · Issue #14560 · netty/netty
AdaptiveByteBufAllocator.newDirectBuffer throws BlockingOperationError #14560
Description
Expected behavior
AdaptiveByteBufAllocator.newDirectBuffer does not throw AdaptiveByteBufAllocator.newDirectBuffer
Actual behavior
AdaptiveByteBufAllocator.newDirectBuffer throws AdaptiveByteBufAllocator.newDirectBuffer
Caused by: reactor.blockhound.BlockingOperationError: Blocking call! sun.misc.Unsafe#park
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
at java.util.concurrent.CopyOnWriteArrayList.addIfAbsent(CopyOnWriteArrayList.java:624)
at java.util.concurrent.CopyOnWriteArrayList.addIfAbsent(CopyOnWriteArrayList.java:615)
at java.util.concurrent.CopyOnWriteArraySet.add(CopyOnWriteArraySet.java:261)
at io.netty.buffer.AdaptivePoolingAllocator$1.initialValue(AdaptivePoolingAllocator.java:162)
at io.netty.util.concurrent.FastThreadLocal.initialize(FastThreadLocal.java:177)
at io.netty.util.concurrent.FastThreadLocal.get(FastThreadLocal.java:142)
at io.netty.buffer.AdaptivePoolingAllocator.allocate(AdaptivePoolingAllocator.java:220)
at io.netty.buffer.AdaptivePoolingAllocator.allocate(AdaptivePoolingAllocator.java:212)
at io.netty.buffer.AdaptiveByteBufAllocator.newDirectBuffer(AdaptiveByteBufAllocator.java:70)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:188)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179)
at io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:116)
at io.netty.handler.codec.http.HttpObjectEncoder.encodeFullHttpMessage(HttpObjectEncoder.java:328)
at io.netty.handler.codec.http.HttpObjectEncoder.encode(HttpObjectEncoder.java:165)
at io.netty.handler.codec.http.HttpClientCodec$Encoder.encode(HttpClientCodec.java:290)
at io.netty.handler.codec.http.HttpObjectEncoder.write(HttpObjectEncoder.java:100)
... 58 common frames omitted
Netty version
4.2.0.Final-SNAPSHOT
JVM version (e.g. java -version)
JDK 8
OS version (e.g. uname -a)
Mac OS
Activity
violetagg commented on Dec 12, 2024
Allowing the blocking call will solve the issue:
diff --git a/common/src/main/java/io/netty/util/internal/Hidden.java b/common/src/main/java/io/netty/util/internal/Hidden.java
index 746e91c8fa..64bd5701e7 100644
--- a/common/src/main/java/io/netty/util/internal/Hidden.java
+++ b/common/src/main/java/io/netty/util/internal/Hidden.java
@@ -94,6 +94,11 @@ class Hidden {
"free"
);
+ builder.allowBlockingCallsInside(
+ "io.netty.buffer.AdaptiveByteBufAllocator",
+ "allocate"
+ );
+
builder.allowBlockingCallsInside(
"io.netty.handler.ssl.SslHandler",
"handshake"
normanmaurer commented on Dec 12, 2024
@violetagg can you do a PR ? This should also go into 4.1
Reacted by Violeta Georgieva
violetagg commented on Dec 12, 2024
@violetagg can you do a PR ? This should also go into 4.1
ok, will do that
added 3 commits that reference this issue
on Dec 13, 2024This issue will close once commit 9ef2934 is merged into the '4.2' branch.9ef2934 This issue will close once commit 55343e2 is merged into the '4.2' branch.55343e2 This issue will close once commit f52ae6a is merged into the '4.2' branch.f52ae6a
Metadata
Metadata
Development
No branches or pull requestsIssue actions