You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/06/30 02:04:37 UTC

[GitHub] [rocketmq] Justinwins opened a new pull request, #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

Justinwins opened a new pull request, #4534:
URL: https://github.com/apache/rocketmq/pull/4534

   The change is clear and simple .


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Justinwins commented on pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

Posted by GitBox <gi...@apache.org>.
Justinwins commented on PR #4534:
URL: https://github.com/apache/rocketmq/pull/4534#issuecomment-1179650755

   Thx .I found there's a terrible mistake there. I meant to use a bounde queue with a maxsize of 1000...
   


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on code in PR #4534:
URL: https://github.com/apache/rocketmq/pull/4534#discussion_r911580940


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -567,15 +567,12 @@ public void operationComplete(ChannelFuture f) throws Exception {
     }
 
     class NettyEventExecutor extends ServiceThread {
-        private final LinkedBlockingQueue<NettyEvent> eventQueue = new LinkedBlockingQueue<NettyEvent>();
         private final int maxSize = 10000;
+        private final LinkedBlockingQueue<NettyEvent> eventQueue = new LinkedBlockingQueue<NettyEvent>();
 
         public void putNettyEvent(final NettyEvent event) {
-            int currentSize = this.eventQueue.size();
-            if (currentSize <= maxSize) {
-                this.eventQueue.add(event);
-            } else {
-                log.warn("event queue size [{}] over the limit [{}], so drop this event {}", currentSize, maxSize, event.toString());
+            if (!eventQueue.offer(event)) {

Review Comment:
   eventQueue is not bounded... it never fails...and this breaks the current trade-off impl I mentioned in the issue



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui closed pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

Posted by GitBox <gi...@apache.org>.
lizhanhui closed pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…
URL: https://github.com/apache/rocketmq/pull/4534


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Justinwins commented on pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

Posted by GitBox <gi...@apache.org>.
Justinwins commented on PR #4534:
URL: https://github.com/apache/rocketmq/pull/4534#issuecomment-1171052962

   @zhouxinyu could you pls take a look at this issue ?


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on code in PR #4534:
URL: https://github.com/apache/rocketmq/pull/4534#discussion_r911581397


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -567,15 +567,12 @@ public void operationComplete(ChannelFuture f) throws Exception {
     }
 
     class NettyEventExecutor extends ServiceThread {
-        private final LinkedBlockingQueue<NettyEvent> eventQueue = new LinkedBlockingQueue<NettyEvent>();
         private final int maxSize = 10000;
+        private final LinkedBlockingQueue<NettyEvent> eventQueue = new LinkedBlockingQueue<NettyEvent>();
 
         public void putNettyEvent(final NettyEvent event) {
-            int currentSize = this.eventQueue.size();
-            if (currentSize <= maxSize) {
-                this.eventQueue.add(event);
-            } else {
-                log.warn("event queue size [{}] over the limit [{}], so drop this event {}", currentSize, maxSize, event.toString());
+            if (!eventQueue.offer(event)) {

Review Comment:
   This comment: https://github.com/apache/rocketmq/issues/4533#issuecomment-1171878588



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org