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

[GitHub] [rocketmq-clients] tianping526 opened a new issue, #294: golang DATA RACE

tianping526 opened a new issue, #294:
URL: https://github.com/apache/rocketmq-clients/issues/294

   ```golang
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/rpc_client.go:98
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/rpc_client.go:98
   func (rc *rpcClient) QueryRoute(ctx context.Context, request *v2.QueryRouteRequest) (*v2.QueryRouteResponse, error) {
   	rc.activityNanoTime = time.Now() // DATA RACE
   	resp, err := rc.msc.QueryRoute(ctx, request)
   	sugarBaseLogger.Debugf("queryRoute request: %v, response: %v, err: %v", request, resp, err)
   	return resp, err
   }
   
   ==================
   ==================
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/rpc_client.go:137
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/rpc_client.go:137
   func (rc *rpcClient) ReceiveMessage(ctx context.Context, request *v2.ReceiveMessageRequest) (v2.MessagingService_ReceiveMessageClient, error) {
   	rc.activityNanoTime = time.Now() // DATA RACE
   	resp, err := rc.msc.ReceiveMessage(ctx, request)
   	sugarBaseLogger.Debugf("receiveMessage request: %v, err: %v", request, err)
   	return resp, err
   }
   
   ==================
   ==================
   
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/metric.go:166
   func (dcmp *defaultClientMeterProvider) isEnabled() bool {
   	return dcmp.clientMeter.enabled // DATA RACE
   }
   
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/metric.go:183
   	if !metric.GetOn() {
   		dcmp.clientMeter.shutdown()
   		sugarBaseLogger.Infof("metric is off, clientId=%s", dcmp.client.GetClientID())
   		dcmp.clientMeter = NewDefaultClientMeter(nil, false, nil, dcmp.client.GetClientID()) // DATA RACE
   		return
   	}
   
   ==================
   ==================
   
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/producer_options.go:117
   func (ps *producerSettings) IsValidateMessageType() bool {
   	return ps.validateMessageType // DATA RACE
   }
   
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/producer_options.go:163
   	}
   	ps.validateMessageType = v.Publishing.GetValidateMessageType()
   	ps.maxBodySizeBytes = int(v.Publishing.GetMaxBodySize()) // DATA RACE
   
   ==================
   ==================
   
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/message_id_codec.go:138
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/message_id_codec.go:139
   	deltaSeconds := deltaSeconds()
   	if seconds != deltaSeconds { // DATA RACE
   		seconds = deltaSeconds // DATA RACE
   	}
   
   ==================
   ==================
   
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/producer.go:288 
   		if uMsg.pubMsg == nil {
   			pubMessage, err = NewPublishingMessage(msg, p.pSetting, txEnabled)  // DATA RACE
   			if err != nil {
   				return nil, err
   			}
   		}
   // github.com/apache/rocketmq-clients/golang@v0.0.0-20221125070211-5ba0ba13e773/producer_options.go:164
   	ps.validateMessageType = v.Publishing.GetValidateMessageType()
   	ps.maxBodySizeBytes = int(v.Publishing.GetMaxBodySize())  // DATA RACE
   ```


-- 
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-clients] guyinyou commented on issue #294: golang DATA RACE

Posted by "guyinyou (via GitHub)" <gi...@apache.org>.
guyinyou commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1489587129

   > go test -race -run ^TestDefaultClientMeterProviderResetNoDataRace$
   
   I tried it and you were 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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq-clients] guyinyou commented on issue #294: golang DATA RACE

Posted by GitBox <gi...@apache.org>.
guyinyou commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1333116135

   Could you submit a PR to help fix it?


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


[GitHub] [rocketmq-clients] github-actions[bot] commented on issue #294: golang DATA RACE

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1368304156

   This issue is stale because it has been open for 30 days with no activity. It will be closed in 3 days if no further activity occurs.


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


[GitHub] [rocketmq-clients] guyinyou commented on issue #294: golang DATA RACE

Posted by "guyinyou (via GitHub)" <gi...@apache.org>.
guyinyou commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1487868303

   > I don't think there is a data race there. Above this the global mutex is on so there can be no invocations of the Reset functions concurrently.
   > 
   > ```
   > if !metric.GetOn() {
   > 		dcmp.clientMeter.shutdown()
   > 		sugarBaseLogger.Infof("metric is off, clientId=%s", dcmp.client.GetClientID())
   > 		dcmp.clientMeter = NewDefaultClientMeter(nil, false, nil, dcmp.client.GetClientID()) // DATA RACE
   > 		return
   > 	}
   > ```
   
   You can use the -race parameter to run to know which parts have data race


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


[GitHub] [rocketmq-clients] github-actions[bot] closed issue #294: golang DATA RACE

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #294: golang DATA RACE
URL: https://github.com/apache/rocketmq-clients/issues/294


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


[GitHub] [rocketmq-clients] Anakin100100 commented on issue #294: golang DATA RACE

Posted by "Anakin100100 (via GitHub)" <gi...@apache.org>.
Anakin100100 commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1486354425

   @aaron-ai Please assign this issue to me. 


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


[GitHub] [rocketmq-clients] Anakin100100 commented on issue #294: golang DATA RACE

Posted by "Anakin100100 (via GitHub)" <gi...@apache.org>.
Anakin100100 commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1488460378

   @guyinyou I wrote a test in metric_test.go where I call the reset repeatedly in parallel and there is no data race, you can run the test using 
   ```
    go test -race -run ^TestDefaultClientMeterProviderResetNoDataRace$
   ```


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


[GitHub] [rocketmq-clients] Anakin100100 commented on issue #294: golang DATA RACE

Posted by "Anakin100100 (via GitHub)" <gi...@apache.org>.
Anakin100100 commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1487207976

   I don't think there is a data race there. The getClientId function reads the clientId property and returns a string copy. This could cause a data race only if this value was mutated after the defaultClient object was created but I haven't found any examples of that happening.
   
   ```
   if !metric.GetOn() {
   		dcmp.clientMeter.shutdown()
   		sugarBaseLogger.Infof("metric is off, clientId=%s", dcmp.client.GetClientID())
   		dcmp.clientMeter = NewDefaultClientMeter(nil, false, nil, dcmp.client.GetClientID()) // DATA RACE
   		return
   	}
   ```


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


[GitHub] [rocketmq-clients] aaron-ai closed issue #294: golang DATA RACE

Posted by "aaron-ai (via GitHub)" <gi...@apache.org>.
aaron-ai closed issue #294: golang DATA RACE
URL: https://github.com/apache/rocketmq-clients/issues/294


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


[GitHub] [rocketmq-clients] github-actions[bot] commented on issue #294: golang DATA RACE

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1371573288

   This issue was closed because it has been inactive for 3 days since being marked as stale.


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


[GitHub] [rocketmq-clients] tianping526 commented on issue #294: golang DATA RACE

Posted by "tianping526 (via GitHub)" <gi...@apache.org>.
tianping526 commented on issue #294:
URL: https://github.com/apache/rocketmq-clients/issues/294#issuecomment-1498897165

   ```shell
   go test -race ./...
   ```
   
   execute this command and there is still a lot of data race


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