Blocking call inside of a software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool.close
- Langage dominant
- Java
- Étoiles
- 2.6k
- Forks
- 1k
- Merge moyen
- 2 j 9 h
- PR mergées (30 j)
- 51
Description
Since v2 is claimed to be non-blocking, we still facing a blocking call in `software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool#close` which could be concidered as illegal in this case.
We use https://github.com/reactor/BlockHound in pair with Reactor in spring as well as localstack in testcontainers in our tests, where this blocking call is popping out.
## Describe the issue
We see in test logs this stacktrace:
```java
2020-11-13 11:15:00.917 WARN 63962 --- [entExecutor-2-1] i.n.util.concurrent.GlobalEventExecutor : Unexpected exception from the global event executor:
reactor.blockhound.BlockingOperationError: Blocking call! java.lang.Object#wait
at java.base/java.lang.Object.wait(Object.java)
at java.base/java.lang.Object.wait(Object.java:321)
at io.netty.util.concurrent.DefaultPromise.awaitUninterruptibly(DefaultPromise.java:274)
at io.netty.channel.DefaultChannelPromise.awaitUninterruptibly(DefaultChannelPromise.java:137)
at io.netty.channel.DefaultChannelPromise.awaitUninterruptibly(DefaultChannelPromise.java:30)
at io.netty.channel.pool.SimpleChannelPool.close(SimpleChannelPool.java:402)
at software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool.close(BetterSimpleChannelPool.java:38)
at software.amazon.awssdk.http.nio.netty.internal.HonorCloseOnReleaseChannelPool.close(HonorCloseOnReleaseChannelPool.java:75)
at software.amazon.awssdk.http.nio.netty.internal.IdleConnectionCountingChannelPool.close(IdleConnectionCountingChannelPool.java:106)
at software.amazon.awssdk.http.nio.netty.internal.utils.BetterFixedChannelPool.lambda$close0$3(BetterFixedChannelPool.java:391)
at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:243)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
2020-11-13 11:15:05.917 ERROR 63962 --- [extShutdownHook] s.a.a.h.n.netty.NettyNioAsyncHttpClient : Unable to close channel pools
```
## Steps to Reproduce
It's hard actually to reproduce the issue, as it's visible or affecting test execution not 100% of the times.
However we're doing in tests something really simple like
```java
var client = DynamoDbEnhancedAsyncClient.builder().dynamoDbClient(DynamoDbAsyncClient.builder().build()).build();
dynamoDb.table("table-name", TableSchema.fromBean(Content.class)).createTable()/.query()
```
within the test. Later when the context closes (we defined clients as spring beans), the close method seems to be called.
## Current Behavior
`BetterSimpleChannelPool#close` blocks the thread
## Your Environment
* AWS Java SDK version used: 2.15.26
* JDK version used: 1.14
* Operating System and version: any
Current workaround is to whitelist this in the BlockHound
```java
.allowBlockingCallsInside(
"software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool",
"close"
)
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool#close et comparez son chemin d’appel avec io.netty.channel.pool.SimpleChannelPool.close dans la stack trace fournie. Reproduisez l’arrêt à l’aide de l’exemple DynamoDbEnhancedAsyncClient et du scénario de fermeture du contexte Spring, puis vérifiez que la fermeture des pools de canaux ne produit plus l’erreur BlockHound d’opération bloquante ni l’échec d’arrêt signalé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- aws, java
- Domaine
- backend, networking
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100