You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "cserwen (via GitHub)" <gi...@apache.org> on 2023/05/09 07:53:39 UTC

[GitHub] [rocketmq-client-go] cserwen opened a new issue, #1051: Close the channel before sending data if the consumer has been shutdown.

cserwen opened a new issue, #1051:
URL: https://github.com/apache/rocketmq-client-go/issues/1051

   ### # The Question
   For the consumer, the closing and writing of msgCh are in two coroutines. Even though the chan of `closeChan` is added, since multiple `case` clauses are randomly executed for the `select` statement, it is still possible Write data to a closed channel
   ```go
   if !pq.order {
       select {
       case <-pq.closeChan:
           return
       case pq.msgCh <- messages:
       }
   }
   ```
   https://github.com/apache/rocketmq-client-go/blob/master/consumer/process_queue.go#LL124C1-L130C3
   
   ### # How fo fix?
   We'd better close the channel in the goroutine that pullMessage to avoid closing and writing at the same time.


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

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


[GitHub] [rocketmq-client-go] 0daypwn commented on issue #1051: Close the channel before sending data if the consumer has been shutdown.

Posted by "0daypwn (via GitHub)" <gi...@apache.org>.
0daypwn commented on issue #1051:
URL: https://github.com/apache/rocketmq-client-go/issues/1051#issuecomment-1738694697

   https://github.com/apache/rocketmq-client-go/blob/da20ee7b0743a08ecf1fc53403f530b74eea2257/consumer/consumer.go#L296-L306
   
   consumer/consumer.go 这部分是基类
   需要考虑 
   consumer/push_consumer.go
   consuemr/pull_consumer.go


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

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