Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Occasional leak of Thread/Channel instances and threads blocking indefinately

Aperta
#1,194 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
java, rabbitmq
Ambito
networking

Direzione di ricerca

Inizia da AMQChannel.doEnqueueRpc e segui il comportamento di attesa e timeout attraverso enqueueAsyncRpc, quiescingAsyncRpc, asyncRpc e privateAsyncRpc. Poi esamina ChannelN.asyncCompletableRpc e il percorso di dichiarazione di reactor Sender. Il lavoro è completato quando le invocazioni rispettano il timeout RPC invece di attendere indefinitamente, con una copertura per lo stato bloccato segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Describe the bug

We noticed that occasionally we have threads stuck forever with the sack that point to the RabbitMQ channel class.
The stack is below. Generally there are several notes about this:

  1. The the RPC timeout is not applied to the enqueueAsyncRpc part of the processing only to the IO part
    This makes it possible for the thread to wait forever for _activeRpc to clear which in this case never happens.
    i.e. the code below can loop forever disregarding the rpc timeout.

         while(this._activeRpc != null) {
             try {
                 this._channelLockCondition.await();
             } catch (InterruptedException var7) {
                 var2 = true;
             }
         }
    

    I guess the same rpc timeout note goes for any "lock" calls
    this._channelLock.lock()
    A thread can also get stuck there forever.

  2. The code was recently refactored to use locks instead of the synchronized sections
    It's not clear how that should work in the multi-threaded environment (java memory model) with members like _activeRpc.
    They are not declared as volatile/atomic. How would memory barrier be enforced for multi-threaded access to the
    member?

  3. Also the semantic of the at ChannelN.asyncCompletableRpc is async, so it should never block,
    but in fact it can and does block.

========================== Threads get stuck in this state indefinitely ================

java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)

  • parking to wait for <0x00000007a5c699d0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:341)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block([email protected]/AbstractQueuedSynchronizer.java:506)
    at java.util.concurrent.ForkJoinPool.unmanagedBlock([email protected]/ForkJoinPool.java:3465)
    at java.util.concurrent.ForkJoinPool.managedBlock([email protected]/ForkJoinPool.java:3436)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:1623)
    at com.rabbitmq.client.impl.AMQChannel.doEnqueueRpc
    at com.rabbitmq.client.impl.AMQChannel.enqueueAsyncRpc
    at com.rabbitmq.client.impl.AMQChannel.quiescingAsyncRpc
    at com.rabbitmq.client.impl.AMQChannel.asyncRpc
    at com.rabbitmq.client.impl.AMQChannel.privateAsyncRpc
    at com.rabbitmq.client.impl.AMQChannel.exnWrappingAsyncRpc
    at com.rabbitmq.client.impl.ChannelN.asyncCompletableRpc
    at reactor.rabbitmq.Sender.lambda$declareExchange$16
    ...
Reproduction steps

It's not clear what is triggering the condition.

Expected behavior

Any invocation should respect the rpc timeout.

Additional context

The code is using 5.20.0 version of the java client.

Lingua principale
Java
Stelle
1.3k
Fork
588
Merge medio
4h 40m
PR unite (30g)
38

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rabbitmq/rabbitmq-java-client

Tutte le issue di rabbitmq/rabbitmq-java-client

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.