XiaoyiPeng edited a comment on pull request #3509:
URL: https://github.com/apache/rocketmq/pull/3509#issuecomment-995779159


   > I think it's not a deadlock problem.
   > 
   > when queue.remove(), will point the next node of the node to be deleted to 
itself. **java.util.concurrent.LinkedBlockingQueue#dequeue**
   > 
   > ```
   >     private E dequeue() {
   >         // assert takeLock.isHeldByCurrentThread();
   >         // assert head.item == null;
   >         Node<E> h = head;
   >         Node<E> first = h.next;
   >         h.next = h; // help GC
   >         head = first;
   >         E x = first.item;
   >         first.item = null;
   >         return x;
   >     }
   > ```
   > 
   > when queue.stream(), will fall into an endless loop. 
**LinkedBlockingQueue$LBQSpliterator#tryAdvance()** 
![image](https://user-images.githubusercontent.com/36399867/145761467-a085c8b9-6a9b-4cb3-9af8-e1127cf67012.png)
   
   Thanks for your review, gentleman, you are right!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to