You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/05/19 05:47:32 UTC

[GitHub] [pulsar-client-go] wolfstudy commented on a change in pull request #255: Fix perf-produce cannot be closed

wolfstudy commented on a change in pull request #255:
URL: https://github.com/apache/pulsar-client-go/pull/255#discussion_r427043780



##########
File path: perf/perf-producer.go
##########
@@ -98,7 +98,7 @@ func produce(produceArgs *ProduceArgs, stop <-chan struct{}) {
 
 	ch := make(chan float64)
 
-	go func() {
+	go func(stop <-chan struct{}) {

Review comment:
       > maybe rename this the stopCh so it's clear in the go routine which one it's using?
   
   ok
   
   > Just curious what are the steps for it getting stuck?
   
   ```
   func produce(produceArgs *ProduceArgs, stop <-chan struct{}) {
       .....
       go func() {
   		for {
   			select {
   			case <-stop:
   				return
   			
   			....
                }
   	}()
       ......
   }
   ```
   
   In gorutine, the external `stop` parameter is not visible to it, so the program is blocked inside this gorutine 




----------------------------------------------------------------
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.

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